Skip to content

Commit 3aef083

Browse files
authored
Update CheckoutController.php (#4)
1 parent 847838a commit 3aef083

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

Src/Controllers/Frontend/CheckoutController.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ public function getOrderData()
7777

7878
$buyerPhone = $customer->cTel ?? $customer->cMobil;
7979

80-
return [
80+
$data = [
8181
'currency' => 'EUR',
8282
'payment_method' => $this->getPaymentMethod(),
83-
'net_term' => $this->getNetTerm(),
83+
'source' => 'widget',
8484
'external_reference_id' => uniqid('M_JTL_'),
8585
'buyer' => [
8686
'email' => $customer->cMail,
@@ -114,6 +114,12 @@ public function getOrderData()
114114
]
115115
]
116116
];
117+
118+
$netTerm = $this->getNetTerm();
119+
if ($netTerm != null)
120+
$data['net_term'] = $netTerm;
121+
122+
return $data;
117123
}
118124

119125
public function getLineItems()
@@ -164,16 +170,16 @@ public function getNetTerm()
164170
{
165171
try {
166172
$paymentMethodModul = $_SESSION['Zahlungsart']->cModulId;
167-
$paymentMethod = $this->configService->getNetTermByKPlugin($paymentMethodModul);
173+
$netTerm = $this->configService->getNetTermByKPlugin($paymentMethodModul);
168174

169-
if (isset($paymentMethod)) {
170-
return $paymentMethod;
175+
if (isset($netTerm)) {
176+
return (int) $netTerm;
171177
}
172178

173-
return '';
179+
return null;
174180
} catch (Exception $e)
175181
{
176-
return '';
182+
return null;
177183
}
178184
}
179185

0 commit comments

Comments
 (0)