当前位置: 首页>>代码示例>>PHP>>正文


PHP Order::addOrderPayment方法代码示例

本文整理汇总了PHP中Order::addOrderPayment方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::addOrderPayment方法的具体用法?PHP Order::addOrderPayment怎么用?PHP Order::addOrderPayment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Order的用法示例。


在下文中一共展示了Order::addOrderPayment方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validateOrderPay

    public function validateOrderPay($id_cart, $id_order_state, $amount_paid, $extraCosts, $payment_method = 'Unknown', $message = null, $extra_vars = array(), $currency_special = null, $dont_touch_amount = false, $secure_key = false, Shop $shop = null)
    {
        $statusPending = Configuration::get('PAYNL_WAIT');
        $statusPaid = Configuration::get('PAYNL_SUCCESS');
        // Als er nog geen order van dit cartid is, de order valideren.
        $orderId = Order::getOrderByCartId($id_cart);
        if ($orderId == false) {
            if ($id_order_state == $statusPaid) {
                if ($extraCosts != 0) {
                    $id_order_state_tmp = $statusPending;
                } else {
                    $id_order_state_tmp = $statusPaid;
                }
            } else {
                $id_order_state_tmp = $id_order_state;
            }
            $result = parent::validateOrder($id_cart, $id_order_state_tmp, $amount_paid, $payment_method, $message, $extra_vars, $currency_special, $dont_touch_amount, $secure_key, $shop);
            $orderId = $this->currentOrder;
            if ($extraCosts == 0 && $id_order_state_tmp == $statusPaid) {
                //Als er geen extra kosten zijn, en de order staat op betaald zijn we klaar
                return $result;
            }
        }
        if ($orderId && $id_order_state == $statusPaid) {
            $order = new Order($orderId);
            $shippingCost = $order->total_shipping;
            $newShippingCosts = $shippingCost + $extraCosts;
            $extraCostsExcl = round($extraCosts / (1 + 21 / 100), 2);
            if ($extraCosts != 0) {
                //als de order extra kosten heeft, moeten deze worden toegevoegd.
                $order->total_shipping = $newShippingCosts;
                $order->total_shipping_tax_excl = $order->total_shipping_tax_excl + $extraCostsExcl;
                $order->total_shipping_tax_incl = $newShippingCosts;
                $order->total_paid_tax_excl = $order->total_paid_tax_excl + $extraCostsExcl;
                $order->total_paid_tax_incl = $order->total_paid_real = $order->total_paid = $order->total_paid + $extraCosts;
            }
            $result = $order->addOrderPayment($amount_paid, $payment_method, $extra_vars['transaction_id']);
            if (number_format($order->total_paid_tax_incl, 2) !== number_format($amount_paid, 2)) {
                $id_order_state = Configuration::get('PS_OS_ERROR');
            }
            //paymentid ophalen
            $orderPayment = OrderPayment::getByOrderId($order->id);
            $history = new OrderHistory();
            $history->id_order = (int) $order->id;
            $history->changeIdOrderState((int) $id_order_state, $order, $orderPayment);
            $res = Db::getInstance()->getRow('
			SELECT `invoice_number`, `invoice_date`, `delivery_number`, `delivery_date`
			FROM `' . _DB_PREFIX_ . 'orders`
			WHERE `id_order` = ' . (int) $order->id);
            $order->invoice_date = $res['invoice_date'];
            $order->invoice_number = $res['invoice_number'];
            $order->delivery_date = $res['delivery_date'];
            $order->delivery_number = $res['delivery_number'];
            $order->update();
            $history->addWithemail();
        }
        return $result;
    }
开发者ID:paynl,项目名称:prestashop-plugin,代码行数:58,代码来源:paynl_paymentmethods.php

示例2: setOrderAs

 /**
  * Set order as paid or canceled
  *
  * @param integer $state
  * @param integer $order_id
  * @param float $order_total
  * @param string $barcode
  *
  * @return void
  */
 private static function setOrderAs($state, $order_id, $order_total = null, $barcode = null)
 {
     $return = false;
     try {
         $order = new Order((int) $order_id);
         if (!is_null($order_total) && !is_null($barcode)) {
             $order->addOrderPayment($order_total, 'CashWay', $barcode);
             $order->setInvoice(true);
         }
         $history = new OrderHistory();
         $history->id_order = (int) $order->id;
         $history->changeIdOrderState((int) $state, $order);
         $history->addWithEmail(true);
         $return = true;
     } catch (Exception $e) {
         \CashWay\Log::error($e->getMessage());
     }
     return $return;
 }
开发者ID:vAugagneur,项目名称:plugins,代码行数:29,代码来源:cashway.php

示例3: checkForPayments

 /**
  * If we have local orders pending for payment from CashWay,
  * ask CW API for recent transactions statuses, compare and act upon it.
  *
  * This method is expected to be called by a cron task at least every hour.
  * See cron_cashway_check_for_transactions.php
  *
  * @return boolean
  */
 public static function checkForPayments()
 {
     if (!self::isConfiguredService()) {
         return;
     }
     \CashWay\Log::info('== Starting CashWay background check for orders updates ==');
     $open_orders = self::getLocalPendingOrders();
     if (count($open_orders) == 0) {
         \CashWay\Log::info('No order payment pending by CashWay.');
         return true;
     }
     $cw_orders = self::getRemoteOrderStatus();
     if (false === $cw_orders) {
         return false;
     }
     $cw_refs = array_keys($cw_orders);
     $open_refs = array_keys($open_orders);
     $common_refs = array_intersect($open_refs, $cw_refs);
     $missing_refs = array_diff($open_refs, $cw_refs);
     if (count($missing_refs) > 0) {
         \CashWay\Log::warn(sprintf('Some orders should be in CashWay DB but are not: %s.', implode(', ', $missing_refs)));
     }
     foreach ($common_refs as $ref) {
         switch ($cw_orders[$ref]['status']) {
             case 'paid':
                 \CashWay\Log::info(sprintf('I, found order %s was paid. Updating local record.', $ref));
                 if ($cw_orders[$ref]['paid_amount'] != $open_orders[$ref]['total_paid']) {
                     \CashWay\Log::warn(sprintf('W, Found order %s but paid amount does not match: is %.2f but should be %.2f.', $ref, $cw_orders[$ref]['paid_amount'], $open_orders[$ref]['total_paid']));
                 }
                 if ($open_orders[$ref]['total_paid_real'] >= $cw_orders[$ref]['order_total']) {
                     \CashWay\Log::warn('Well, it looks like it has already been updated: skipping this step.');
                 } else {
                     $order = new Order($open_orders[$ref]['id_order']);
                     $order->addOrderPayment($cw_orders[$ref]['paid_amount'], 'CashWay', $cw_orders[$ref]['barcode']);
                     $order->setInvoice(true);
                     $history = new OrderHistory();
                     $history->id_order = $order->id;
                     $history->changeIdOrderState((int) Configuration::get('PS_OS_WS_PAYMENT'), $order, !$order->hasInvoice());
                 }
                 break;
             case 'expired':
                 \CashWay\Log::info(sprintf('I, found order %s expired. Updating local record.', $ref));
                 $order = new Order($open_orders[$ref]['id_order']);
                 $history = new OrderHistory();
                 $history->id_order = $order->id;
                 $history->changeIdOrderState((int) Configuration::get('PS_OS_CANCELED'), $order, !$order->hasInvoice());
                 break;
             default:
             case 'confirmed':
             case 'open':
                 \CashWay\Log::info(sprintf('I, found order %s, still pending.', $ref));
                 break;
         }
     }
     return true;
 }
开发者ID:vAugagneur,项目名称:cashway-prestashop,代码行数:65,代码来源:cashway.php

示例4: processPayment

 public function processPayment()
 {
     if (!$this->active) {
         return;
     }
     $order_id = $_POST['ORDERID'];
     global $smarty, $cart, $cookie;
     $responseMsg = '';
     if (isset($_POST['RESPCODE']) && $_POST['RESPCODE'] == "01") {
         $secret_key = Configuration::get('Paytm_SECRET_KEY');
         $bool = "FALSE";
         $paramList = $_POST;
         $checksum_recv = $_POST['CHECKSUMHASH'];
         $bool = verifychecksum_e($paramList, $secret_key, $checksum_recv);
         $extra_vars['transaction_id'] = $_POST['TXNID'];
         if ($bool == "TRUE") {
             $customer = new Customer((int) $cart->id_customer);
             parent::validateOrder((int) $order_id, Configuration::get('Paytm_ID_ORDER_SUCCESS'), $_POST['TXNAMOUNT'], $this->displayName, null, $extra_vars, null, true, $cart->secure_key, null);
             $result = Db::getInstance()->getRow('SELECT * FROM `' . _DB_PREFIX_ . 'orders` WHERE id_cart=' . $order_id);
             $order = new Order($result['id_order']);
             $order->addOrderPayment($_POST['TXNAMOUNT'], null, $_POST['TXNID']);
         } else {
             parent::validateOrder((int) $order_id, Configuration::get('Paytm_ID_ORDER_FAILED'), $_POST['TXNAMOUNT'], $this->displayName, NULL, $extra_vars, '', false, $cart->secure_key);
             $result = Db::getInstance()->getRow('SELECT * FROM `' . _DB_PREFIX_ . 'orders` WHERE id_cart=' . $order_id);
             $order = new Order($result['id_order']);
             $order->addOrderPayment($_POST['TXNAMOUNT'], null, $_POST['TXNID']);
         }
     } else {
         parent::validateOrder((int) $order_id, Configuration::get('Paytm_ID_ORDER_FAILED'), $_POST['TXNAMOUNT'], $this->displayName, NULL, $extra_vars, '', false, $cart->secure_key);
         $result = Db::getInstance()->getRow('SELECT * FROM `' . _DB_PREFIX_ . 'orders` WHERE id_cart=' . $order_id);
         $order = new Order($result['id_order']);
         $order->addOrderPayment($_POST['TXNAMOUNT'], null, $_POST['TXNID']);
     }
     $result = Db::getInstance()->getRow('SELECT * FROM `' . _DB_PREFIX_ . 'orders` WHERE id_cart=' . $order_id);
     Tools::redirectLink(__PS_BASE_URI__ . 'order-detail.php?id_order=' . $result['id_order']);
 }
开发者ID:Paytm-Payments,项目名称:Paytm_Prestashop_Kit,代码行数:36,代码来源:paytm.php

示例5: refundAmount

 public function refundAmount(Order $order, $amount)
 {
     $mid = $order->id_cart;
     $decimal = AplazameSerializers::formatDecimals($amount);
     $response = $this->callToRest('POST', '/orders/' . $mid . '/refund', array('amount' => $decimal));
     if ($response['is_error']) {
         $this->log(self::LOG_CRITICAL, 'Cannot refund. Detail ' . $response['payload']['error']['message'], $mid);
         return false;
     }
     return $order->addOrderPayment(-$amount, $this->displayName);
 }
开发者ID:aplazame,项目名称:prestashop,代码行数:11,代码来源:aplazame.php


注:本文中的Order::addOrderPayment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。