Skip to content

Commit 70e6c9c

Browse files
XOL-2533 Adding extraOptions payload to request XML
extraOptions to set duplicate request window to 0 (in seconds), i.e. to disable the feature.
1 parent 16140f8 commit 70e6c9c

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/Message/CIMAuthorizeRequest.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,18 @@ class CIMAuthorizeRequest extends CIMAbstractRequest
1414
public function getData()
1515
{
1616
$this->validate('cardReference', 'amount');
17-
1817
$data = $this->getBaseData();
19-
2018
$this->addTransactionData($data);
19+
$this->addExtraOptions($data);
20+
return $data;
21+
}
22+
23+
private function addExtraOptions(\SimpleXMLElement $data)
24+
{
25+
$extraOptions = $data->addChild('extraOptions');
26+
$node = dom_import_simplexml($extraOptions);
27+
$nodeOwner = $node->ownerDocument;
28+
$node->appendChild($nodeOwner->createCDATASection("x_duplicate_window=0"));
2129
return $data;
2230
}
2331

@@ -45,7 +53,6 @@ protected function addTransactionData(\SimpleXMLElement $data)
4553
if (!empty($desc)) {
4654
$action->order->description = $desc;
4755
}
48-
4956
return $data;
5057
}
5158

tests/Message/CIMAuthorizeRequestTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,10 @@ public function testGetData()
3131
$this->assertEquals('27057151', $data->transaction->profileTransAuthOnly->customerShippingAddressId);
3232
$this->assertEquals('Test authorize transaction', $data->transaction->profileTransAuthOnly->order->description);
3333
}
34+
35+
public function testShouldReturnExtraOptionsToDisableDuplicateWindowPeriod()
36+
{
37+
$data = $this->request->getData();
38+
$this->assertEquals('x_duplicate_window=0', strip_tags($data->extraOptions));
39+
}
3440
}

0 commit comments

Comments
 (0)