Exemple #1
0
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     $return_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=after_end&order_id=' . $order->order_id . $this->url_itemid;
     $notif_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=' . $this->name . '&notif_id=' . $method_id . '&order_id=' . $order->order_id . '&lang=' . $this->locale . $this->url_itemid;
     require_once dirname(__FILE__) . '/lib/payplug.php';
     try {
         Payplug::setConfigFromFile(HIKASHOP_MEDIA . "payplug_parameters.json");
         $paymentUrl = PaymentUrl::generateUrl(array('amount' => (int) (round($order->cart->full_total->prices[0]->price_value_with_tax, 2) * 100), 'currency' => 'EUR', 'ipnUrl' => $notif_url, 'email' => $this->user->user_email, 'firstName' => @$order->cart->billing_address->address_firstname, 'lastName' => @$order->cart->billing_address->address_lastname, 'order' => $order->order_id, 'returnUrl' => $return_url));
     } catch (Exception $e) {
         $this->app->enqueueMessage($e->getMessage());
         return;
     }
     header("Location: {$paymentUrl}");
     exit;
 }
 function testLiveCancelAction()
 {
     $url = new PaymentUrl(Config::ENV_LIVE, 'cancel');
     $this->assertEqual('https://payment.hypercharge.net/payment/cancel', $url->get());
 }