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 5
5
use Omnipay \Common \AbstractGateway ;
6
6
use Braintree_Gateway ;
7
7
use Braintree_Configuration ;
8
- use Guzzle \Http \ClientInterface ;
8
+ use Omnipay \ Common \Http \ClientInterface ;
9
9
use Symfony \Component \HttpFoundation \Request as HttpRequest ;
10
10
/**
11
11
* Braintree Gateway
Original file line number Diff line number Diff line change 2
2
3
3
namespace Omnipay \Braintree ;
4
4
5
- use DateTime ;
6
- use DateTimeZone ;
7
5
use Omnipay \Common \Helper ;
8
6
use Symfony \Component \HttpFoundation \ParameterBag ;
9
7
Original file line number Diff line number Diff line change 2
2
3
3
namespace Omnipay \Braintree ;
4
4
5
- use DateTime ;
6
- use DateTimeZone ;
7
5
use Omnipay \Common \Helper ;
8
6
use Symfony \Component \HttpFoundation \ParameterBag ;
9
7
Original file line number Diff line number Diff line change 3
3
namespace Omnipay \Braintree \Message ;
4
4
5
5
use Braintree_Gateway ;
6
- use Guzzle \Http \ClientInterface ;
6
+ use Omnipay \ Common \Http \ClientInterface ;
7
7
use Omnipay \Common \Exception \InvalidRequestException ;
8
8
use Symfony \Component \HttpFoundation \Request as HttpRequest ;
9
9
use Omnipay \Common \Message \AbstractRequest as BaseAbstractRequest ;
Original file line number Diff line number Diff line change 1
1
<?php
2
2
namespace Omnipay \Braintree \Message ;
3
3
4
- use Omnipay \Common \Message \ResponseInterface ;
5
-
6
4
/**
7
5
* Authorize Request
8
6
*
Original file line number Diff line number Diff line change 1
1
<?php
2
+
2
3
namespace Omnipay \Braintree \Message ;
3
4
5
+ use Braintree \Exception \NotFound ;
6
+ use Symfony \Component \HttpKernel \Exception \NotFoundHttpException ;
7
+
4
8
/**
5
9
* Find Customer Request
6
- *
7
10
* @method CustomerResponse send()
8
11
*/
9
12
class FindCustomerRequest extends AbstractRequest
@@ -16,12 +19,18 @@ public function getData()
16
19
/**
17
20
* Send the request with specified data
18
21
*
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
21
26
*/
22
27
public function sendData ($ data )
23
28
{
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
+ }
25
34
26
35
return $ this ->response = new CustomerResponse ($ this , $ response );
27
36
}
Original file line number Diff line number Diff line change 6
6
7
7
/**
8
8
* Update PaymentMethod Request
9
- *
10
9
* @method Response send()
11
10
*/
12
11
class UpdatePaymentMethodRequest extends AbstractRequest
@@ -28,11 +27,12 @@ public function getData()
28
27
* Send the request with specified data
29
28
*
30
29
* @param mixed $data The data to send
30
+ *
31
31
* @return ResponseInterface
32
32
*/
33
33
public function sendData ($ data )
34
34
{
35
- $ response = $ this ->braintree ->paymentMethod ()->update ($ data ['token ' ], $ data[ ' options ' ] );
35
+ $ response = $ this ->braintree ->paymentMethod ()->update ($ data ['token ' ], $ data );
36
36
37
37
return $ this ->createResponse ($ response );
38
38
}
@@ -47,6 +47,16 @@ public function setPaymentMethodToken($value)
47
47
return $ this ->setParameter ('token ' , $ value );
48
48
}
49
49
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
+
50
60
/**
51
61
* @param array $options
52
62
*
You can’t perform that action at this time.
0 commit comments