示例#1
0
 /**
  * Tries to get an authorization or captures the money immediately for the given order if capturing the money
  * separately isn't supported or not configured by the shop owner.
  *
  * @param MShop_Order_Item_Interface $order Order invoice object
  * @param array $params Request parameter if available
  * @return MShop_Common_Item_Helper_Form_Default Form object with URL, action and parameters to redirect to
  * 	(e.g. to an external server of the payment provider or to a local success page)
  */
 public function process(MShop_Order_Item_Interface $order, array $params = array())
 {
     $order->setPaymentStatus(MShop_Order_Item_Abstract::PAY_AUTHORIZED);
     $this->_saveOrder($order);
     return parent::process($order, $params);
 }
示例#2
0
 /**
  * Maps the PayPal status to the appropriate payment status and sets it in the order object.
  *
  * @param MShop_Order_Item_Interface $invoice Order invoice object
  * @param array $response Associative list of key/value pairs containing the PayPal response
  */
 protected function _setPaymentStatus(MShop_Order_Item_Interface $invoice, array $response)
 {
     if (!isset($response['PAYMENTSTATUS'])) {
         return;
     }
     switch ($response['PAYMENTSTATUS']) {
         case 'Pending':
             if (isset($response['PENDINGREASON'])) {
                 if ($response['PENDINGREASON'] === 'authorization') {
                     $invoice->setPaymentStatus(MShop_Order_Item_Abstract::PAY_AUTHORIZED);
                     break;
                 }
                 $str = 'PayPal Express: order ID = ' . $invoice->getId() . ', PENDINGREASON = ' . $response['PENDINGREASON'];
                 $this->_getContext()->getLogger()->log($str, MW_Logger_Abstract::INFO);
             }
             $invoice->setPaymentStatus(MShop_Order_Item_Abstract::PAY_PENDING);
             break;
         case 'In-Progress':
             $invoice->setPaymentStatus(MShop_Order_Item_Abstract::PAY_PENDING);
             break;
         case 'Completed':
         case 'Processed':
             $invoice->setPaymentStatus(MShop_Order_Item_Abstract::PAY_RECEIVED);
             break;
         case 'Failed':
         case 'Denied':
         case 'Expired':
             $invoice->setPaymentStatus(MShop_Order_Item_Abstract::PAY_REFUSED);
             break;
         case 'Refunded':
         case 'Partially-Refunded':
         case 'Reversed':
             $invoice->setPaymentStatus(MShop_Order_Item_Abstract::PAY_REFUND);
             break;
         case 'Canceled-Reversal':
         case 'Voided':
             $invoice->setPaymentStatus(MShop_Order_Item_Abstract::PAY_CANCELED);
             break;
         default:
             $str = 'PayPal Express: order ID = ' . $invoice->getId() . ', response = ' . print_r($response, true);
             $this->_getContext()->getLogger()->log($str, MW_Logger_Abstract::INFO);
     }
 }
示例#3
0
 /**
  * Tries to get an authorization or captures the money immediately for the given order if capturing the money
  * separately isn't supported or not configured by the shop owner.
  *
  * @param MShop_Order_Item_Interface $order Order invoice object
  * @return MShop_Common_Item_Helper_Form_Default Form object with URL, action and parameters to redirect to
  * 	(e.g. to an external server of the payment provider or to a local success page)
  */
 public function process(MShop_Order_Item_Interface $order)
 {
     $order->setPaymentStatus(MShop_Order_Item_Abstract::PAY_PENDING);
     return parent::process($order);
 }