Skip to content

Commit

Permalink
Merge pull request #17 from wan2land/master
Browse files Browse the repository at this point in the history
부분 취소 로직 추가
  • Loading branch information
wan2land authored Jan 17, 2017
2 parents 0881e52 + b38f142 commit 042a55f
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ public function __construct(Configuration $config, CacheInterface $cache = null,

/**
* @param string $uri
* @param array $queries
* @return array
*/
public function httpGet($uri)
public function httpGet($uri, array $queries = [])
{
if (count($queries)) {
$uri .= '?' . http_build_query($queries);
}
return $this->requestWithAuth('GET', $uri);
}

Expand Down
44 changes: 44 additions & 0 deletions src/IamportApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,30 @@ public function cancel(array $data)
* @return array
*/
public function cancelByImpUid($impUid, $reason = '', $refundBank = null, $refundAccount = null, $refundHolder = null)
{
$this->cancelPartialByImpUid(
$impUid,
null,
$reason,
$refundBank,
$refundAccount,
$refundHolder
);
}

/**
* @param string $impUid
* @param int $amount
* @param string $reason
* @param string $refundBank
* @param string $refundAccount
* @param string $refundHolder
* @return array
*/
public function cancelPartialByImpUid($impUid, $amount = null, $reason = '', $refundBank = null, $refundAccount = null, $refundHolder = null)
{
return $this->client->httpPost('/payments/cancel', [
'amount' => $amount,
'imp_uid' => $impUid,
'reason' => $reason,
'refund_bank' => $refundBank,
Expand All @@ -111,9 +133,31 @@ public function cancelByImpUid($impUid, $reason = '', $refundBank = null, $refun
* @return array
*/
public function cancelByMerchantUid($merchantUid, $reason = '', $refundBank = null, $refundAccount = null, $refundHolder = null)
{
$this->cancelPartialByMerchantUid(
$merchantUid,
null,
$reason,
$refundBank,
$refundAccount,
$refundHolder
);
}

/**
* @param string $merchantUid
* @param int $amount
* @param string $reason
* @param string $refundBank
* @param string $refundAccount
* @param string $refundHolder
* @return array
*/
public function cancelPartialByMerchantUid($merchantUid, $amount = null, $reason = '', $refundBank = null, $refundAccount = null, $refundHolder = null)
{
return $this->client->httpPost('/payments/cancel', [
'merchant_uid' => $merchantUid,
'amount' => $amount,
'reason' => $reason,
'refund_bank' => $refundBank,
'refund_account' => $refundAccount,
Expand Down

0 comments on commit 042a55f

Please sign in to comment.