Example #1
0
 /**
  * Response
  * Create the Order, Invoice and send an email to the customer
  * @param $response from the Gateway Server
  * @return order_id or false
  */
 public function Response($response)
 {
     $bank = self::getModule();
     $bankid = $bank['bank_id'];
     if (!empty($response['item_number'])) {
         // Get the indexes of the order
         $orderid = trim($response['custom']);
         if (is_numeric($orderid) && is_numeric($bankid)) {
             // Replacing the comma with the dot in the amount value.
             $amount = str_replace(",", ".", $response['amount']);
             $payment = Payments::addpayment($orderid, $response['thx_id'], $bankid, 0, $amount);
             Orders::set_status($orderid, Statuses::id("paid", "orders"));
             // Paid
             OrdersItems::set_statuses($orderid, Statuses::id("paid", "orders"));
             // Paid
             return $orderid;
         }
     }
 }