Skip to content

Commit f79a14f

Browse files
committed
Merge pull request thephpleague#162 from adrianmacneil/custom-send-data
Custom send data parameters
2 parents 48922c1 + f1205c1 commit f79a14f

File tree

47 files changed

+111
-91
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+111
-91
lines changed

src/Omnipay/AuthorizeNet/Message/AbstractRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ protected function getBillingData()
115115
return $data;
116116
}
117117

118-
public function send()
118+
public function sendData($data)
119119
{
120-
$httpResponse = $this->httpClient->post($this->getEndpoint(), null, $this->getData())->send();
120+
$httpResponse = $this->httpClient->post($this->getEndpoint(), null, $data)->send();
121121

122122
return $this->response = new AIMResponse($this, $httpResponse->getBody());
123123
}

src/Omnipay/AuthorizeNet/Message/SIMAuthorizeRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ public function getHash($data)
4949
return hash_hmac('md5', $fingerprint, $this->getTransactionKey());
5050
}
5151

52-
public function send()
52+
public function sendData($data)
5353
{
54-
return $this->response = new SIMAuthorizeResponse($this, $this->getData(), $this->getEndpoint());
54+
return $this->response = new SIMAuthorizeResponse($this, $data, $this->getEndpoint());
5555
}
5656
}

src/Omnipay/AuthorizeNet/Message/SIMCompleteAuthorizeRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ public function getHash()
2323
return md5($this->getHashSecret().$this->getApiLoginId().$this->getTransactionId().$this->getAmount());
2424
}
2525

26-
public function send()
26+
public function sendData($data)
2727
{
28-
return $this->response = new SIMCompleteAuthorizeResponse($this, $this->getData());
28+
return $this->response = new SIMCompleteAuthorizeResponse($this, $data);
2929
}
3030
}

src/Omnipay/Buckaroo/Message/CompletePurchaseRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public function generateResponseSignature()
3535
);
3636
}
3737

38-
public function send()
38+
public function sendData($data)
3939
{
40-
return $this->response = new CompletePurchaseResponse($this, $this->getData());
40+
return $this->response = new CompletePurchaseResponse($this, $data);
4141
}
4242
}

src/Omnipay/Buckaroo/Message/PurchaseRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ public function generateSignature($data)
6363
);
6464
}
6565

66-
public function send()
66+
public function sendData($data)
6767
{
68-
return $this->response = new PurchaseResponse($this, $this->getData());
68+
return $this->response = new PurchaseResponse($this, $data);
6969
}
7070

7171
public function getEndpoint()

src/Omnipay/CardSave/Message/PurchaseRequest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,8 @@ public function getData()
7777
return $data;
7878
}
7979

80-
public function send()
80+
public function sendData($data)
8181
{
82-
$data = $this->getData();
83-
8482
// the PHP SOAP library sucks, and SimpleXML can't append element trees
8583
// TODO: find PSR-0 SOAP library
8684
$document = new DOMDocument('1.0', 'utf-8');

src/Omnipay/Common/Message/AbstractRequest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,13 @@ public function setNotifyUrl($value)
321321
return $this->setParameter('notifyUrl', $value);
322322
}
323323

324+
public function send()
325+
{
326+
$data = $this->getData();
327+
328+
return $this->sendData($data);
329+
}
330+
324331
public function getResponse()
325332
{
326333
if (null === $this->response) {

src/Omnipay/Common/Message/RequestInterface.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,12 @@ public function getResponse();
3232
* @return ResponseInterface
3333
*/
3434
public function send();
35+
36+
/**
37+
* Send the request with specified data
38+
*
39+
* @param mixed $data The data to send
40+
* @return ResponseInterface
41+
*/
42+
public function sendData($data);
3543
}

src/Omnipay/Dummy/Message/AuthorizeRequest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ public function getData()
1818
return array('amount' => $this->getAmount());
1919
}
2020

21-
public function send()
21+
public function sendData($data)
2222
{
23-
$data = $this->getData();
2423
$data['reference'] = uniqid();
2524
$data['success'] = 0 === substr($this->getCard()->getNumber(), -1, 1) % 2;
2625
$data['message'] = $data['success'] ? 'Success' : 'Failure';

src/Omnipay/Eway/Message/RapidPurchaseRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ public function getData()
5757
return $data;
5858
}
5959

60-
public function send()
60+
public function sendData($data)
6161
{
62-
$httpResponse = $this->httpClient->post($this->getEndpoint(), null, json_encode($this->getData()))
62+
$httpResponse = $this->httpClient->post($this->getEndpoint(), null, json_encode($data))
6363
->setAuth($this->getApiKey(), $this->getPassword())
6464
->send();
6565

src/Omnipay/FirstData/Message/CompletePurchaseRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ public function getData()
2323
return $this->httpRequest->request->all();
2424
}
2525

26-
public function send()
26+
public function sendData($data)
2727
{
28-
return $this->response = new CompletePurchaseResponse($this, $this->getData());
28+
return $this->response = new CompletePurchaseResponse($this, $data);
2929
}
3030

