コード例 #1
0
ファイル: Order.php プロジェクト: zhangjiachao/magento2
 /**
  * @return PaymentCollection
  */
 public function getPaymentsCollection()
 {
     if (is_null($this->_payments)) {
         $this->_payments = $this->_paymentCollectionFactory->create()->setOrderFilter($this);
         if ($this->getId()) {
             foreach ($this->_payments as $payment) {
                 $payment->setOrder($this);
             }
         }
     }
     return $this->_payments;
 }
コード例 #2
0
ファイル: Order.php プロジェクト: niranjanssiet/magento2
 /**
  * @return PaymentCollection
  */
 public function getPaymentsCollection()
 {
     $collection = $this->_paymentCollectionFactory->create()->setOrderFilter($this);
     if ($this->getId()) {
         foreach ($collection as $payment) {
             $payment->setOrder($this);
         }
     }
     return $collection;
 }
コード例 #3
0
ファイル: Cron.php プロジェクト: Adyen/adyen-magento2
 /**
  * @param $orderAmount
  * @return bool
  */
 protected function _isTotalAmount($paymentId, $orderCurrencyCode)
 {
     $this->_adyenLogger->addAdyenNotificationCronjob('Validate if AUTHORISATION notification has the total amount of the order');
     // get total amount of the order
     $grandTotal = (int) $this->_adyenHelper->formatAmount($this->_order->getGrandTotal(), $orderCurrencyCode);
     // check if total amount of the order is authorised
     $res = $this->_adyenOrderPaymentCollectionFactory->create()->getTotalAmount($paymentId);
     if ($res && isset($res[0]) && is_array($res[0])) {
         $amount = $res[0]['total_amount'];
         $orderAmount = $this->_adyenHelper->formatAmount($amount, $orderCurrencyCode);
         $this->_adyenLogger->addAdyenNotificationCronjob(sprintf('The grandtotal amount is %s and the total order amount that is authorised is: %s', $grandTotal, $orderAmount));
         if ($grandTotal == $orderAmount) {
             $this->_adyenLogger->addAdyenNotificationCronjob('AUTHORISATION has the full amount');
             return true;
         } else {
             $this->_adyenLogger->addAdyenNotificationCronjob('This is a partial AUTHORISATION, the amount is ' . $this->_value);
             return false;
         }
     }
     return false;
 }