diff --git a/README.md b/README.md index 9655e07..8e63579 100644 --- a/README.md +++ b/README.md @@ -282,7 +282,9 @@ Remember: All keys in "order array" must be in lowercase. $refund = OpenPayU_Refund::create( 'Z963D5JQR2230925GUEST000P01', //as a value use ORDER_ID 'Money refund', //Description - required - '100' //Amount - If not provided, returns whole transaction, optional + '100', //Amount - If not provided, returns whole transaction, optional + 'ext-customer-id', // External submerchant ID, required only for marketplace + 'ext-refund-id' // External refund ID, required only for marketplace ); ``` diff --git a/lib/OpenPayU/v2/Refund.php b/lib/OpenPayU/v2/Refund.php index eecbdea..550763d 100644 --- a/lib/OpenPayU/v2/Refund.php +++ b/lib/OpenPayU/v2/Refund.php @@ -15,11 +15,13 @@ class OpenPayU_Refund extends OpenPayU * Function make refund for order * @param $orderId * @param $description - * @param int $amount Amount of refund in pennies + * @param null|int $amount Amount of refund in pennies + * @param null|string $extCustomerId Marketplace external customer ID + * @param null|string $extRefundId Marketplace external refund ID * @return null|OpenPayU_Result * @throws OpenPayU_Exception */ - public static function create($orderId, $description, $amount = null) + public static function create($orderId, $description, $amount = null, $extCustomerId = null, $extRefundId = null) { if (empty($orderId)) { throw new OpenPayU_Exception('Invalid orderId value for refund'); @@ -34,7 +36,15 @@ public static function create($orderId, $description, $amount = null) ); if (!empty($amount)) { - $refund['refund']['amount'] = (int)$amount; + $refund['refund']['amount'] = (int) $amount; + } + + if (!empty($extCustomerId)) { + $refund['refund']['extCustomerId'] = $extCustomerId; + } + + if (!empty($extRefundId)) { + $refund['refund']['extRefundId'] = $extRefundId; } try {