Exemplo n.º 1
0
    $statusReason = $SofortLib_TransactionData->getStatusReason();
    $status = $SofortLib_TransactionData->getStatus();
    $xCustomerId = $SofortLib_TransactionData->getUserVariable(1);
    //insert the serialized order into shop-db if it doesnt exist
    $xOrderId = handleOrderInsertion($transactionId, $paymentSecret, $paymentMethod, $xCustomerId);
    if (!$xOrderId) {
        exit('Error: No orderId found.');
    }
}
$configuration = getPaymentModuleConfiguration();
if ($paymentMethod == 'sr') {
    // Rechnung by Sofort
    $srOrderStatusArr = array('unconfirmed' => getStatusId($configuration['MODULE_PAYMENT_SOFORT_SR_UNCONFIRMED_STATUS_ID']), 'confirmed' => getStatusId($configuration['MODULE_PAYMENT_SOFORT_SR_ORDER_STATUS_ID']), 'cancelled' => getStatusId($configuration['MODULE_PAYMENT_SOFORT_SR_CANCEL_STATUS_ID']), 'check' => getStatusId($configuration['MODULE_PAYMENT_SOFORT_MULTIPAY_CHECK_STATUS_ID']));
    $PnagInvoice = new PnagInvoice(MODULE_PAYMENT_SOFORT_MULTIPAY_APIKEY, $transactionId);
    if ($PnagInvoice->isError()) {
        $errors = $PnagInvoice->getErrors();
        echo MODULE_PAYMENT_SOFORT_ERROR_TERMINATED . ' - ' . print_r($errors, true);
        exit;
    }
    $orderId = getOrderId($transactionId);
    $lastOrderStatus = getLastOrderStatus($orderId);
    $completeInvoiceStatus = $PnagInvoice->getState();
    $newTotal = checkIfNewTotal($PnagInvoice, $orderId);
    $newComments = '';
    // Update the order-status
    switch ($completeInvoiceStatus) {
        case PnagInvoice::PENDING_CONFIRM_INVOICE:
            updateShopAdresses($SofortLib_TransactionData->getInvoiceAddress(), $SofortLib_TransactionData->getShippingAddress(), $orderId);
            $historyComments = getHistoryComments($completeInvoiceStatus, $transactionId);
            $newComments = updateOrderStatus($PnagInvoice, $orderId, $srOrderStatusArr['unconfirmed'], $historyComments['customer'], $time, $newTotal);
            break;