3131
/**

src/Omnipay/FirstData/Message/PurchaseRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ public function createHash($dateTime, $amount)
7777
return sha1($ascii);
7878
}
7979

80-
public function send()
80+
public function sendData($data)
8181
{
82-
return $this->response = new PurchaseResponse($this, $this->getData());
82+
return $this->response = new PurchaseResponse($this, $data);
8383
}
8484

8585
public function getEndpoint()

src/Omnipay/GoCardless/Message/CompletePurchaseRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ public function getData()
2626
return $data;
2727
}
2828

29-
public function send()
29+
public function sendData($data)
3030
{
3131
$httpRequest = $this->httpClient->post(
3232
$this->getEndpoint().'/api/v1/confirm',
3333
array('Accept' => 'application/json'),
34-
Gateway::generateQueryString($this->getData())
34+
Gateway::generateQueryString($data)
3535
);
3636
$httpResponse = $httpRequest->setAuth($this->getAppId(), $this->getAppSecret())->send();
3737

src/Omnipay/GoCardless/Message/PurchaseRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ public function getData()
3939
return $data;
4040
}
4141

42-
public function send()
42+
public function sendData($data)
4343
{
44-
return $this->response = new PurchaseResponse($this, $this->getData());
44+
return $this->response = new PurchaseResponse($this, $data);
4545
}
4646

4747
/**

src/Omnipay/Manual/Message/Request.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ public function getData()
1616
return $this->getParameters();
1717
}
1818

19-
public function send()
19+
public function sendData($data)
2020
{
21-
return $this->response = new Response($this, $this->getData());
21+
return $this->response = new Response($this, $data);
2222
}
2323
}

src/Omnipay/Migs/Message/ThreePartyCompletePurchaseRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ public function getData()
2121
return $data;
2222
}
2323

24-
public function send()
24+
public function sendData($data)
2525
{
26-
return $this->response = new Response($this, $this->getData());
26+
return $this->response = new Response($this, $data);
2727
}
2828

2929
public function getEndpoint()

src/Omnipay/Migs/Message/ThreePartyPurchaseRequest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ public function getData()
1919
return $data;
2020
}
2121

22-
public function send()
22+
public function sendData($data)
2323
{
24-
$redirectUrl = $this->getEndpoint().'?'.http_build_query($this->getData());
24+
$redirectUrl = $this->getEndpoint().'?'.http_build_query($data);
2525

26-
return $this->response = new ThreePartyPurchaseResponse($this, $this->getData(), $redirectUrl);
26+
return $this->response = new ThreePartyPurchaseResponse($this, $data, $redirectUrl);
2727
}
2828

2929
public function getEndpoint()

src/Omnipay/Migs/Message/TwoPartyPurchaseRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ public function getData()
2424
return $data;
2525
}
2626

27-
public function send()
27+
public function sendData($data)
2828
{
29-
$httpResponse = $this->httpClient->post($this->getEndpoint(), null, $this->getData())->send();
29+
$httpResponse = $this->httpClient->post($this->getEndpoint(), null, $data)->send();
3030

3131
return $this->response = new Response($this, $httpResponse->getBody());
3232
}

src/Omnipay/Mollie/Message/AbstractRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ protected function getBaseData()
4040
return $data;
4141
}
4242

43-
public function send()
43+
public function sendData($data)
4444
{
45-
$httpResponse = $this->httpClient->post($this->endpoint, null, $this->getData())->send();
45+
$httpResponse = $this->httpClient->post($this->endpoint, null, $data)->send();
4646

4747
return $this->response = new Response($this, $httpResponse->xml());
4848
}

src/Omnipay/MultiSafepay/Message/CompletePurchaseRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ public function getData()
3030
/**
3131
* {@inheritdoc}
3232
*/
33-
public function send()
33+
public function sendData($data)
3434
{
3535
$httpResponse = $this->httpClient->post(
3636
$this->getEndpoint(),
3737
$this->getHeaders(),
38-
$this->getData()->asXML()
38+
$data->asXML()
3939
)->send();
4040

4141
return $this->response = new CompletePurchaseResponse($this, $httpResponse->xml());

src/Omnipay/MultiSafepay/Message/FetchIssuersRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ public function getData()
2525
/**
2626
* {@inheritdoc}
2727
*/
28-
public function send()
28+
public function sendData($data)
2929
{
3030
$httpResponse = $this->httpClient->post(
3131
$this->getEndpoint(),
3232
$this->getHeaders(),
33-
$this->getData()->asXML()
33+
$data->asXML()
3434
)->send();
3535

3636
return $this->response = new FetchIssuersResponse($this, $httpResponse->xml());

src/Omnipay/MultiSafepay/Message/FetchPaymentMethodsRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ public function getData()
3838
/**
3939
* {@inheritdoc}
4040
*/
41-
public function send()
41+
public function sendData($data)
4242
{
4343
$httpResponse = $this->httpClient->post(
4444
$this->getEndpoint(),
4545
$this->getHeaders(),
46-
$this->getData()->asXML()
46+
$data->asXML()
4747
)->send();
4848

4949
return $this->response = new FetchPaymentMethodsResponse($this, $httpResponse->xml());

src/Omnipay/MultiSafepay/Message/PurchaseRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,12 @@ public function getData()
151151
/**
152152
* {@inheritdoc}
153153
*/
154-
public function send()
154+
public function sendData($data)
155155
{
156156
$httpResponse = $this->httpClient->post(
157157
$this->getEndpoint(),
158158
$this->getHeaders(),
159-
$this->getData()->asXML()
159+
$data->asXML()
160160
)->send();
161161

162162
return $this->response = new PurchaseResponse($this, $httpResponse->xml());

src/Omnipay/NetBanx/Message/AbstractRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ public function setCustomerId($value)
112112
*
113113
* @return \Omnipay\Common\Message\ResponseInterface|void
114114
*/
115-
public function send()
115+
public function sendData($data)
116116
{
117-
$httpResponse = $this->httpClient->post($this->getEndpoint(), null, $this->getData())->send();
117+
$httpResponse = $this->httpClient->post($this->getEndpoint(), null, $data)->send();
118118

119119
return $this->response = new Response($this, $httpResponse->getBody());
120120
}

src/Omnipay/Netaxept/Message/CompletePurchaseRequest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,14 @@ public function getData()
2525
return $data;
2626
}
2727

28-
public function send()
28+
public function sendData($data)
2929
{
30-
$data = $this->getData();
31-
3230
if ('OK' !== $data['responseCode']) {
3331
return $this->response = new ErrorResponse($this, $data);
3432
}
3533

3634
$url = $this->getEndpoint().'/Netaxept/Process.aspx?';
37-
$httpResponse = $this->httpClient->get($url.http_build_query($this->getData()))->send();
35+
$httpResponse = $this->httpClient->get($url.http_build_query($data))->send();
3836

3937
return $this->response = new Response($this, $httpResponse->xml());
4038
}

src/Omnipay/Netaxept/Message/PurchaseRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ public function getData()
6060
return $data;
6161
}
6262

63-
public function send()
63+
public function sendData($data)
6464
{
6565
$url = $this->getEndpoint().'/Netaxept/Register.aspx?';
66-
$httpResponse = $this->httpClient->get($url.http_build_query($this->getData()))->send();
66+
$httpResponse = $this->httpClient->get($url.http_build_query($data))->send();
6767

6868
return $this->response = new Response($this, $httpResponse->xml());
6969
}

src/Omnipay/PayFast/Message/CompletePurchaseRequest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ public function getData()
3535
throw new InvalidRequestException('Missing PDT or ITN variables');
3636
}
3737

38-
public function send()
38+
public function sendData($data)
3939
{
40-
$data = $this->getData();
4140
if (isset($data['pt'])) {
4241
// validate PDT
4342
$url = $this->getEndpoint().'/query/fetch';

src/Omnipay/PayFast/Message/PurchaseRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ protected function generateSignature($data)
8484
return md5(http_build_query($fields));
8585
}
8686

87-
public function send()
87+
public function sendData($data)
8888
{
89-
return $this->response = new PurchaseResponse($this, $this->getData(), $this->getEndpoint().'/process');
89+
return $this->response = new PurchaseResponse($this, $data, $this->getEndpoint().'/process');
9090
}
9191

9292
public function getEndpoint()

src/Omnipay/PayPal/Message/AbstractRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ protected function getBaseData($method)
115115
return $data;
116116
}
117117

118-
public function send()
118+
public function sendData($data)
119119
{
120-
$url = $this->getEndpoint().'?'.http_build_query($this->getData());
120+
$url = $this->getEndpoint().'?'.http_build_query($data);
121121
$httpResponse = $this->httpClient->get($url)->send();
122122

123123
return $this->createResponse($httpResponse->getBody());

src/Omnipay/Payflow/Message/AuthorizeRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ public function getData()
8989
return $data;
9090
}
9191

92-
public function send()
92+
public function sendData($data)
9393
{
94-
$httpResponse = $this->httpClient->post($this->getEndpoint(), null, $this->getData())->send();
94+
$httpResponse = $this->httpClient->post($this->getEndpoint(), null, $data)->send();
9595

9696
return $this->response = new Response($this, $httpResponse->getBody());
9797
}

src/Omnipay/PaymentExpress/Message/PxPayAuthorizeRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ public function getData()
5050
return $data;
5151
}
5252

53-
public function send()
53+
public function sendData($data)
5454
{
55-
$httpResponse = $this->httpClient->post($this->endpoint, null, $this->getData()->asXML())->send();
55+
$httpResponse = $this->httpClient->post($this->endpoint, null, $data->asXML())->send();
5656

5757
return $this->createResponse($httpResponse->xml());
5858
}

0 commit comments

Comments
 (0)