Skip to content

Commit 74a8ed2

Browse files
committed
Upgrade for v3
1 parent b65e111 commit 74a8ed2

File tree

7 files changed

+27
-14
lines changed

7 files changed

+27
-14
lines changed

src/Gateway.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Omnipay\Common\AbstractGateway;
66
use Braintree_Gateway;
77
use Braintree_Configuration;
8-
use Guzzle\Http\ClientInterface;
8+
use Omnipay\Common\Http\ClientInterface;
99
use Symfony\Component\HttpFoundation\Request as HttpRequest;
1010
/**
1111
* Braintree Gateway

src/MerchantBusiness.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace Omnipay\Braintree;
44

5-
use DateTime;
6-
use DateTimeZone;
75
use Omnipay\Common\Helper;
86
use Symfony\Component\HttpFoundation\ParameterBag;
97

src/MerchantFunding.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace Omnipay\Braintree;
44

5-
use DateTime;
6-
use DateTimeZone;
75
use Omnipay\Common\Helper;
86
use Symfony\Component\HttpFoundation\ParameterBag;
97

src/Message/AbstractRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Omnipay\Braintree\Message;
44

55
use Braintree_Gateway;
6-
use Guzzle\Http\ClientInterface;
6+
use Omnipay\Common\Http\ClientInterface;
77
use Omnipay\Common\Exception\InvalidRequestException;
88
use Symfony\Component\HttpFoundation\Request as HttpRequest;
99
use Omnipay\Common\Message\AbstractRequest as BaseAbstractRequest;

src/Message/CreateCustomerRequest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<?php
22
namespace Omnipay\Braintree\Message;
33

4-
use Omnipay\Common\Message\ResponseInterface;
5-
64
/**
75
* Authorize Request
86
*

src/Message/FindCustomerRequest.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
<?php
2+
23
namespace 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
*/
912
class 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
}

src/Message/UpdatePaymentMethodRequest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
/**
88
* Update PaymentMethod Request
9-
*
109
* @method Response send()
1110
*/
1211
class 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
*

0 commit comments

Comments
 (0)