/**
  * only SR: Fill table sofort_orders_notification, e.g. in case of status-changes
  * @see updateTimeline()
  * @param int $sofortOrdersId - key from table sofort_orders
  * @param object $invoice with complete transactiondata
  * @param string $customerComment (optional)
  * @param string $sellerComment (optional)
  * @return last insert_id
  */
 function insertSofortOrdersNotification($sofortOrdersId, PnagInvoice $PnagInvoice, $customerComment = '', $sellerComment = '')
 {
     if (!$sofortOrdersId || !is_object($PnagInvoice->getTransactionData()) || $PnagInvoice->getTransactionData()->getPaymentMethod() != 'sr') {
         return false;
     }
     $sqlDataArray = array('sofort_orders_id' => $sofortOrdersId, 'items' => serialize($PnagInvoice->getItems()), 'amount' => $PnagInvoice->getAmount(), 'customer_comment' => $customerComment, 'seller_comment' => $sellerComment, 'status_id' => $PnagInvoice->getState(), 'status' => $PnagInvoice->getStatus(), 'status_reason' => $PnagInvoice->getStatusReason(), 'invoice_status' => $PnagInvoice->getStatusOfInvoice(), 'invoice_objection' => $PnagInvoice->getInvoiceObjection());
     xtc_db_query(HelperFunctions::getEscapedInsertInto('sofort_orders_notification', $sqlDataArray));
     return xtc_db_insert_id();
     // fetch and return the last insert id
 }
예제 #2
0
        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;
        case PnagInvoice::PENDING_NOT_CREDITED_YET_PENDING:
            //refunded invoice was just reanimated
            if (refundedInvoiceWasJustReanimated($orderId, $PnagInvoice->getStatus())) {
                $newComments = updateOrderStatus($PnagInvoice, $orderId, $srOrderStatusArr['confirmed'], MODULE_PAYMENT_SOFORT_SR_TRANSLATE_INVOICE_REANIMATED, $time, false, true);
            } else {
                $historyComments = getHistoryComments($completeInvoiceStatus);