Example #1
0
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     $address = $this->app->getUserState(HIKASHOP_COMPONENT . '.billing_address');
     if (!empty($address)) {
         $firstname = @$order->cart->billing_address->address_firstname;
         $lastname = @$order->cart->billing_address->address_lastname;
         $address1 = '';
         if (!empty($order->cart->billing_address->address_street)) {
             $address1 = substr($order->cart->billing_address->address_street, 0, 200);
         }
         $zip = @$order->cart->billing_address->address_post_code;
         $city = @$order->cart->billing_address->address_city;
         $state = @$order->cart->billing_address->address_state->zone_code_3;
         $country = @$order->cart->billing_address->address_country->zone_code_2;
         $email = $this->user->user_email;
         $phone = @$order->cart->billing_address->address_telephone;
     }
     $notify_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=alipay&tmpl=component&lang=' . $this->locale . $this->url_itemid;
     $return_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=after_end&order_id=' . $order->order_id . $this->url_itemid;
     $out_trade_no = $order->order_id;
     if ($this->payment_params->Mode == "Partner") {
         $order_params = array("seller_email" => $this->payment_params->email, "service" => "create_partner_trade_by_buyer", "partner" => $this->payment_params->partner_id, "return_url" => $return_url, "notify_url" => $notify_url, "_input_charset" => "utf-8", "subject" => 'order number : ' . $out_trade_no, "body" => '', "out_trade_no" => $out_trade_no, "payment_type" => "1", "price" => round($order->order_full_price, (int) $this->currency->currency_locale['int_frac_digits']), "quantity" => "1", "logistics_type" => "EXPRESS", "logistics_fee" => "0.00", "logistics_payment" => "BUYER_PAY", 'receive_name' => $lastname . ' ' . $firstname, 'receive_address' => $address1, 'receive_zip' => $zip, 'receive_phone' => $phone);
     } else {
         $order_params = array("seller_email" => $this->payment_params->email, "service" => "create_direct_pay_by_user", "partner" => $this->payment_params->partner_id, "return_url" => $return_url, "notify_url" => $notify_url, "_input_charset" => "utf-8", "subject" => 'order number : ' . $out_trade_no, "body" => '', "out_trade_no" => $out_trade_no, "payment_type" => "1", "total_fee" => round($order->order_full_price, (int) $this->currency->currency_locale['int_frac_digits']));
     }
     $alipay = new alipay();
     $alipay->set_order_params($order_params);
     $alipay->set_transport($this->payment_params->transport);
     $alipay->set_security_code($this->payment_params->security_code);
     $alipay->set_sign_type($this->payment_params->sign_type);
     $sign = $alipay->_sign($alipay->_order_params);
     $this->payment_params->url = $alipay->create_payment_link();
     return $this->showPage('end');
 }