Skip to content

Commit

Permalink
Merge pull request #13 from Plasma-Platform/feature/106065/api2Refunds
Browse files Browse the repository at this point in the history
add cancel for order
  • Loading branch information
ch-tm authored Feb 14, 2022
2 parents a94c038 + 3645920 commit 0b2fcf3
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/API2Client/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,4 +362,32 @@ public function cancelPaymentSubscription ($id)
return $subscription
->create ($response->getResult ());
}
}

/**
* @param $order_id
* @param $black_list
* @param $refund
* @param $comment
* @return string
* @throws ApiException
*/
public function cancelOrder($order_id, $black_list = 0, $refund = 1, $comment = '')
{
$response = $this->client->call(
'orders.cancel',
array(
'order_id' => $order_id,
'black_list' => $black_list,
'refund' => $refund,
'comment' => $comment
),
HttpClient::REQUEST_RAW
);

if (!$response->isSuccess ()) {
throw new ApiException ($response->getErrorMessage ());
}

return $order_id;
}
}

0 comments on commit 0b2fcf3

Please sign in to comment.