File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change @@ -239,4 +239,14 @@ public function createSubscription(array $parameters = array())
239
239
{
240
240
return $ this ->createRequest ('\Omnipay\Braintree\Message\CreateSubscriptionRequest ' , $ parameters );
241
241
}
242
+
243
+ /**
244
+ * @param string $subscriptionId
245
+ *
246
+ * @return \Omnipay\Common\Message\AbstractRequest
247
+ */
248
+ public function cancelSubscription ($ subscriptionId )
249
+ {
250
+ return $ this ->createRequest ('\Omnipay\Braintree\Message\CancelSubscriptionRequest ' , array ('id ' => $ subscriptionId ));
251
+ }
242
252
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+ namespace Omnipay \Braintree \Message ;
3
+
4
+ use Omnipay \Common \Message \ResponseInterface ;
5
+
6
+ /**
7
+ * Cancel Subscription Request
8
+ *
9
+ * @method CustomerResponse send()
10
+ */
11
+ class CancelSubscriptionRequest extends AbstractRequest
12
+ {
13
+ /** @var string */
14
+ protected $ subscriptionId ;
15
+
16
+ /**
17
+ * Get the raw data array for this message. The format of this varies from gateway to
18
+ * gateway, but will usually be either an associative array, or a SimpleXMLElement.
19
+ *
20
+ * @return mixed
21
+ */
22
+ public function getData ()
23
+ {
24
+ return $ this ->subscriptionId ;
25
+ }
26
+
27
+ /**
28
+ * Send the request with specified data
29
+ *
30
+ * @param mixed $data The data to send
31
+ * @return ResponseInterface
32
+ */
33
+ public function sendData ($ subscriptionId )
34
+ {
35
+ $ response = $ this ->braintree ->subscription ()->cancel ($ subscriptionId );
36
+
37
+ return $ this ->response = new SubscriptionResponse ($ this , $ response );
38
+ }
39
+
40
+ public function setId ($ subscriptionId )
41
+ {
42
+ $ this ->subscriptionId = $ subscriptionId ;
43
+ }
44
+ }
You can’t perform that action at this time.
0 commit comments