Skip to content

Commit 66d7b4a

Browse files
Support for tokenized credit card (Accept.js)
1 parent f871149 commit 66d7b4a

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/Message/AIMAbstractRequest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,30 @@ public function setInvoiceNumber($value)
160160
return $this->setParameter('invoiceNumber', $value);
161161
}
162162

163+
public function getOpaqueDataDescriptor()
164+
{
165+
return $this->getParameter('opaqueDataDescriptor')
166+
? $this->getParameter('opaqueDataDescriptor')
167+
: $this->httpRequest->request->get('opaqueDataDescriptor');
168+
}
169+
170+
public function getOpaqueDataValue()
171+
{
172+
return $this->getParameter('opaqueDataValue')
173+
? $this->getParameter('opaqueDataValue')
174+
: $this->httpRequest->request->get('opaqueDataValue');
175+
}
176+
177+
public function setOpaqueDataDescriptor($value)
178+
{
179+
return $this->setParameter('opaqueDataDescriptor', $value);
180+
}
181+
182+
public function setOpaqueDataValue($value)
183+
{
184+
return $this->setParameter('opaqueDataValue', $value);
185+
}
186+
163187
public function sendData($data)
164188
{
165189
$headers = array('Content-Type' => 'text/xml; charset=utf-8');

src/Message/AIMAuthorizeRequest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ public function getData()
2626

2727
protected function addPayment(\SimpleXMLElement $data)
2828
{
29+
if ($this->getOpaqueDataDescriptor() && $this->getOpaqueDataValue()) {
30+
$data->transactionRequest->payment->opaqueData->dataDescriptor = $this->getOpaqueDataDescriptor();
31+
$data->transactionRequest->payment->opaqueData->dataValue = $this->getOpaqueDataValue();
32+
return;
33+
}
34+
2935
$this->validate('card');
3036
/** @var CreditCard $card */
3137
$card = $this->getCard();

0 commit comments

Comments
 (0)