diff --git a/README.md b/README.md index a340a1b..b0e6402 100644 --- a/README.md +++ b/README.md @@ -971,14 +971,17 @@ var_dump(($getAllInvoice)); #### Expire Invoice ```php -\Xendit\Invoice::expireInvoice(string $id); +\Xendit\Invoice::expireInvoice(string $id, array $params); ``` Usage example: ```php $id = 'invoice-id'; -$expireInvoice = \Xendit\Invoice::expireInvoice($id); +$params = [ + 'for-user-id' => 'test-reference-user-id' // OPTIONAL +]; +$expireInvoice = \Xendit\Invoice::expireInvoice($id, $params); var_dump($expireInvoice); ``` ### Paylater diff --git a/composer.json b/composer.json index c9db467..1766e36 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "xendit/xendit-php", "description": "PHP clients for Xendit API", - "version": "2.17.0", + "version": "2.17.1", "license": "MIT", "keywords": [ "xendit" diff --git a/composer.lock b/composer.lock index fa9c6d7..e468212 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "21061bcd4b0b17ec33a4b8510cd4d61f", + "content-hash": "db4dee4843892a1b642f18d96dc5e7af", "packages": [ { "name": "guzzlehttp/guzzle", @@ -917,33 +917,33 @@ }, { "name": "phpspec/prophecy", - "version": "1.13.0", + "version": "v1.15.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea" + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/be1996ed8adc35c3fd795488a653f4b518be70ea", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.1", + "php": "^7.2 || ~8.0, <8.2", "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0", "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^6.0", + "phpspec/phpspec": "^6.0 || ^7.0", "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -978,9 +978,9 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.13.0" + "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" }, - "time": "2021-03-17T13:42:18+00:00" + "time": "2021-12-08T12:19:24+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1281,16 +1281,16 @@ }, { "name": "phpunit/phpunit", - "version": "8.5.19", + "version": "8.5.21", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "496281b64ec781856ed0a583483b5923b4033722" + "reference": "50a58a60b85947b0bee4c8ecfe0f4bbdcf20e984" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/496281b64ec781856ed0a583483b5923b4033722", - "reference": "496281b64ec781856ed0a583483b5923b4033722", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/50a58a60b85947b0bee4c8ecfe0f4bbdcf20e984", + "reference": "50a58a60b85947b0bee4c8ecfe0f4bbdcf20e984", "shasum": "" }, "require": { @@ -1362,7 +1362,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.19" + "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.21" }, "funding": [ { @@ -1374,7 +1374,7 @@ "type": "github" } ], - "time": "2021-07-31T15:15:06+00:00" + "time": "2021-09-25T07:37:20+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", diff --git a/examples/InvoiceExample.php b/examples/InvoiceExample.php index 940d496..253a89b 100644 --- a/examples/InvoiceExample.php +++ b/examples/InvoiceExample.php @@ -31,7 +31,10 @@ $getInvoice = \Xendit\Invoice::retrieve($id); var_dump($getInvoice); -$expireInvoice = \Xendit\Invoice::expireInvoice($id); +$params = [ + 'for-user-id' => '' +]; +$expireInvoice = \Xendit\Invoice::expireInvoice($id, $params); var_dump($expireInvoice); $retrieveAll = [ diff --git a/src/Invoice.php b/src/Invoice.php index 967ae89..2a9c3ea 100644 --- a/src/Invoice.php +++ b/src/Invoice.php @@ -74,10 +74,10 @@ public static function createReqParams() * ] * @throws Exceptions\ApiException */ - public static function expireInvoice($id) + public static function expireInvoice($id, $params=[]) { $url = '/invoices/' . $id . '/expire!'; - return static::_request('POST', $url); + return static::_request('POST', $url, $params); } }