Skip to content

Commit

Permalink
Add sub-merchant support. (#976)
Browse files Browse the repository at this point in the history
  • Loading branch information
mingyoung authored and overtrue committed Oct 23, 2017
1 parent ac8ceff commit 974f908
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Payment/Application.php
Expand Up @@ -115,6 +115,22 @@ public function handleScannedNotify(Closure $closure)
return (new Notify\Scanned($this))->handle($closure);
}

/**
* Set sub-merchant.
*
* @param string $mchId
* @param string|null $appId
*
* @return $this
*/
public function setSubMerchant(string $mchId, string $appId = null)
{
$this['config']->set('sub_mch_id', $mchId);
$this['config']->set('sub_appid', $appId);

return $this;
}

/**
* @return bool
*/
Expand Down
2 changes: 2 additions & 0 deletions src/Payment/Kernel/BaseClient.php
Expand Up @@ -78,6 +78,8 @@ protected function request(string $endpoint, array $params = [], $method = 'post
'appid' => $this->app['config']['app_id'],
'mch_id' => $this->app['config']['mch_id'],
'nonce_str' => uniqid(),
'sub_mch_id' => $this->app['config']['sub_mch_id'],
'sub_appid' => $this->app['config']['sub_appid'],
];

$params = array_filter(array_merge($base, $this->prepends(), $params));
Expand Down

0 comments on commit 974f908

Please sign in to comment.