Skip to content

Commit af17442

Browse files
committed
Adding capture option
1 parent a661c21 commit af17442

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

src/Gateway.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,9 @@ public function completePurchase(array $parameters = array())
5656
{
5757
return $this->createRequest('\Omnipay\Netaxept\Message\CompletePurchaseRequest', $parameters);
5858
}
59+
60+
public function capture(array $parameters = array())
61+
{
62+
return $this->createRequest('\Omnipay\Netaxept\Message\CaptureRequest', $parameters);
63+
}
5964
}

src/Message/CaptureRequest.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
namespace Omnipay\Netaxept\Message;
4+
5+
/**
6+
* Netaxept Capture Request
7+
*
8+
* @author Antonio Peric-Mazar <antonio@locastic.com>
9+
*/
10+
class CaptureRequest extends PurchaseRequest
11+
{
12+
public function getData()
13+
{
14+
$data = array();
15+
$data['transactionAmount'] = $this->getAmountInteger();
16+
$data['transactionId'] = $this->getTransactionId();
17+
$data['merchantId'] = $this->getMerchantId();
18+
$data['token'] = $this->getPassword();
19+
$data['operation'] = 'CAPTURE';
20+
21+
return $data;
22+
}
23+
24+
public function sendData($data)
25+
{
26+
$url = $this->getEndpoint().'/Netaxept/Process.aspx?';
27+
$httpResponse = $this->httpClient->get($url.http_build_query($data))->send();
28+
29+
return $this->response = new Response($this, $httpResponse->xml());
30+
}
31+
}

0 commit comments

Comments
 (0)