Skip to content

Commit 5ed62e1

Browse files
author
Konstantinos Christofilos
committed
Add findCustomer method to Gateway
1 parent c67ebdd commit 5ed62e1

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

src/Gateway.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,15 @@ public function clientToken(array $parameters = array())
113113
return $this->createRequest('\Omnipay\Braintree\Message\ClientTokenRequest', $parameters);
114114
}
115115

116+
/**
117+
* @param string $id
118+
* @return Message\FindCustomerRequest
119+
*/
120+
public function findCustomer($id)
121+
{
122+
return $this->createRequest('\Omnipay\Braintree\Message\FindCustomerRequest', ['customerId' => $id]);
123+
}
124+
116125
/**
117126
* @param array $parameters
118127
* @return Message\CreateCustomerRequest

src/Message/FindCustomerRequest.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
namespace Omnipay\Braintree\Message;
3+
4+
/**
5+
* Find Customer Request
6+
*
7+
* @method CustomerResponse send()
8+
*/
9+
class FindCustomerRequest extends AbstractRequest
10+
{
11+
public function getData()
12+
{
13+
return $this->getCustomerData();
14+
}
15+
16+
/**
17+
* Send the request with specified data
18+
*
19+
* @param mixed $data The data to send
20+
* @return CustomerResponse
21+
*/
22+
public function sendData($data)
23+
{
24+
$response = $this->braintree->customer()->find($this->getCustomerId());
25+
26+
return $this->response = new CustomerResponse($this, $response);
27+
}
28+
}

0 commit comments

Comments
 (0)