Esempio n. 1
1
 /**
  * Retrieves the OrderPayment object, created at validateOrder. And add transaction id.
  * @param string $mollie_payment_id
  * @return bool
  */
 public function save_order_transaction_id($mollie_payment_id)
 {
     // retrieve ALL payments of order.
     // in the case of a cancel or expired on banktransfer, this will fire too.
     // if no OrderPayment objects is retrieved in the collection, do nothing.
     $order = new Order($this->module->currentOrder);
     $collection = OrderPayment::getByOrderReference($order->reference);
     if (count($collection) > 0) {
         $order_payment = $collection[0];
         // for older versions (1.5) , we check if it hasn't been filled yet.
         if (!$order_payment->transaction_id) {
             $order_payment->transaction_id = $mollie_payment_id;
             $order_payment->update();
         }
     }
 }
Esempio n. 2
0
 /**
  * Get a collection of order payments
  *
  * @since 1.5.0.13
  */
 public function getOrderPayments()
 {
     return OrderPayment::getByOrderReference($this->reference);
 }
Esempio n. 3
0
 /**
  * Get the detailed payment of an order
  *
  * @deprecated 1.5.3.0
  * @param int $id_order
  * @return array
  */
 public static function getByOrderId($id_order)
 {
     Tools::displayAsDeprecated();
     $order = new Order($id_order);
     return OrderPayment::getByOrderReference($order->reference);
 }
Esempio n. 4
0
 public function hookactionBeforeAddOrder($params)
 {
     if (!$this->active) {
         return false;
     }
     if ($this->ref_orderid or $this->ref_cartid or $this->ref_prefsign) {
         $order_payment = new OrderPayment();
         $transaction_id = $order_payment->getByOrderReference($params['order']->reference);
         if ($ref = $this->generateReferenceFromID($params['order']->id, $params['cart']->id, $params['order']->reference)) {
             $params['order']->reference = $ref;
         }
         if (count($transaction_id)) {
             foreach ($transaction_id as $transaction) {
                 $transaction->order_reference = $params['order']->reference;
                 $transaction->update();
             }
         }
         return $ref;
     } else {
         return false;
     }
 }