Skip to content

Commit a51a6c7

Browse files
Merge pull request #90 from ratepay/M2-110-Wrong-sandbox-mode
M2-110 - Use sandbox mode that is saved in the db for after-order pro…
2 parents d47bf77 + 91abfb8 commit a51a6c7

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

Model/Api/SendConfirmationDeliver.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,17 @@ public function sendRatepayDeliverCall($order, $paymentMethod, $inv = null)
167167
$sProfileId = null;
168168
$sSecurityCode = null;
169169
$blSandbox = null;
170+
if (is_numeric($order->getRatepaySandboxUsed())) {
171+
$blSandbox = (bool)$order->getRatepaySandboxUsed();
172+
}
170173
if ($order->getRatepayProfileId()) {
171174
$sProfileId = $order->getRatepayProfileId();
172175
$sSecurityCode = $this->profileConfigHelper->getSecurityCodeForProfileId($sProfileId, $paymentMethod);
176+
}
177+
if ($blSandbox === null) {
173178
$blSandbox = $this->profileConfigHelper->getSandboxModeForProfileId($sProfileId, $paymentMethod);
174179
}
180+
175181
$inv->setShippingDescription($order->getShippingDescription());
176182

177183
$head = $this->rpLibraryModel->getRequestHead($order, 'CONFIRMATION_DELIVER', null, null, $sProfileId, $sSecurityCode, $this->getTrackingInfo($order));

Model/Handler/Cancel.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,14 @@ public function sendRatepayCancelCall($order, $methodInstance)
7575
$sProfileId = null;
7676
$sSecurityCode = null;
7777
$blSandbox = null;
78+
if (is_numeric($order->getRatepaySandboxUsed())) {
79+
$blSandbox = (bool)$order->getRatepaySandboxUsed();
80+
}
7881
if ($order->getRatepayProfileId()) {
7982
$sProfileId = $order->getRatepayProfileId();
8083
$sSecurityCode = $this->profileConfigHelper->getSecurityCodeForProfileId($sProfileId, $methodInstance->getCode());
84+
}
85+
if ($blSandbox === null) {
8186
$blSandbox = $this->profileConfigHelper->getSandboxModeForProfileId($sProfileId, $methodInstance->getCode());
8287
}
8388

Model/Handler/Refund.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,14 @@ public function callRatepayReturn($order, $creditMemo, $methodInstance)
191191
$sProfileId = null;
192192
$sSecurityCode = null;
193193
$blSandbox = null;
194+
if (is_numeric($order->getRatepaySandboxUsed())) {
195+
$blSandbox = (bool)$order->getRatepaySandboxUsed();
196+
}
194197
if ($order->getRatepayProfileId()) {
195198
$sProfileId = $order->getRatepayProfileId();
196199
$sSecurityCode = $this->profileConfigHelper->getSecurityCodeForProfileId($sProfileId, $methodInstance->getCode());
200+
}
201+
if ($blSandbox === null) {
197202
$blSandbox = $this->profileConfigHelper->getSandboxModeForProfileId($sProfileId, $methodInstance->getCode());
198203
}
199204

@@ -231,9 +236,14 @@ public function callRatepayCredit($order, $creditMemo, $methodInstance)
231236
$sProfileId = null;
232237
$sSecurityCode = null;
233238
$blSandbox = null;
239+
if (is_numeric($order->getRatepaySandboxUsed())) {
240+
$blSandbox = (bool)$order->getRatepaySandboxUsed();
241+
}
234242
if ($order->getRatepayProfileId()) {
235243
$sProfileId = $order->getRatepayProfileId();
236244
$sSecurityCode = $this->profileConfigHelper->getSecurityCodeForProfileId($sProfileId, $methodInstance->getCode());
245+
}
246+
if ($blSandbox === null) {
237247
$blSandbox = $this->profileConfigHelper->getSandboxModeForProfileId($sProfileId, $methodInstance->getCode());
238248
}
239249

0 commit comments

Comments
 (0)