Commit fcf92051 authored by Andy J's avatar Andy J

Update PayPalExpress.class.php

parent 6707079b
Pipeline #66546540 passed with stages
in 32 seconds
......@@ -325,6 +325,7 @@ class PayPalExpress extends PaymentMethod
*/
public function preparePaymentProcess($order)
{
$orderNumber = baueBestellnummer();
$basket = PayPalHelper::getBasket();
$helper = new WarenkorbHelper();
......@@ -343,7 +344,7 @@ class PayPalExpress extends PaymentMethod
$paymentDetails->ShippingDiscount = new BasicAmountType($basket->currency->cISO, $basket->discount[WarenkorbHelper::GROSS] * -1);
$paymentDetails->HandlingTotal = new BasicAmountType($basket->currency->cISO, $basket->surcharge[WarenkorbHelper::GROSS]);
$paymentDetails->InvoiceID = $order->cBestellNr;
$paymentDetails->InvoiceID = $orderNumber;
$paymentDetails->Custom = $order->kBestellung;
$paymentDetails->NotifyURL = $this->oPlugin->cFrontendPfadURLSSL . 'notify.php?type=express';
......@@ -381,6 +382,8 @@ class PayPalExpress extends PaymentMethod
switch ($response->Ack) {
case 'Success': {
$order = finalisiereBestellung($orderNumber, true);
$paymentInfo = $response->DoExpressCheckoutPaymentResponseDetails->PaymentInfo[0];
$this->doLog("Payment status: {$paymentInfo->PaymentStatus} (Order: {$order->kBestellung}, Reason: {$paymentInfo->PendingReason})", LOGLEVEL_NOTICE);
......@@ -395,7 +398,21 @@ class PayPalExpress extends PaymentMethod
]);
$this->setOrderStatusToPaid($order);
$this->sendConfirmationMail($order);
}
$paymentHash = $this->generateHash($order);
$returnUrl = Shop::getURL() . '/bestellabschluss.php?i=' . $paymentHash;
Session::getInstance()->cleanUp();
unset($_SESSION['reshash'], $_SESSION['paypalexpress']);
if (isset($_SESSION['Kunde']) && (int)$_SESSION['Kunde']->nRegistriert === 0) {
unset($_SESSION['Kunde']);
}
header("location: {$returnUrl}");
break;
}
// https://developer.paypal.com/docs/classic/express-checkout/ht_ec_fundingfailure10486/
......@@ -406,16 +423,11 @@ class PayPalExpress extends PaymentMethod
header("Location: {$redirect}");
exit;
}
break;
}
}
Session::getInstance()->cleanUp();
unset($_SESSION['reshash'], $_SESSION['paypalexpress']);
if (isset($_SESSION['Kunde']) && (int)$_SESSION['Kunde']->nRegistriert === 0) {
unset($_SESSION['Kunde']);
default:
header('location: ' . Shop::getURL() . '/bestellvorgang.php?editZahlungsart=1');
exit;
break;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment