Esempio n. 1
0
         $message = $ppec->l('Payment accepted.') . '<br />';
         $payment_type = (int) Configuration::get('PS_OS_WS_PAYMENT');
     }
     $transaction = array('id_transaction' => pSQL($ppec->result['PAYMENTINFO_0_TRANSACTIONID']), 'id_invoice' => null, 'currency' => pSQL($ppec->result['PAYMENTINFO_0_CURRENCYCODE']), 'total_paid' => (double) $ppec->result['PAYMENTINFO_0_AMT'], 'shipping' => (double) $ppec->result['PAYMENTREQUEST_0_SHIPPINGAMT'], 'payment_date' => pSQL($ppec->result['PAYMENTINFO_0_ORDERTIME']), 'payment_status' => pSQL($payment_status));
 } else {
     $transaction = array();
     $payment_type = (int) Configuration::get('PS_OS_ERROR');
     if (!isset($amount_match) || $amount_match == true) {
         $message = implode('<br />', $ppec->logs) . '<br />';
     } else {
         $message = $ppec->l('Price payed on paypal is not the same that on PrestaShop.') . '<br />';
     }
 }
 if (_PS_VERSION_ >= '1.5') {
     $ppec->getContext()->cookie->id_cart = $cart->id;
     $ppec->validateOrder((int) $cart->id, $payment_type, (double) $cart->getOrderTotal(true, Cart::BOTH), 'PayPal', $message, $transaction, (int) $cart->id_currency, false, $customer->secure_key, $ppec->getContext()->shop);
 } else {
     $ppec->validateOrder((int) $cart->id, $payment_type, (double) $cart->getOrderTotal(true, Cart::BOTH), 'PayPal', $message, $transaction, (int) $cart->id_currency, false, $customer->secure_key);
 }
 if (!$ppec->currentOrder) {
     $ppec->logs[] = $this->l('Cannot create order');
 } else {
     $id_order = (int) $ppec->currentOrder;
     $order = new Order($id_order);
     $history = new OrderHistory();
     $history->id_order = (int) $id_order;
     $history->changeIdOrderState((int) $payment_type, $id_order);
     $history->addWithemail();
     $history->add();
 }
 unset(Context::getContext()->cookie->{PaypalExpressCheckout::$COOKIE_NAME});