From 68210061b0559c8d8c87ae79da8ecfeda2665740 Mon Sep 17 00:00:00 2001 From: Kit Date: Thu, 24 Apr 2014 12:21:08 +0100 Subject: [PATCH] Added refund endpoint and appropriate warning. --- CHANGELOG.md | 4 ++++ lib/GoCardless/Bill.php | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb97d6d..fa5111a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.4.3 - April 24, 2014 + +- Adds support for refunding a bill via the API + ## 0.4.2 - January 15, 2014 - Adds support for charge_customer_at and cancelling payments diff --git a/lib/GoCardless/Bill.php b/lib/GoCardless/Bill.php index 6a324fa..544d018 100644 --- a/lib/GoCardless/Bill.php +++ b/lib/GoCardless/Bill.php @@ -110,4 +110,22 @@ public function cancel() { } + /** + * Refund a bill in the API + * + * Please note that the ability to refund bills via the API is + * disabled by default. Please contact help@gocardless.com if you + * have put through greater than 50 bills and require access to + * the refund API endpoint. + * + * @return object The result of the refund query + */ + public function refund() { + + $endpoint = self::$endpoint . '/' . $this->id . '/refund'; + + return new self($this->client, $this->client->request('post', $endpoint)); + + } + }