Skip to content

Commit

Permalink
refactor API_PREPARE_ORDER
Browse files Browse the repository at this point in the history
  • Loading branch information
lilhorse committed Oct 27, 2016
1 parent ad8efe2 commit 046e235
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Payment/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ class API extends AbstractAPI
* @var Merchant
*/
protected $merchant;
protected $api_prepare_order;

// api
const API_PAY_ORDER = 'https://api.mch.weixin.qq.com/pay/micropay';
const API_PREPARE_ORDER = 'https://api.mch.weixin.qq.com/pay/unifiedorder';
// const API_PREPARE_ORDER = 'https://api.mch.weixin.qq.com/pay/unifiedorder';
const API_QUERY = 'https://api.mch.weixin.qq.com/pay/orderquery';
const API_CLOSE = 'https://api.mch.weixin.qq.com/pay/closeorder';
const API_REVERSE = 'https://api.mch.weixin.qq.com/secapi/pay/reverse';
Expand Down Expand Up @@ -70,6 +71,7 @@ class API extends AbstractAPI
public function __construct(Merchant $merchant)
{
$this->merchant = $merchant;
$this->api_prepare_order = env('WX_API_PREPARE_ORDER', 'https://api.mch.weixin.qq.com/pay/unifiedorder');
}

/**
Expand All @@ -96,7 +98,7 @@ public function prepare(Order $order)
$order->notify_url = $order->get('notify_url', $this->merchant->notify_url);
$order->spbill_create_ip = ($order->trade_type === Order::NATIVE) ? get_server_ip() : get_client_ip();

return $this->request(self::API_PREPARE_ORDER, $order->all());
return $this->request($this->api_prepare_order, $order->all());
}

/**
Expand Down

0 comments on commit 046e235

Please sign in to comment.