File tree Expand file tree Collapse file tree 7 files changed +27
-14
lines changed
Expand file tree Collapse file tree 7 files changed +27
-14
lines changed Original file line number Diff line number Diff line change 55use Omnipay \Common \AbstractGateway ;
66use Braintree_Gateway ;
77use Braintree_Configuration ;
8- use Guzzle \Http \ClientInterface ;
8+ use Omnipay \ Common \Http \ClientInterface ;
99use Symfony \Component \HttpFoundation \Request as HttpRequest ;
1010/**
1111 * Braintree Gateway
Original file line number Diff line number Diff line change 22
33namespace Omnipay \Braintree ;
44
5- use DateTime ;
6- use DateTimeZone ;
75use Omnipay \Common \Helper ;
86use Symfony \Component \HttpFoundation \ParameterBag ;
97
Original file line number Diff line number Diff line change 22
33namespace Omnipay \Braintree ;
44
5- use DateTime ;
6- use DateTimeZone ;
75use Omnipay \Common \Helper ;
86use Symfony \Component \HttpFoundation \ParameterBag ;
97
Original file line number Diff line number Diff line change 33namespace Omnipay \Braintree \Message ;
44
55use Braintree_Gateway ;
6- use Guzzle \Http \ClientInterface ;
6+ use Omnipay \ Common \Http \ClientInterface ;
77use Omnipay \Common \Exception \InvalidRequestException ;
88use Symfony \Component \HttpFoundation \Request as HttpRequest ;
99use Omnipay \Common \Message \AbstractRequest as BaseAbstractRequest ;
Original file line number Diff line number Diff line change 11<?php
22namespace Omnipay \Braintree \Message ;
33
4- use Omnipay \Common \Message \ResponseInterface ;
5-
64/**
75 * Authorize Request
86 *
Original file line number Diff line number Diff line change 11<?php
2+
23namespace Omnipay \Braintree \Message ;
34
5+ use Braintree \Exception \NotFound ;
6+ use Symfony \Component \HttpKernel \Exception \NotFoundHttpException ;
7+
48/**
59 * Find Customer Request
6- *
710 * @method CustomerResponse send()
811 */
912class FindCustomerRequest extends AbstractRequest
@@ -16,12 +19,18 @@ public function getData()
1619 /**
1720 * Send the request with specified data
1821 *
19- * @param mixed $data The data to send
20- * @return CustomerResponse
22+ * @param mixed $data
23+ *
24+ * @return \Omnipay\Braintree\Message\CustomerResponse|\Omnipay\Common\Message\ResponseInterface
25+ * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
2126 */
2227 public function sendData ($ data )
2328 {
24- $ response = $ this ->braintree ->customer ()->find ($ this ->getCustomerId ());
29+ try {
30+ $ response = $ this ->braintree ->customer ()->find ($ this ->getCustomerId ());
31+ } catch (NotFound $ exception ) {
32+ throw new NotFoundHttpException ($ exception ->getMessage ());
33+ }
2534
2635 return $ this ->response = new CustomerResponse ($ this , $ response );
2736 }
Original file line number Diff line number Diff line change 66
77/**
88 * Update PaymentMethod Request
9- *
109 * @method Response send()
1110 */
1211class UpdatePaymentMethodRequest extends AbstractRequest
@@ -28,11 +27,12 @@ public function getData()
2827 * Send the request with specified data
2928 *
3029 * @param mixed $data The data to send
30+ *
3131 * @return ResponseInterface
3232 */
3333 public function sendData ($ data )
3434 {
35- $ response = $ this ->braintree ->paymentMethod ()->update ($ data ['token ' ], $ data[ ' options ' ] );
35+ $ response = $ this ->braintree ->paymentMethod ()->update ($ data ['token ' ], $ data );
3636
3737 return $ this ->createResponse ($ response );
3838 }
@@ -47,6 +47,16 @@ public function setPaymentMethodToken($value)
4747 return $ this ->setParameter ('token ' , $ value );
4848 }
4949
50+ /**
51+ * @param $value
52+ *
53+ * @return \Omnipay\Common\Message\AbstractRequest
54+ */
55+ public function setMakeDefault ($ value )
56+ {
57+ return $ this ->setOptions (['makeDefault ' => (bool ) $ value ]);
58+ }
59+
5060 /**
5161 * @param array $options
5262 *
You can’t perform that action at this time.
0 commit comments