JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3RbrPKZ 5zxendit-php/composer.jsonnu[{ "name": "xendit/xendit-php", "description": "PHP clients for Xendit API", "version": "2.19.0", "license": "MIT", "keywords": [ "xendit" ], "homepage": "https://github.com/xendit/xendit-php", "type": "library", "minimum-stability": "stable", "require": { "php": ">=7.2.0", "guzzlehttp/guzzle": ">=6.0", "ext-json": "*" }, "autoload": { "psr-4": { "Xendit\\": "src/" } }, "autoload-dev": { "psr-4": { "Xendit\\": [ "tests/", "tests/Xendit/" ] } }, "require-dev": { "phpunit/phpunit": "^8.5.13", "squizlabs/php_codesniffer": "~3.5", "vlucas/phpdotenv": "^4.1" } } PKZeLeL(xendit-php/tests/Xendit/EWalletsTest.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; use Xendit\EWallets; use Xendit\TestCase; /** * Class EWalletsTest * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class EWalletsTest extends TestCase { const TEST_ID = "123"; const TEST_TYPE = "DANA"; const TEST_CHARGE_ID = "ewc_f3925450-5c54-4777-98c1-fcf22b0d1e1c"; const TEST_REFUND_ID = "ewr_532as23lew2321id"; /** * Create EWallet test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsCreatable() { $params = [ 'external_id' => 'demo_' . time(), 'amount' => 32000, 'phone' => '081298498259', 'expiration_date' => '2020-02-20T00:00:00.000Z', 'callback_url' => 'https://my-shop.com/callbacks', 'redirect_url' => 'https://my-shop.com/home', 'ewallet_type' => 'DANA', ]; $this->stubRequest( 'POST', '/ewallets', $params, [], $params ); $result = EWallets::create($params); $this->assertEquals($result['external_id'], $params['external_id']); $this->assertEquals($result['phone'], $params['phone']); $this->assertEquals( $result['ewallet_type'], $params['ewallet_type'] ); $this->assertEquals($result['amount'], $params['amount']); $this->assertEquals( $result['callback_url'], $params['callback_url'] ); $this->assertEquals( $result['redirect_url'], $params['redirect_url'] ); $this->assertEquals( $result['expiration_date'], $params['expiration_date'] ); } /** * Create EWallet test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsCreatableWithApiVersion() { $params = [ 'external_id' => 'demo_' . time(), 'amount' => 32000, 'phone' => '081298498259', 'expiration_date' => '2020-02-20T00:00:00.000Z', 'callback_url' => 'https://my-shop.com/callbacks', 'redirect_url' => 'https://my-shop.com/home', 'ewallet_type' => 'OVO', 'x-api-version' => '2019-02-04', ]; $this->stubRequest( 'POST', '/ewallets', $params, [], $params ); $result = EWallets::create($params); $this->assertEquals($result['external_id'], $params['external_id']); $this->assertEquals($result['phone'], $params['phone']); $this->assertEquals( $result['ewallet_type'], $params['ewallet_type'] ); $this->assertEquals($result['amount'], $params['amount']); $this->assertEquals( $result['callback_url'], $params['callback_url'] ); $this->assertEquals( $result['redirect_url'], $params['redirect_url'] ); $this->assertEquals( $result['expiration_date'], $params['expiration_date'] ); } /** * Get EWallets Payment test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsGettable() { $params = [ 'external_id' => self::TEST_ID, 'amount' => 32000, 'phone' => '081298498259', 'expiration_date' => '2020-02-20T00:00:00.000Z', 'callback_url' => 'https://my-shop.com/callbacks', 'redirect_url' => 'https://my-shop.com/home', 'ewallet_type' => 'DANA' ]; $this->stubRequest( 'get', '/ewallets?external_id='.self::TEST_ID. '&ewallet_type='.self::TEST_TYPE, [], [], $params ); $result = EWallets::getPaymentStatus( self::TEST_ID, self::TEST_TYPE ); $this->assertEquals( $result['ewallet_type'], self::TEST_TYPE ); } /** * Create EWallets test * Should throw InvalidArgumentException * * @return void * @throws Exceptions\ApiException */ public function testIsCreatableThrowInvalidArgumentException() { $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); $params = [ 'external_id' => 'demo_147580196270' ]; EWallets::create($params); } /** * Get EWallets Payment test * Should throw ApiException * * @return void * @throws Exceptions\ApiException */ public function testIsGettableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); EWallets::getPaymentStatus( self::TEST_ID, self::TEST_TYPE ); } /** * Create EWallet Charge test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsEWalletChargeCreatable() { $params = [ 'reference_id' => 'test-reference-id', 'currency' => 'IDR', 'amount' => 50000, 'checkout_method' => 'ONE_TIME_PAYMENT', 'channel_code' => 'ID_SHOPEEPAY', 'channel_properties' => [ 'success_redirect_url' => 'https://yourwebsite.com/order/123', ], 'metadata' => [ 'meta' => 'data' ] ]; $this->stubRequest( 'POST', '/ewallets/charges', $params, [], $params ); $result = EWallets::createEWalletCharge($params); $this->assertEquals($result['reference_id'], $params['reference_id']); $this->assertEquals($result['currency'], $params['currency']); $this->assertEquals($result['amount'], $params['amount']); $this->assertEquals( $result['checkout_method'], $params['checkout_method'] ); $this->assertEquals( $result['channel_code'], $params['channel_code'] ); $this->assertEquals( $result['channel_properties'], $params['channel_properties'] ); $this->assertEquals( $result['metadata'], $params['metadata'] ); } /** * Create EWallet Charge test with headers * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsEWalletChargeCreatableWithHeaders() { $params = [ 'reference_id' => 'test-reference-id', 'currency' => 'IDR', 'amount' => 50000, 'checkout_method' => 'ONE_TIME_PAYMENT', 'channel_code' => 'ID_SHOPEEPAY', 'channel_properties' => [ 'success_redirect_url' => 'https://yourwebsite.com/order/123', ], 'metadata' => [ 'meta' => 'data' ], 'for-user-id' => 'user-id', 'with-fee-rule' => 'fee-rule' ]; $this->stubRequest( 'POST', '/ewallets/charges', $params, [], $params ); $result = EWallets::createEWalletCharge($params); $this->assertEquals($result['reference_id'], $params['reference_id']); $this->assertEquals($result['currency'], $params['currency']); $this->assertEquals($result['amount'], $params['amount']); $this->assertEquals( $result['checkout_method'], $params['checkout_method'] ); $this->assertEquals( $result['channel_code'], $params['channel_code'] ); $this->assertEquals( $result['channel_properties'], $params['channel_properties'] ); $this->assertEquals( $result['metadata'], $params['metadata'] ); } /** * Create EWallets Charge test * Should throw InvalidArgumentException * * @return void * @throws Exceptions\ApiException */ public function testIsEWalletChargeCreatableThrowInvalidArgumentException() { $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); $params = [ 'reference_id' => 'test-ref-id' ]; EWallets::createEWalletCharge($params); } /** * Get EWallets Charge Status test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsEWalletChargeGettable() { $params = [ 'id' => self::TEST_CHARGE_ID, 'business_id' => 'business_id_example', 'reference_id' => self::TEST_ID, 'status' => 'PENDING', 'currency' => 'IDR', 'charge_amount' => 50000, 'capture_amount' => 50000, 'checkout_method' => 'ONE_TIME_PAYMENT', 'channel_code' => 'ID_SHOPEEPAY', 'channel_properties' => [ 'success_redirect_url' => 'https://yourwebsite.com/order/123' ], 'actions' => [ 'desktop_web_checkout_url' => null, 'mobile_web_checkout_url' => null, 'mobile_deeplink_checkout_url' => 'https://mobile.deeplink.checkout.url', 'qr_checkout_string' => 'test-qr-string' ], 'is_redirect_required' => true, 'callback_url' => 'https://yourwebsite.com/order/123', 'created' => '2021-02-09T06:22:35.064408Z', 'updated' => '2021-02-09T06:22:35.064408Z', 'voided_at' => null, 'capture_now' => true, 'customer_id' => null, 'payment_method_id' => null, 'failure_code' => null, 'basket' => null, 'metadata' => null ]; $this->stubRequest( 'get', '/ewallets/charges/'.self::TEST_CHARGE_ID, [], [], $params ); $result = EWallets::getEWalletChargeStatus( self::TEST_CHARGE_ID ); $this->assertEquals( $result['id'], self::TEST_CHARGE_ID ); } /** * Get EWallets Charge Status test * Should throw ApiException * * @return void * @throws Exceptions\ApiException */ public function testIsEWalletChargeGettableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); EWallets::getEWalletChargeStatus( self::TEST_CHARGE_ID ); } /** * Void eWallet Charge test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testVoidEwalletChargeCreateable() { $response = [ "id" => "ewc_532as23lew2321id", "business_id" => "5easfnn23aadlmnaa42", "reference_id" => "test_reference_id", "status" => "SUCCEEDED", "currency" => "IDR", "charge_amount" => 123456, "capture_amount" => 123456, "refunded_amount" => null, "checkout_method" => "ONE_TIME_PAYMENT", "channel_code" => "ID_OVO", "channel_properties" => [ "mobile_number" => "+6287777771111" ], "actions" => null, "is_redirect_required" => false, "callback_url" => "https=>//webhook.me/gethooked", "created" => "2020-04-20T16:23:52Z", "updated" => "2020-04-20T16:23:52Z", "void_status" => "PENDING", "voided_at" => null, "capture_now" => true, "customer_id" => null, "payment_method_id" => null, "failure_code" => null, "basket" => null, "metadata" => [ "branch_code" => "senayan_372" ] ]; $this->stubRequest( 'POST', '/ewallets/charges/'.self::TEST_CHARGE_ID.'/void', [], [], $response ); $result = EWallets::voidEwalletCharge( self::TEST_CHARGE_ID ); $this->assertEquals( $result['id'], 'ewc_532as23lew2321id' ); $this->assertEquals( $result['currency'], 'IDR' ); $this->assertEquals( $result['status'], 'SUCCEEDED' ); $this->assertEquals( $result['charge_amount'], '123456' ); $this->assertEquals( $result['capture_amount'], '123456' ); $this->assertEquals( $result['refunded_amount'], null ); $this->assertEquals( $result['checkout_method'], 'ONE_TIME_PAYMENT' ); $this->assertEquals( $result['channel_code'], 'ID_OVO' ); } /** * Void EWallets Charge test * Should throw ApiException * * @return void * @throws Exceptions\ApiException */ public function testVoidEwalletChargeCreateableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); EWallets::voidEwalletCharge( self::TEST_CHARGE_ID ); } /** * Refund eWallet Charge test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testRefundEwalletChargeCreateable() { $response = [ "id" => "ewr_532as23lew2321id", "charge_id" => self::TEST_CHARGE_ID, "status" => "PENDING", "currency" => "IDR", "channel_code" => "ID_OVO", "capture_amount" => 123456, "refund_amount" => 123456, "reason" => "REQUESTED_BY_CUSTOMER", "failure_code" => null, "created" => "2020-04-20T16:23:52Z", "updated" => "2020-04-20T16:23:52Z" ]; $this->stubRequest( 'POST', '/ewallets/charges/'.self::TEST_CHARGE_ID.'/refunds', [], [], $response ); $result = EWallets::refundEwalletCharge( self::TEST_CHARGE_ID ); $this->assertEquals( $result['id'], "ewr_532as23lew2321id" ); $this->assertEquals( $result['currency'], 'IDR' ); $this->assertEquals( $result['status'], 'PENDING' ); $this->assertEquals( $result['capture_amount'], '123456' ); $this->assertEquals( $result['refund_amount'], 123456 ); $this->assertEquals( $result['reason'], 'REQUESTED_BY_CUSTOMER' ); $this->assertEquals( $result['channel_code'], 'ID_OVO' ); } /** * Refund EWallets Charge test * Should throw ApiException * * @return void * @throws Exceptions\ApiException */ public function testRefundEwalletChargeCreateableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); EWallets::refundEwalletCharge( self::TEST_CHARGE_ID ); } /** * Get Refund Ewallet test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testGetRefundGettable() { $response = [ "id" => "ewr_532as23lew2321id", "charge_id" => self::TEST_CHARGE_ID, "status" => "SUCCEEDED", "currency" => "IDR", "channel_code" => "ID_OVO", "capture_amount" => 123456, "refund_amount" => 100000, "reason" => "REQUESTED_BY_CUSTOMER", "failure_code" => null, "created" => "2020-04-20T16:23:52Z", "updated" => "2020-04-20T16:23:52Z" ]; $this->stubRequest( 'GET', '/ewallets/charges/'.self::TEST_CHARGE_ID.'/refunds/'.self::TEST_REFUND_ID, [], [], $response ); $result = EWallets::getRefund( self::TEST_CHARGE_ID, self::TEST_REFUND_ID ); $this->assertEquals( $result['status'], "SUCCEEDED" ); $this->assertEquals( $result['id'], "ewr_532as23lew2321id" ); $this->assertEquals( $result['currency'], 'IDR' ); $this->assertEquals( $result['status'], 'SUCCEEDED' ); $this->assertEquals( $result['capture_amount'], '123456' ); $this->assertEquals( $result['refund_amount'], 100000 ); $this->assertEquals( $result['reason'], 'REQUESTED_BY_CUSTOMER' ); $this->assertEquals( $result['channel_code'], 'ID_OVO' ); } /** * Get Refund EWallets Charge test * Should throw ApiException * * @return void * @throws Exceptions\ApiException */ public function testGetRefundGettableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); EWallets::getRefund( self::TEST_CHARGE_ID, self::TEST_REFUND_ID ); } /** * Get list of ewallet refund test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testListRefundIsGettable() { $expectedResponse = [ 'has_more' => false ]; $this->stubRequest( 'GET', '/ewallets/charges/'.self::TEST_CHARGE_ID.'/refunds/', [], [], $expectedResponse ); $result = EWallets::listRefund(self::TEST_CHARGE_ID); $this->assertEquals($result['has_more'], $expectedResponse['has_more']); } /** * Get Refund list test * Should throw ApiException * * @return void */ public function testListRefundIsGettableThrowsException() { $this->expectException(\Xendit\Exceptions\ApiException::class); EWallets::listRefund(self::TEST_CHARGE_ID); } } PKZ\\'xendit-php/tests/Xendit/InvoiceTest.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; use Xendit\Invoice; use Xendit\TestCase; /** * Class InvoiceTest * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class InvoiceTest extends TestCase { const TEST_RESOURCE_ID = "123"; /** * Create Invoice test * Should pass * * @return void */ public function testIsCreatable() { $params = [ 'external_id' => 'demo_147580196270', 'payer_email' => 'sample_email@xendit.co', 'description' => 'Trip to Bali', 'amount' => 32000 ]; $this->stubRequest( 'POST', '/v2/invoices', $params, [], $params ); $resource = Invoice::create($params); $this->assertEquals($resource['external_id'], $params['external_id']); $this->assertEquals($resource['payer_email'], $params['payer_email']); $this->assertEquals($resource['description'], $params['description']); $this->assertEquals($resource['amount'], $params['amount']); } /** * Get Invoice test * Should pass * * @return void */ public function testIsGettable() { $this->stubRequest( 'get', '/v2/invoices/'.self::TEST_RESOURCE_ID, [], [], [ 'id' => self::TEST_RESOURCE_ID ] ); $resource = Invoice::retrieve(self::TEST_RESOURCE_ID); $this->assertEquals($resource['id'], self::TEST_RESOURCE_ID); } /** * GetAll Invoice test * Should pass * * @return void */ public function testIsListable() { $this->stubRequest( 'GET', '/v2/invoices', [], [], [ 'id' => self::TEST_RESOURCE_ID ] ); $resources = Invoice::retrieveAll(); $this->assertTrue(is_array($resources)); $this->assertTrue(array_key_exists('id', $resources)); } /** * Expire Invoice test * Should pass * * @return void * @throws \Xendit\Exceptions\ApiException */ public function testIsExpirable() { $this->stubRequest( 'POST', '/invoices/' . self::TEST_RESOURCE_ID . '/expire!', [], [], [ 'id' => self::TEST_RESOURCE_ID, 'status' => 'EXPIRED' ] ); $resources = Invoice::expireInvoice(self::TEST_RESOURCE_ID); $this->assertEquals($resources['status'], 'EXPIRED'); $this->assertEquals($resources['id'], self::TEST_RESOURCE_ID); } /** * Create Invoice test * Should throw InvalidArgumentException * * @return void */ public function testIsCreatableThrowInvalidArgumentException() { $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); $params = [ 'external_id' => 'demo_147580196270', 'payer_email' => 'sample_email@xendit.co', 'description' => 'Trip to Bali', ]; Invoice::create($params); } /** * Get Invoice test * Should throw ApiException * * @return void */ public function testIsGettableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); Invoice::retrieve(self::TEST_RESOURCE_ID); } /** * Expire Invoice test * Should throw ApiException * * @return void * @throws \Xendit\Exceptions\ApiException */ public function testIsExpirableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); Invoice::expireInvoice(self::TEST_RESOURCE_ID); } } PKZey )xendit-php/tests/Xendit/PromotionTest.phpnu[ * @license https::/opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; use Xendit\Promotion; /** * Class PromotionTest * * @category Class * @package Xendit * @author Christian Atilano * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class PromotionTest extends TestCase { /** * Create Promotion test * Should pass * * @return void */ public function testIsCreatable() { $params = [ 'reference_id' => 'reference_123', 'description' => 'test promotion', 'currency' => 'IDR', 'start_time' => '2021-03-02T00:00:00.000Z', 'end_time' => '2021-04-02T00:00:00.000Z', 'promo_code' => 'testpromocode', 'discount_amount' => 5000 ]; $expectedResult = [ 'id' => '123', 'business_id' => 'business_123', 'reference_id' => 'reference_123', 'start_time' => '2021-03-02T00:00:00.000Z', 'end_time' => '2021-04-02T00:00:00.000Z', 'description' => 'test promotion', 'type' => 'PROMO_CODE', 'promo_code' => 'testpromocode', 'discount_amount' => 5000, 'currency' => 'IDR', 'created' => '2021-01-01T00:00:00.000Z', 'status' => 'ACTIVE' ]; $this -> stubRequest( 'POST', '/promotions', $params, [], $expectedResult ); $result = Promotion::create($params); $this->assertEquals($result['id'], '123'); $this->assertEquals($result['business_id'], 'business_123'); $this->assertEquals($result['reference_id'], $params['reference_id']); $this->assertEquals($result['start_time'], $params['start_time']); $this->assertEquals($result['end_time'], $params['end_time']); $this->assertEquals($result['description'], $params['description']); $this->assertEquals($result['type'], 'PROMO_CODE'); $this->assertEquals($result['promo_code'], $params['promo_code']); $this->assertEquals($result['discount_amount'], $params['discount_amount']); $this->assertEquals($result['currency'], $params['currency']); $this->assertEquals($result['created'], '2021-01-01T00:00:00.000Z'); $this->assertEquals($result['status'], 'ACTIVE'); } /** * Create Promotion * Should throw InvalidArgumentException when promo_code and bin_list does not exists * * @return void */ public function testIsCreatableThrowInvalidArgumentExceptionIfPromoCodeOrBinListDoesNotExists() { $this->expectException(Exceptions\InvalidArgumentException::class); $params = []; Promotion::create($params); } /** * Create Promotion * Should throw InvalidArgumentExcpetion when discount_amount or discount_percent does not exists * * @return void */ public function testIsCreatableThrowInvalidArgumentExceptionIfDiscAmountOrDiscPercentDoesNotExists() { $this->expectException(Exceptions\InvalidArgumentException::class); $params = [ 'promo_code' => 'testpromocode', ]; Promotion::create($params); } } PKZeA.xendit-php/tests/Xendit/CardlessCreditTest.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\CardlessCredit; use Xendit\TestCase; /** * Class CardlessCreditTest * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class CardlessCreditTest extends TestCase { const TEST_ID = "TEST-123"; /** * Create Payment test * Should pass * * @return void */ public function testIsCreatable() { $params = [ 'cardless_credit_type'=> 'KREDIVO', 'external_id'=> 'test-cardless-credit-01', 'amount'=> 800000, 'payment_type'=> '3_months', 'items'=> [ [ 'id'=> '123123', 'name'=> 'Phone Case', 'price'=> 200000, 'type'=> 'Smartphone', 'url'=> 'http=>//example.com/phone/phone_case', 'quantity'=> 2 ], [ 'id'=> '234567', 'name'=> 'Bluetooth Headset', 'price'=> 400000, 'type'=> 'Audio', 'url'=> 'http=>//example.com/phone/bluetooth_headset', 'quantity'=> 1 ] ], 'customer_details'=> [ 'first_name'=> 'customer first name', 'last_name'=> 'customer last name', 'email'=> 'customer@yourwebsite.com', 'phone'=> '081513114262' ], 'shipping_address'=> [ 'first_name'=> 'first name', 'last_name'=> 'last name', 'address'=> 'Jalan Teknologi No. 12', 'city'=> 'Jakarta', 'postal_code'=> '12345', 'phone'=> '081513114262', 'country_code'=> 'IDN' ], 'redirect_url'=> 'https://example.com', 'callback_url'=> 'http://example.com/callback-cardless-credit' ]; $this->stubRequest( 'POST', '/cardless-credit', $params, [], $params ); $result = CardlessCredit::create($params); $this->assertEquals($result['external_id'], $params['external_id']); $this->assertEquals( $result['cardless_credit_type'], $params['cardless_credit_type'] ); $this->assertEquals($result['amount'], $params['amount']); $this->assertEquals($result['payment_type'], $params['payment_type']); $this->assertEquals($result['items'], $params['items']); $this->assertEquals( $result['customer_details'], $params['customer_details'] ); $this->assertEquals( $result['shipping_address'], $params['shipping_address'] ); $this->assertEquals($result['redirect_url'], $params['redirect_url']); $this->assertEquals($result['callback_url'], $params['callback_url']); } /** * Create payment test * Should throw InvalidArgumentException * * @return void */ public function testIsCreatableThrowInvalidArgumentException() { $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); $params = [ 'external_id' => 'demo_147580196270' ]; CardlessCredit::create($params); } /** * Calculate payment types * Should pass * * @return void */ public function testIsGettable() { $params = [ 'cardless_credit_type' => 'KREDIVO', 'amount' => 2000000, 'items' => [ [ 'id' => '123123', 'name' => 'Phone Case', 'price' => 1000000, 'type' => 'Smartphone', 'url' => 'http://example.com/phone/phone_case', 'quantity' => 2 ] ] ]; $response = [ "message" => "Available payment types are listed.", "payments" => [ [ "raw_monthly_installment" => 187534.66680439, "name" => "Bayar dalam 6 bulan", "amount" => 1000000, "installment_amount" => 1125240, "raw_amount" => 1000000, "rate" => 2.95, "down_payment" => 0, "monthly_installment" => 187540, "discounted_monthly_installment" => 0, "tenure" => 6, "id" => "6_months", ], [ "raw_monthly_installment" => 1020000, "name" => "Bayar dalam 30 hari", "amount" => 1020000, "installment_amount" => 1020000, "raw_amount" => 1020000, "rate" => 0, "down_payment" => 0, "monthly_installment" => 1020000, "discounted_monthly_installment" => 0, "tenure" => 1, "id" => "30_days", ], [ "raw_monthly_installment" => 356786.46273702, "name" => "Bayar dalam 3 bulan", "amount" => 1000000, "installment_amount" => 1070370, "raw_amount" => 1000000, "rate" => 2.95, "down_payment" => 0, "monthly_installment" => 356790, "discounted_monthly_installment" => 0, "tenure" => 3, "id" => "3_months", ], ], ]; $this->stubRequest( 'POST', '/cardless-credit/payment-types', $params, [], $response ); $result = CardlessCredit::calculatePaymentTypes($params); $this->assertArrayHasKey('message', $result); $this->assertArrayHasKey('payments', $result); } public function testIsGettableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); $params = [ 'cardless_credit_type' => 'KREDIVO', 'amount' => 2000000, 'items' => [ [ 'id' => '123123', 'name' => 'Phone Case', 'price' => 1000000, 'type' => 'Smartphone', 'url' => 'http://example.com/phone/phone_case', 'quantity' => 2 ] ] ]; CardlessCredit::calculatePaymentTypes($params); } } PKZ.&xendit-php/tests/Xendit/QRCodeTest.phpnu[ * @license https::/opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; use Xendit\QRCode; /** * Class QRCodeTest * * @category Class * @package Xendit * @author Dave * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class QRCodeTest extends TestCase { const TEST_EXTERNAL_ID = 'external_123'; /** * Create QR Code test * Should pass * * @return void */ public function testIsCreatable() { $params = [ 'external_id' => self::TEST_EXTERNAL_ID, 'type' => 'DYNAMIC', 'callback_url' => 'https://webhook.site', 'amount' => 10000, ]; $expectedResult = [ 'id' => 'id1', 'external_id' => self::TEST_EXTERNAL_ID, 'amount' => 10000, 'qr_string' => 'this_is_qr_string', 'callback_url' => 'https://webhook.site', 'type' => 'DYNAMIC', 'status' => 'ACTIVE', 'created' => '2020-01-08T18:18:18.661Z', 'updated' => '2020-01-08T18:18:18.661Z', ]; $this -> stubRequest( 'POST', '/qr_codes', $params, ['api-version' => '2020-07-01'], $expectedResult ); $result = QRCode::create($params); $this->assertEquals($result['id'], 'id1'); $this->assertEquals($result['external_id'], $params['external_id']); $this->assertEquals($result['amount'], $params['amount']); $this->assertEquals($result['qr_string'], 'this_is_qr_string'); $this->assertEquals($result['callback_url'], $params['callback_url']); $this->assertEquals($result['type'], $params['type']); $this->assertEquals($result['status'], 'ACTIVE'); $this->assertEquals($result['created'], '2020-01-08T18:18:18.661Z'); $this->assertEquals($result['updated'], '2020-01-08T18:18:18.661Z'); } /** * Create V2 QR Code test * Should pass * * @return void */ public function testIsCreatableV2() { $params = [ 'api_version' => '2022-07-31', 'reference_id' => self::TEST_EXTERNAL_ID, 'currency' => 'IDR', 'type' => 'DYNAMIC', 'amount' => 10000, ]; $expectedResult = [ 'id' => 'id1', 'reference_id' => self::TEST_EXTERNAL_ID, 'currency' => 'IDR', 'amount' => 10000, 'qr_string' => 'this_is_qr_string', 'type' => 'DYNAMIC', 'status' => 'ACTIVE', 'created' => '2020-01-08T18:18:18.661Z', 'updated' => '2020-01-08T18:18:18.661Z', ]; $expectedParams = $params; unset($expectedParams['api_version']); $this -> stubRequest( 'POST', '/qr_codes', $expectedParams, ['api-version' => '2022-07-31'], $expectedResult ); $result = QRCode::create($params); $this->assertEquals($result['id'], 'id1'); $this->assertEquals($result['reference_id'], $params['reference_id']); $this->assertEquals($result['amount'], $params['amount']); $this->assertEquals($result['qr_string'], 'this_is_qr_string'); $this->assertEquals($result['type'], $params['type']); $this->assertEquals($result['status'], 'ACTIVE'); $this->assertEquals($result['created'], '2020-01-08T18:18:18.661Z'); $this->assertEquals($result['updated'], '2020-01-08T18:18:18.661Z'); } /** * Create QR Code * Should throw InvalidArgumentException with type not exist * * @return void */ public function testIsCreatableThrowInvalidArgumentExceptionIfTypeDoesntExist() { $this->expectException(Exceptions\InvalidArgumentException::class); $params = []; QRCode::create($params); } /** * Create QR Code * Should throw InvalidArgumentExcpetion with type not exist * * @return void */ public function testIsCreatableThrowInvalidArgumentExceptionOnWrongType() { $this->expectException(Exceptions\InvalidArgumentException::class); $params = [ 'type' => 'NOT_DYNAMIC', ]; QRCode::create($params); } /** * Create QR Code * Should throw InvalidArgumentException with wrong API version * * @return void */ public function testIsCreatableThrowInvalidArgumentExceptionOnWrongAPIVersion() { $this->expectException(Exceptions\InvalidArgumentException::class); $params = [ 'external_id' => self::TEST_EXTERNAL_ID, 'type' => 'DYNAMIC', 'callback_url' => 'https://webhook.site', 'amount' => 10000, 'api_version' => '2022-02-02' ]; QRCode::create($params); } /** * Create QR Code * Should throw InvalidArgumentException with wrong parameters for V2 * * @return void */ public function testIsCreatableThrowInvalidArgumentExceptionOnMissingReferenceIDForV2() { $this->expectException(Exceptions\InvalidArgumentException::class); $params = [ 'external_id' => self::TEST_EXTERNAL_ID, // expects this to be reference_id instead 'type' => 'DYNAMIC', 'amount' => 10000, 'api_version' => '2022-07-31' ]; QRCode::create($params); } /** * Create QR Code * Should throw InvalidArgumentException if callback URL is provided for V2 * * @return void */ public function testIsCreatableThrowInvalidArgumentExceptionOnCallbackURLForV2() { $this->expectException(Exceptions\InvalidArgumentException::class); $params = [ 'reference_id' => self::TEST_EXTERNAL_ID, 'type' => 'DYNAMIC', 'amount' => 10000, 'callback_url' => 'https://webhook.site', 'api_version' => '2022-07-31' ]; QRCode::create($params); } /** * Get QR Code test * Should pass * * @return void */ public function testIsGettable() { $expectedResult = [ 'id' => 'id1', 'external_id' => self::TEST_EXTERNAL_ID, 'amount' => 10000, 'qr_string' => 'this_is_qr_string', 'callback_url' => 'https://webhook.site', 'type' => 'DYNAMIC', 'status' => 'ACTIVE', 'created' => '2020-01-08T18:18:18.661Z', 'updated' => '2020-01-08T18:18:18.661Z', ]; $this -> stubRequest( 'GET', '/qr_codes' . '/' . self::TEST_EXTERNAL_ID, [], [], $expectedResult ); $result = QRCode::get(self::TEST_EXTERNAL_ID); $this->assertEquals($result['id'], 'id1'); $this->assertEquals($result['external_id'], self::TEST_EXTERNAL_ID); $this->assertEquals($result['amount'], 10000); $this->assertEquals($result['qr_string'], 'this_is_qr_string'); $this->assertEquals($result['callback_url'], 'https://webhook.site'); $this->assertEquals($result['type'], 'DYNAMIC'); $this->assertEquals($result['status'], 'ACTIVE'); $this->assertEquals($result['created'], '2020-01-08T18:18:18.661Z'); $this->assertEquals($result['updated'], '2020-01-08T18:18:18.661Z'); } } PKZ.ff)xendit-php/tests/Xendit/RecurringTest.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; use Xendit\Recurring; use Xendit\TestCase; /** * Class RecurringTest * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class RecurringTest extends TestCase { const TEST_ID = "123"; /** * Create Recurring test * Should pass * * @return void */ public function testIsCreatable() { $params = [ 'external_id' => 'demo_147580196270', 'payer_email' => 'sample_email@xendit.co', 'description' => 'Trip to Bali', 'amount' => 32000, 'interval' => 'MONTH', 'interval_count' => 1 ]; $this->stubRequest( 'POST', '/recurring_payments', $params, [], $params ); $result = Recurring::create($params); $this->assertEquals($result['external_id'], $params['external_id']); $this->assertEquals($result['payer_email'], $params['payer_email']); $this->assertEquals($result['description'], $params['description']); $this->assertEquals($result['amount'], $params['amount']); $this->assertEquals($result['interval'], $params['interval']); $this->assertEquals($result['interval_count'], $params['interval_count']); } /** * Get Recurring test * Should pass * * @return void */ public function testIsGettable() { $this->stubRequest( 'get', '/recurring_payments/'.self::TEST_ID, [], [], [ 'id' => self::TEST_ID ] ); $result = Recurring::retrieve(self::TEST_ID); $this->assertEquals($result['id'], self::TEST_ID); } /** * Update Recurring test * Should pass * * @return void */ public function testIsUpdateable() { $params = [ 'amount' => 32000, 'interval' => 'MONTH', 'interval_count' => 2 ]; $this->stubRequest( 'PATCH', '/recurring_payments/' . self::TEST_ID, $params, [], $params ); $result = Recurring::update(self::TEST_ID, $params); $this->assertEquals($result['amount'], $params['amount']); $this->assertEquals($result['interval'], $params['interval']); $this->assertEquals($result['interval_count'], $params['interval_count']); } /** * Stop Recurring test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsStoppable() { $this->stubRequest( 'post', '/recurring_payments/'.self::TEST_ID.'/stop!', [], [], [ 'id' => self::TEST_ID, 'status' => 'STOPPED' ] ); $result = Recurring::stop(self::TEST_ID); $this->assertEquals($result['id'], self::TEST_ID); $this->assertEquals($result['status'], 'STOPPED'); } /** * Pause Recurring test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsPausable() { $this->stubRequest( 'post', '/recurring_payments/'.self::TEST_ID.'/pause!', [], [], [ 'id' => self::TEST_ID, 'status' => 'PAUSED' ] ); $result = Recurring::pause(self::TEST_ID); $this->assertEquals($result['id'], self::TEST_ID); $this->assertEquals($result['status'], 'PAUSED'); } /** * Resume Recurring test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsResumable() { $this->stubRequest( 'post', '/recurring_payments/'.self::TEST_ID.'/resume!', [], [], [ 'id' => self::TEST_ID, 'status' => 'ACTIVE' ] ); $result = Recurring::resume(self::TEST_ID); $this->assertEquals($result['id'], self::TEST_ID); $this->assertEquals($result['status'], 'ACTIVE'); } /** * Create Recurring test * Should throw InvalidArgumentException * * @return void */ public function testIsCreatableThrowInvalidArgumentException() { $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); $params = [ 'external_id' => 'demo_147580196270', 'payer_email' => 'sample_email@xendit.co', 'description' => 'Trip to Bali', ]; Recurring::create($params); } /** * Get Recurring test * Should throw ApiException * * @return void */ public function testIsGettableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); Recurring::retrieve(self::TEST_ID); } /** * Update Recurring test * Should throw ApiException * * @return void */ public function testIsUpdateableThrowException() { $params = [ 'amount' => 32000 ]; $this->expectException(\Xendit\Exceptions\ApiException::class); Recurring::update(self::TEST_ID, $params); } /** * Stop Recurring test * Should throw ApiException * * @return void * @throws Exceptions\ApiException */ public function testIsStoppableThrowException() { $this->expectException(\Xendit\Exceptions\ApiException::class); Recurring::stop(self::TEST_ID); } /** * Pause Recurring test * Should throw ApiException * * @return void * @throws Exceptions\ApiException */ public function testIsPausableThrowException() { $this->expectException(\Xendit\Exceptions\ApiException::class); Recurring::pause(self::TEST_ID); } /** * Resume Recurring test * Should throw ApiException * * @return void * @throws Exceptions\ApiException */ public function testIsResumableThrowException() { $this->expectException(\Xendit\Exceptions\ApiException::class); $result = Recurring::resume(self::TEST_ID); } } PKZ1'xendit-php/tests/Xendit/BalanceTest.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; use Xendit\Balance; use Xendit\TestCase; /** * Class BalanceTest * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class BalanceTest extends TestCase { const ACCOUNT_TYPE = 'CASH'; const AMOUNT = 100000; /** * Get Balance test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsGettable() { $this->stubRequest( 'get', '/balance?account_type=' . self::ACCOUNT_TYPE, [], [], [ 'balance' => self::AMOUNT ] ); $result = Balance::getBalance(self::ACCOUNT_TYPE); $this->assertEquals($result['balance'], self::AMOUNT); } /** * Get Balance test * Should throw ApiException * * @return void * @throws Exceptions\InvalidArgumentException * @throws Exceptions\ApiException */ public function testIsGettableThrowInvalidArgumentException() { $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); Balance::getBalance(); } } PKZƙ4 4 0xendit-php/tests/Xendit/DisbursementsPHPTest.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\DisbursementsPHP; use Xendit\TestCase; /** * Class DisbursementsPHPTest * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class DisbursementsPHPTest extends TestCase { const TEST_ID = "123"; /** * Create PHP Disbursements test * Should pass * * @return array[ * 'id'=> 'disb-random-id', * 'reference_id'=> 'random id', * 'currency'=> 'PHP', * 'amount'=> float * 'channel_code'=> 'BRI', * 'description'=> 'description', * 'status'=> 'Pending', * 'created'=> 'Date', * 'updated'=> 'Date', * receipt_notification => Array * beneficiary => Array * @throws Exceptions\ApiException */ public function testIsCreatablePHPDisbursement() { $params = [ 'xendit-idempotency-key' => 'disb-12345678', 'reference_id' => 'disb-12345678', 'currency' => 'PHP', 'amount' => 15000, 'channel_code' => 'BCA', 'account_name' => 'Joe', 'account_number' => '1234567890', 'description' => 'Disbursement from Example' ]; $expectedResponse = $params; $expectedResponse['id'] = self::TEST_ID; $this->stubRequest( 'POST', '/disbursements', $params, [], $expectedResponse ); $result = DisbursementsPHP::createPHPDisbursement($params); $this->assertEquals($result['id'], self::TEST_ID); $this->assertEquals($result['reference_id'], $params['reference_id']); $this->assertEquals($result['amount'], $params['amount']); $this->assertEquals($result['channel_code'], $params['channel_code']); $this->assertEquals( $result['account_name'], $params['account_name'] ); $this->assertEquals($result['account_number'], $params['account_number']); $this->assertEquals($result['description'], $params['description']); } /** * Create PHP Disbursements test * Should throw InvalidArgumentException * * @return void * @throws \Xendit\Exceptions\ApiException */ public function testIsCreatePHPDisbThrowInvalidArgumentException() { $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); $params = [ 'external_id' => 'demo_147580196270' ]; DisbursementsPHP::createPHPDisbursement($params); } /** * Create PHP Disbursements test * Should throw ApiException * * @return void * @throws \Xendit\Exceptions\ApiException */ public function testIsCreatePHPDisbThrowApiException() { $params = [ 'xendit-idempotency-key' => 'disb-12345678', 'reference_id' => 'disb-12345678', 'currency' => 'PHP', 'amount' => 15000, 'channel_code' => 'BCA', 'account_name' => 'Joe', 'account_number' => '1234567890', 'description' => 'Disbursement from Example' ]; $this->expectException(\Xendit\Exceptions\ApiException::class); DisbursementsPHP::createPHPDisbursement($params); } /** * Get PHP Disbursements by ID test * Should pass * * @return array[ * 'id'=> 'disb-random-id', * 'reference_id'=> 'random id', * 'currency'=> 'PHP', * 'amount'=> float * 'channel_code'=> 'BRI', * 'description'=> 'description', * 'status'=> 'Pending', * 'created'=> 'Date', * 'updated'=> 'Date', * receipt_notification => Array * beneficiary => Array * ] * @throws Exceptions\ApiException */ public function testIsGettableByPHPDisbursementID() { $expectedResponse = [ 'id' => self::TEST_ID, 'xendit_idempotency_key' => 'disb-12345678', 'reference_id' => 'disb-12345678', 'currency' => 'PHP', 'amount' => 15000, 'channel_code' => 'BCA', 'account_name' => 'Joe', 'account_number' => '1234567890', 'description' => 'Disbursement from Example' ]; $this->stubRequest( 'GET', '/disbursements/' . self::TEST_ID, [], [], $expectedResponse ); $result = DisbursementsPHP::getPHPDisbursementByID(self::TEST_ID); $this->assertEquals($result['id'], self::TEST_ID); $this->assertEquals($result['reference_id'], $expectedResponse['reference_id']); $this->assertEquals($result['amount'], $expectedResponse['amount']); $this->assertEquals($result['channel_code'], $expectedResponse['channel_code']); $this->assertEquals( $result['account_name'], $expectedResponse['account_name'] ); $this->assertEquals($result['account_number'], $expectedResponse['account_number']); $this->assertEquals($result['description'], $expectedResponse['description']); } /** * Get PHP Disbursements by Disbursement ID test * Should throw ApiException * * @return void * @throws \Xendit\Exceptions\ApiException */ public function testIsGettableByPHPDisbursementIDThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); DisbursementsPHP::getPHPDisbursementByID(self::TEST_ID); } /** * Get PHP Disbursements by Reference ID test * Should pass * * @return array[ * [ * 'id'=> 'disb-random-id', * 'reference_id'=> 'random id', * 'currency'=> 'PHP', * 'amount'=> float * 'channel_code'=> 'BRI', * 'description'=> 'description', * 'status'=> 'Pending', * 'created'=> 'Date', * 'updated'=> 'Date', * receipt_notification => Array * beneficiary => Array] * @throws Exceptions\ApiException */ public function testIsGettablePHPDisbursementsByReferenceID() { $expectedResponse = [ [ 'id' => 'disb-12345678', 'xendit_idempotency_key' => 'disb-12345678', 'reference_id' => self::TEST_ID, 'currency' => 'PHP', 'amount' => 15000, 'channel_code' => 'BCA', 'account_name' => 'Joe', 'account_number' => '1234567890', 'description' => 'Disbursement from Example' ] ]; $this->stubRequest( 'GET', '/disbursements?reference_id=' . self::TEST_ID, [], [], $expectedResponse ); $result = DisbursementsPHP::getPHPDisbursementsByReferenceID(self::TEST_ID); $this->assertEquals($result[0]['id'], $expectedResponse[0]['id']); $this->assertEquals($result[0]['reference_id'], self::TEST_ID); $this->assertEquals($result[0]['amount'], $expectedResponse[0]['amount']); $this->assertEquals($result[0]['channel_code'], $expectedResponse[0]['channel_code']); $this->assertEquals( $result[0]['account_name'], $expectedResponse[0]['account_name'] ); $this->assertEquals($result[0]['account_number'], $expectedResponse[0]['account_number']); $this->assertEquals($result[0]['description'], $expectedResponse[0]['description']); } /** * Get PHP Disbursements by Reference ID test * Should throw ApiException * * @return void * @throws \Xendit\Exceptions\ApiException */ public function testIsGettablePHPDisbursementsByReferenceIDThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); $result = DisbursementsPHP::getPHPDisbursementsByReferenceID(null); var_dump($result); } } PKZ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; use Xendit\Platform; use Xendit\TestCase; /** * Class PlatformTest * * @category Class * @package Xendit * @author David * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class PlatformTest extends TestCase { const ACCOUNT_TYPE = 'OWNED'; const ACCOUNT_EMAIL = 'customer@website.com'; const ACCOUNT_BUSINESS_NAME = 'customer company'; /** * Create Account test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testAccountIsCreatable() { $expected = [ 'email' => self::ACCOUNT_EMAIL, 'type' => self::ACCOUNT_TYPE, 'public_profile' => ['business_name' => self::ACCOUNT_BUSINESS_NAME] ]; $this->stubRequest( 'POST', '/v2/accounts', $expected, [], $expected ); $result = Platform::createAccount($expected); $this->assertEquals($result['email'], $expected['email']); $this->assertEquals($result['type'], $expected['type']); } /** * Get Account by ID test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testAccountIsGettable() { $expectedResponse = [ 'id' => '5cafeb170a2b18519b1b8761', 'created' => '2021-01-01T10:00:00Z', 'updated' => '2021-01-01T10:00:00Z', 'type'=> 'OWNED', 'email'=> 'angie@pinkpanther.com', 'status'=> 'LIVE', ]; $this->stubRequest( 'GET', '/v2/accounts/5cafeb170a2b18519b1b8761', [], [], $expectedResponse ); $result = Platform::getAccount('5cafeb170a2b18519b1b8761'); $this->assertEquals($result['id'], $expectedResponse['id']); $this->assertEquals($result['type'], $expectedResponse['type']); } /** * Update Account test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testAccountIsUpdatable() { $expected = [ 'email' => self::ACCOUNT_EMAIL, 'public_profile' => ['business_name' => self::ACCOUNT_BUSINESS_NAME.' Updated'] ]; $this->stubRequest( 'PATCH', '/v2/accounts/5cafeb170a2b18519b1b8761', $expected, [], $expected ); $result = Platform::updateAccount('5cafeb170a2b18519b1b8761', $expected); $this->assertEquals($result['email'], $expected['email']); } /** * Create Transfer test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testTransferIsCreatable() { $expected = [ 'reference' => ''.time(), 'amount' => 50000, 'source_user_id' => '54afeb170a2b18519b1b8768', 'destination_user_id' => '5cafeb170a2b1851246b8768', ]; $this->stubRequest( 'POST', '/transfers', $expected, [], $expected ); $result = Platform::createTransfer($expected); $this->assertEquals($result['source_user_id'], $expected['source_user_id']); $this->assertEquals($result['destination_user_id'], $expected['destination_user_id']); } /** * Create Fee Rule test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testFeeRuleIsCreatable() { $params = [ 'name' => 'standard_platform_fee', 'description' => 'Fee charged to insurance agents based in Java', 'unit' => 'flat', 'amount' => 6500, 'currency' => 'IDR' ]; $expected = [ 'name' => 'standard_platform_fee', 'description' => 'Fee charged to insurance agents based in Java', 'routes' => [ array( 'unit' => 'flat', 'amount' => 6500, 'currency' => 'IDR' ) ] ]; $this->stubRequest( 'POST', '/fee_rules', $expected, [], $expected ); $result = Platform::createFeeRule($params); $this->assertEquals($result['name'], $expected['name']); } /** * Set Callback URL test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testCallbackUrlIsCreatable() { $expected = [ 'url' => 'https://webhook.site/c9c9140b-96b8-434c-9c59-7440eeae4d7f' ]; $callbackType = 'invoice'; $this->stubRequest( 'POST', '/callback_urls/'.$callbackType, $expected, [], $expected ); $result = Platform::setCallbackUrl($callbackType, $expected); $this->assertEquals($result['url'], $expected['url']); } /** * Create Account test * Should throw InvalidArgumentException * * @return void */ public function testAccountIsCreatableThrowsException() { $expected = [ 'email' => self::ACCOUNT_EMAIL ]; $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); Platform::createAccount($expected); } /** * Get account by ID test * Should throw ApiException * * @return void */ public function testAccountIsGettableThrowsException() { $id = '358115033581150335811503358115033581150335811503358115033581150335811503358115033581150335811503358115033581150335811503'; $this->expectException(\Xendit\Exceptions\ApiException::class); Platform::getAccount($id); } /** * Update Account test * Should throw InvalidArgumentException * * @return void */ public function testAccountIsUpdatetableThrowsException() { $expected = [ 'public_profile' => ['business_name' => self::ACCOUNT_BUSINESS_NAME.' Updated'] ]; $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); Platform::updateAccount($expected); } /** * Create Transfer test * Should throw InvalidArgumentException * * @return void */ public function testTransferIsCreatableThrowsException() { $expected = [ 'reference' => time() ]; $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); Platform::createTransfer($expected); } /** * Create Fee Rule test * Should throw InvalidArgumentException * * @return void */ public function testFeeRuleIsCreatableThrowsException() { $expected = [ 'name' => 'standard_platform_fee' ]; $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); Platform::createFeeRule($expected); } /** * Set Callback URL test * Should throw InvalidArgumentException * * @return void */ public function testCallbackurlIsCreatableThrowsException() { $expected = []; $callbackType = 'invoice'; $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); Platform::setCallbackUrl($callbackType, $expected); } } PKZ2T5xendit-php/tests/Xendit/DisbursementsChannelsTest.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\DisbursementChannels; use Xendit\TestCase; /** * Class DisbursementsChannelsTest * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class DisbursementsChannelsTest extends TestCase { const CHANNEL_CATEGORY = "BANK"; const CHANNEL_CODE = "PH_CIMB"; /** * Get Disbursement Channels * Should pass * * @return array[ * [ * 'channel_code'=> 'PH_CIMB', * 'name'=> 'CIMB Bank Philippines Inc', * 'channel_category'=> 'BANK', * 'currency'=> 'PHP', * 'minimum'=> 50000, * 'maximum'=> 200000000, * 'minimum_increment'=> 0.01 * ], [ * 'channel_code'=> 'PH_CITI', * 'name'=> 'Citibank, N.A.', * 'channel_category'=> 'BANK', * 'currency'=> 'PHP', * 'minimum'=> 1, * 'maximum'=> 999999999, * 'minimum_increment'=> 1 * ]] * @throws Exceptions\ApiException */ public function testIsGettableDisbursementChannels() { $expectedResponse = [ [ 'channel_code' => 'PH_CIMB', 'name' => 'CIMB Bank Philippines Inc', 'channel_category' => 'BANK', 'currency' => 'PHP', 'minimum' => 50000, 'maximum' => 200000000, 'minimum_increment' => 0.01 ], [ 'channel_code' => 'PH_CITI', 'name' => 'Citibank, N.A.', 'channel_category' => 'BANK', 'currency' => 'PHP', 'minimum' => 1, 'maximum' => 999999999, 'minimum_increment' => 1 ] ]; $this->stubRequest( 'GET', '/disbursement-channels', [], [], $expectedResponse ); $result = DisbursementChannels::getDisbursementChannels(); $this->assertEquals($result[0]['channel_code'], $expectedResponse[0]['channel_code']); $this->assertEquals($result[1]['channel_code'], $expectedResponse[1]['channel_code']); $this->assertCount(2, $result); } /** * Get Disbursement Channels by channel category * Should pass * * @return array[ * [ * 'channel_code'=> 'PH_CIMB', * 'name'=> 'CIMB Bank Philippines Inc', * 'channel_category'=> 'BANK', * 'currency'=> 'PHP', * 'minimum'=> 50000, * 'maximum'=> 200000000, * 'minimum_increment'=> 0.01 * ], [ * 'channel_code'=> 'PH_CITI', * 'name'=> 'Citibank, N.A.', * 'channel_category'=> 'BANK', * 'currency'=> 'PHP', * 'minimum'=> 1, * 'maximum'=> 999999999, * 'minimum_increment'=> 1 * ]] * @throws Exceptions\ApiException */ public function testIsGettableDisbursementChannelsByChannelCategory() { $expectedResponse = [ [ 'channel_code' => 'PH_CIMB', 'name' => 'CIMB Bank Philippines Inc', 'channel_category' => 'BANK', 'currency' => 'PHP', 'minimum' => 50000, 'maximum' => 200000000, 'minimum_increment' => 0.01 ], [ 'channel_code' => 'PH_CITI', 'name' => 'Citibank, N.A.', 'channel_category' => 'BANK', 'currency' => 'PHP', 'minimum' => 1, 'maximum' => 999999999, 'minimum_increment' => 1 ] ]; $this->stubRequest( 'GET', '/disbursement-channels?channel_category=' . self::CHANNEL_CATEGORY, [], [], $expectedResponse ); $result = DisbursementChannels::getDisbursementChannelsByChannelCategory(self::CHANNEL_CATEGORY); $this->assertEquals($result[0]['channel_category'], $expectedResponse[0]['channel_category']); $this->assertEquals($result[1]['channel_category'], $expectedResponse[1]['channel_category']); $this->assertCount(2, $result); } /** * Get Disbursement Channels by Channel Category test * Should throw ApiException * * @return void * @throws \Xendit\Exceptions\ApiException */ public function testIsGettableDisbursementChannelsByChannelCategoryThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); DisbursementChannels::getDisbursementChannelsByChannelCategory(null); } /** * Get Disbursement Channels by Channel Code * Should pass * * @return array[ * [ * 'channel_code'=> 'PH_CIMB', * 'name'=> 'CIMB Bank Philippines Inc', * 'channel_category'=> 'BANK', * 'currency'=> 'PHP', * 'minimum'=> 50000, * 'maximum'=> 200000000, * 'minimum_increment'=> 0.01 * ]] * @throws Exceptions\ApiException */ public function testIsGettableDisbursementChannelsByChannelCode() { $expectedResponse = [ [ 'channel_code' => 'PH_CIMB', 'name' => 'CIMB Bank Philippines Inc', 'channel_category' => 'BANK', 'currency' => 'PHP', 'minimum' => 50000, 'maximum' => 200000000, 'minimum_increment' => 0.01 ] ]; $this->stubRequest( 'GET', '/disbursement-channels?channel_code=' . self::CHANNEL_CODE, [], [], $expectedResponse ); $result = DisbursementChannels::getDisbursementChannelsByChannelCode(self::CHANNEL_CODE); $this->assertEquals($result[0]['channel_code'], $expectedResponse[0]['channel_code']); $this->assertCount(1, $result); } /** * Get Disbursement Channels by Channel Code test * Should throw ApiException * * @return void * @throws \Xendit\Exceptions\ApiException */ public function testIsGettableDisbursementChannelsByChannelCodeThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); DisbursementChannels::getDisbursementChannelsByChannelCode(null); } } PKZu1VV-xendit-php/tests/Xendit/DisbursementsTest.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Disbursements; use Xendit\TestCase; /** * Class DisbursementsTest * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class DisbursementsTest extends TestCase { const TEST_ID = "123"; const CHANNEL_CATEGORY = "BANK"; const CHANNEL_CODE = "PH_CIMB"; /** * Create Disbursements test * Should pass * * @return void */ public function testIsCreatable() { $params = [ 'external_id' => 'disb-12345678', 'amount' => 15000, 'bank_code' => 'BCA', 'account_holder_name' => 'Joe', 'account_number' => '1234567890', 'description' => 'Disbursement from Example' ]; $this->stubRequest( 'POST', '/disbursements', $params, [], $params ); $result = Disbursements::create($params); $this->assertEquals($result['external_id'], $params['external_id']); $this->assertEquals($result['amount'], $params['amount']); $this->assertEquals($result['bank_code'], $params['bank_code']); $this->assertEquals( $result['account_holder_name'], $params['account_holder_name'] ); $this->assertEquals($result['account_number'], $params['account_number']); $this->assertEquals($result['description'], $params['description']); } /** * Create Batch Disbursements test * Should pass * * @return void * @throws \Xendit\Exceptions\ApiException */ public function testIsBatchCreatable() { $params = [ 'reference' => 'disb_batch-12345678', 'disbursements' => [ [ 'amount' => 20000, 'bank_code' => 'BCA', 'bank_account_name' => 'Fadlan', 'bank_account_number' => '1234567890', 'description' => 'Batch Disbursement', 'external_id' => 'disbursement-1' ], [ 'amount' => 30000, 'bank_code' => 'MANDIRI', 'bank_account_name' => 'Lutfi', 'bank_account_number' => '1234567891', 'description' => 'Batch Disbursement with email notifications', 'external_id' => 'disbursement-2', 'email_to' => ['test+to@xendit.co'], 'email_cc' => ['test+cc@xendit.co'], 'email_bcc' => ['test+bcc1@xendit.co', 'test+bcc2@xendit.co'] ] ] ]; $this->stubRequest( 'POST', '/batch_disbursements', $params, [], $params ); $result = Disbursements::createBatch($params); $this->assertEquals($result['reference'], $params['reference']); $this->assertEquals($result['disbursements'], $params['disbursements']); } /** * Get DisbursementsBanks test * Should pass * * @return void * @throws \Xendit\Exceptions\ApiException */ public function testBanksIsGettable() { $expectedResponse = [[ 'name' => 'Bank Mandiri', 'code' => 'MANDIRI', 'can_disburse' => true, 'can_name_validate' => true ]]; $this->stubRequest( 'GET', '/available_disbursements_banks', [], [], $expectedResponse ); $result = Disbursements::getAvailableBanks(); $this->assertEquals($result[0]['name'], $expectedResponse[0]['name']); $this->assertEquals($result[0]['code'], $expectedResponse[0]['code']); $this->assertEquals( $result[0]['can_disburse'], $expectedResponse[0]['can_disburse'] ); $this->assertEquals( $result[0]['can_name_validate'], $expectedResponse[0]['can_name_validate'] ); } /** * Get Disbursements by ID test * Should pass * * @return void */ public function testIsGettableByID() { $this->stubRequest( 'GET', '/disbursements/' . self::TEST_ID, [], [], [ 'id' => self::TEST_ID ] ); $result = Disbursements::retrieve(self::TEST_ID); $this->assertEquals($result['id'], self::TEST_ID); } /** * Get Disbursements by External ID test * Should pass * * @return void * @throws \Xendit\Exceptions\ApiException */ public function testIsGettableByExternalID() { $this->stubRequest( 'GET', '/disbursements?external_id=' . self::TEST_ID, [], [], [ 'id' => self::TEST_ID ] ); $result = Disbursements::retrieveExternal(self::TEST_ID); $this->assertEquals($result['id'], self::TEST_ID); } /** * Create Disbursements test * Should throw InvalidArgumentException * * @return void */ public function testIsCreatableThrowInvalidArgumentException() { $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); $params = [ 'external_id' => 'demo_147580196270' ]; Disbursements::create($params); } /** * Create Batchs Disbursements test * Should throw InvalidArgumentException * * @return void * @throws \Xendit\Exceptions\ApiException */ public function testIsBatchCreatableThrowInvalidArgumentException() { $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); $params = [ 'external_id' => 'demo_147580196270' ]; Disbursements::createBatch($params); } /** * Get Disbursements by ID test * Should throw ApiException * * @return void */ public function testIsGettableByIDThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); Disbursements::retrieve(self::TEST_ID); } /** * Get Disbursements by External ID test * Should throw ApiException * * @return void * @throws \Xendit\Exceptions\ApiException */ public function testIsGettableByExtIDThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); Disbursements::retrieveExternal(self::TEST_ID); } } PKZC^^+xendit-php/tests/Xendit/DirectDebitTest.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; use Xendit\DirectDebit; use Xendit\TestCase; /** * Class DirectDebitTest * * @category Class * @package Xendit * @author Glenda * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class DirectDebitTest extends TestCase { const INITIALIZED_LINKED_ACCOUNT_PARAMS = [ 'customer_id' => '6778b829-1936-4c4a-a321-9a0178840571', 'channel_code' => 'DC_BRI', 'properties' => [ 'account_mobile_number' => '+62818555988', 'card_last_four' => '8888', 'card_expiry' => '06/24', 'account_email' => 'test.email@xendit.co' ], 'metadata' => [ 'meta' => 'data' ] ]; const INITIALIZED_LINKED_ACCOUNT_RESPONSE = [ 'id' => 'lat-f9dc34e7-153a-444e-b337-cd2599e7f670', 'customer_id' => '6778b829-1936-4c4a-a321-9a0178840571', 'channel_code' => 'DC_BRI', 'status' => 'PENDING', 'authorizer_url' => null, 'metadata' => [ 'meta' => 'data' ], ]; const TOKEN_ID = 'lat-f9dc34e7-153a-444e-b337-cd2599e7f670'; const VALIDATED_LINKED_ACCOUNT_PARAMS = [ 'otp_code' => '333000' ]; const VALIDATED_LINKED_ACCOUNT_RESPONSE = [ 'id' => self::TOKEN_ID, 'customer_id' => '6778b829-1936-4c4a-a321-9a0178840571', 'channel_code' => 'DC_BRI', 'status' => 'SUCCESS', 'metadata' => [ 'meta' => 'data' ], ]; const ACCESSIBLE_ACCOUNT_RESPONSE = [ [ 'channel_code' => 'DC_BRI', 'id' => 'la-3a1b4458-9f5b-4dfd-8250-f6c3f41f5240', 'properties' => [ 'card_expiry' => '06/24', 'card_last_four' => '8888', 'currency' => 'IDR', 'description' => '' ], 'type' => 'DEBIT_CARD' ] ]; const UNBINDED_LINKED_ACCOUNT_RESPONSE = [ 'id' => self::TOKEN_ID, 'is_deleted' => true ]; const PAYMENT_METHOD_PARAMS = [ 'customer_id' => '6778b829-1936-4c4a-a321-9a0178840571', 'type' => 'DEBIT_CARD', 'properties' => [ 'id' => 'la-55048b41-a7ab-4799-9f33-6ec5cc078db0' ], 'metadata' => [ 'meta' => 'data' ] ]; const PAYMENT_METHOD_RESPONSE = [ 'id' => 'pm-ebb1c863-c7b5-4f20-b116-b3071b1d3aef', 'customer_id' => '4b7b6050-0830-440a-903b-37d527dbbaa9', 'type' => 'DEBIT_CARD', 'status' => 'ACTIVE', 'properties' => [ 'id' => 'la-55048b41-a7ab-4799-9f33-6ec5cc078db0', 'currency' => 'IDR', 'card_expiry' => '11/23', 'description' => '', 'channel_code' => 'DC_BRI', 'card_last_four' => '8888' ], 'metadata' => [ 'meta' => 'data' ], 'created' => '2021-07-15T03:17:53.989Z', 'updated' => '2021-07-15T03:17:53.989Z' ]; const CUSTOMER_ID = '4b7b6050-0830-440a-903b-37d527dbbaa9'; const DIRECT_DEBIT_PAYMENT_PARAMS = [ 'reference_id' => 'test-ref-id', 'payment_method_id' => 'pm-ebb1c863-c7b5-4f20-b116-b3071b1d3aef', 'currency' => 'IDR', 'amount' => 15000, 'callback_url' => 'http://webhook.site/', 'enable_otp' => true, 'description' => 'test description', 'basket' => [ [ 'reference_id' => 'basket-product-ref-id', 'name' => 'product name', 'category' => 'mechanics', 'market' => 'ID', 'price' => 50000, 'quantity' => 5, 'type' => 'product type', 'sub_category' => 'product sub category', 'category' => 'product category', 'description' => 'product description', 'url' => 'http://product.url' ] ], 'success_redirect_url' => 'https://success-redirect.url', 'failure_redirect_url' => 'https://failure-redirect.url', 'device' => [ 'id' => 'device-id', 'ip_address' => '0.0.0.0', 'user_agent' => 'user-agent', 'ad_id' => 'ad-id', 'imei' => '123a456b789c' ], 'metadata' => [ 'meta' => 'data' ], 'Idempotency-key' => 'idempotency-keyy' ]; const DIRECT_DEBIT_PAYMENT_RESPONSE = [ 'id' => 'ddpy-7e61b0a7-92f9-4762-a994-c2936306f44c', 'reference_id' => 'test-ref-id', 'payment_method_id' => 'pm-ebb1c863-c7b5-4f20-b116-b3071b1d3aef', 'channel_code' => 'DC_BRI', 'currency' => 'IDR', 'amount' => 15000, 'is_otp_required' => true, 'basket' => [ [ 'reference_id' => 'basket-product-ref-id', 'name' => 'product name', 'category' => 'mechanics', 'market' => 'ID', 'price' => 50000, 'quantity' => 5, 'type' => 'product type', 'sub_category' => 'product sub category', 'category' => 'product category', 'description' => 'product description', 'url' => 'http://product.url' ] ], 'description' => 'test description', 'status' => 'PENDING', 'callback_url' => 'http://webhook.site/', 'enable_otp' => true, 'metadata' => [ 'meta' => 'data' ], 'created' => '2021-07-16T02:19:07.277466Z', 'updated' => '2021-07-16T02:19:07.277466Z', 'device' => [ 'id' => 'device-id', 'ip_address' => '0.0.0.0', 'user_agent' => 'user-agent', 'ad_id' => 'ad-id', 'imei' => '123a456b789c' ], 'refunded_amount' => 0, 'refunds' => [ 'data' => [ 'a1b', 'c2d', 'e3f', 'g4h' ], 'has_more' => false, 'url' => 'https://ref.unds' ], 'failure_code' => 'failure-code', 'otp_mobile_number' => '+6281234567890', 'otp_expiration_timestamp' => '2100-07-16T02:19:07.277466Z', 'success_redirect_url' => 'https://success-redirect.url', 'checkout_url' => 'https://checkout.url', 'failure_redirect_url' => 'https://failure-redirect.url', 'required_action' => 'VALIDATE_OTP' ]; const VALIDATED_DIRECT_DEBIT_PAYMENT_RESPONSE = [ 'id' => 'ddpy-7e61b0a7-92f9-4762-a994-c2936306f44c', 'reference_id' => 'test-ref-id', 'payment_method_id' => 'pm-ebb1c863-c7b5-4f20-b116-b3071b1d3aef', 'channel_code' => 'DC_BRI', 'currency' => 'IDR', 'amount' => 15000, 'is_otp_required' => true, 'basket' => [ [ 'reference_id' => 'basket-product-ref-id', 'name' => 'product name', 'category' => 'mechanics', 'market' => 'ID', 'price' => 50000, 'quantity' => 5, 'type' => 'product type', 'sub_category' => 'product sub category', 'category' => 'product category', 'description' => 'product description', 'url' => 'http://product.url' ] ], 'description' => 'test description', 'status' => 'COMPLETED', 'callback_url' => 'http://webhook.site/', 'enable_otp' => true, 'metadata' => [ 'meta' => 'data' ], 'created' => '2021-07-16T02:19:07.277466Z', 'updated' => '2021-07-16T02:19:07.277466Z', 'device' => [ 'id' => 'device-id', 'ip_address' => '0.0.0.0', 'user_agent' => 'user-agent', 'ad_id' => 'ad-id', 'imei' => '123a456b789c' ], 'refunded_amount' => 0, 'refunds' => [ 'data' => [ 'a1b', 'c2d', 'e3f', 'g4h' ], 'has_more' => false, 'url' => 'https://ref.unds' ], 'failure_code' => 'failure-code', 'otp_mobile_number' => '+6281234567890', 'otp_expiration_timestamp' => '2100-07-16T02:19:07.277466Z', 'success_redirect_url' => 'https://success-redirect.url', 'checkout_url' => 'https://checkout.url', 'failure_redirect_url' => 'https://failure-redirect.url', 'required_action' => 'VALIDATE_OTP' ]; const DIRECT_DEBIT_PAYMENT_ID = 'ddpy-7e61b0a7-92f9-4762-a994-c2936306f44c'; const VALIDATED_DIRECT_DEBIT_PAYMENT_PARAMS = [ 'otp_code' => '222000' ]; const REFERENCE_ID = 'test-ref-id'; /** * Initialize linked account tokenization test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsLinkedAccountTokenizationInitializable() { $params = self::INITIALIZED_LINKED_ACCOUNT_PARAMS; $response = self::INITIALIZED_LINKED_ACCOUNT_RESPONSE; $this->stubRequest( 'POST', '/linked_account_tokens/auth', $params, [], $response ); $result = DirectDebit::initializeLinkedAccountTokenization($params); $this->assertEquals($response, $result); } /** * Initialize linked account tokenization with headers * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsLinkedAccountTokenizationInitializableWithHeaders() { $params = array_merge( self::INITIALIZED_LINKED_ACCOUNT_PARAMS, array('for-user-id' => 'user-id') ); $response = self::INITIALIZED_LINKED_ACCOUNT_RESPONSE; $this->stubRequest( 'POST', '/linked_account_tokens/auth', $params, [], $response ); $result = DirectDebit::initializeLinkedAccountTokenization($params); $this->assertEquals($response, $result); } /** * Initialize linked account tokenization test * Should throw InvalidArgumentException * * @return void * @throws Exceptions\ApiException */ public function testIsLinkedAccountTokenizationInitializableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); $params = self::INITIALIZED_LINKED_ACCOUNT_PARAMS; DirectDebit::initializeLinkedAccountTokenization($params); } /** * Validate OTP for linked account test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsLinkedAccountOTPValidatable() { $params = self::VALIDATED_LINKED_ACCOUNT_PARAMS; $response = self::VALIDATED_LINKED_ACCOUNT_RESPONSE; $this->stubRequest( 'POST', '/linked_account_tokens/' . self::TOKEN_ID . '/validate_otp', $params, [], $response ); $result = DirectDebit::validateOTPForLinkedAccount( self::TOKEN_ID, $params ); $this->assertEquals($response, $result); } /** * Validate OTP for linked account test with headers * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsLinkedAccountOTPValidatableWithHeaders() { // $token_id = 'lat-f9dc34e7-153a-444e-b337-cd2599e7f670'; $params = array_merge( self::VALIDATED_LINKED_ACCOUNT_PARAMS, array('for-user-id' => 'user-id') ); $response = self::VALIDATED_LINKED_ACCOUNT_RESPONSE; $this->stubRequest( 'POST', '/linked_account_tokens/' . self::TOKEN_ID . '/validate_otp', $params, [], $response ); $result = DirectDebit::validateOTPForLinkedAccount( self::TOKEN_ID, $params ); $this->assertEquals($response, $result); } /** * Validate OTP for linked account test * Should throw ApiException * * @return void * @throws Exceptions\ApiException */ public function testIsLinkedAccountOTPValidatableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); // $token_id = 'lat-f9dc34e7-153a-444e-b337-cd2599e7f670'; $params = self::VALIDATED_LINKED_ACCOUNT_PARAMS; DirectDebit::validateOTPForLinkedAccount( self::TOKEN_ID, $params ); } /** * Retrieve accessible linked accounts test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsAccessibleLinkedAccountRetrievable() { $response = self::ACCESSIBLE_ACCOUNT_RESPONSE; $this->stubRequest( 'GET', '/linked_account_tokens/' . self::TOKEN_ID . '/accounts', [], [], $response ); $result = DirectDebit::retrieveAccessibleLinkedAccounts( self::TOKEN_ID ); $this->assertEquals($response, $result); } /** * Retrieve accessible linked accounts test * Should throw apiException * * @return void * @throws Exceptions\ApiException */ public function testIsAccessibleLinkedAccountRetrievableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); DirectDebit::retrieveAccessibleLinkedAccounts( self::TOKEN_ID ); } /** * Unbind linked account token test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsLinkedAccountTokenUnbindable() { $response = self::UNBINDED_LINKED_ACCOUNT_RESPONSE; $this->stubRequest( 'DELETE', '/linked_account_tokens/' . self::TOKEN_ID, [], [], $response ); $result = DirectDebit::unbindLinkedAccountToken( self::TOKEN_ID ); $this->assertEquals($response, $result); } /** * Unbind linked account token test with headers * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsLinkedAccountUnbindableWithHeaders() { $params = [ 'for-user-id' => 'user-id' ]; $response = self::UNBINDED_LINKED_ACCOUNT_RESPONSE; $this->stubRequest( 'DELETE', '/linked_account_tokens/' . self::TOKEN_ID, [], [], $response ); $result = DirectDebit::unbindLinkedAccountToken( self::TOKEN_ID ); $this->assertEquals($response, $result); } /** * Unbind linked account test * Should throw ApiException * * @return void * @throws Exceptions\ApiException */ public function testIsLinkedAccountUnbindableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); DirectDebit::unbindLinkedAccountToken( self::TOKEN_ID ); } /** * Create payment method test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsPaymentMethodCreatable() { $params = self::PAYMENT_METHOD_PARAMS; $response = self::PAYMENT_METHOD_RESPONSE; $this->stubRequest( 'POST', '/payment_methods', $params, [], $response ); $result = DirectDebit::createPaymentMethod($params); $this->assertEquals($response, $result); } /** * Create payment method test with headers * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsPaymentMethodCreatableWithHeaders() { $params = array_merge( self::PAYMENT_METHOD_PARAMS, array('for-user-id' => 'user-id') ); $response = self::PAYMENT_METHOD_RESPONSE; $this->stubRequest( 'POST', '/payment_methods', $params, [], $response ); $result = DirectDebit::createPaymentMethod($params); $this->assertEquals($response, $result); } /** * Create payment method test * Should throw InvalidArgumentException * * @return void * @throws Exceptions\ApiException */ public function testIsPaymentMethodCreatableThrowApiException() { // $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); $this->expectException(\Xendit\Exceptions\ApiException::class); $params = self::PAYMENT_METHOD_PARAMS; DirectDebit::createPaymentMethod($params); } /** * Get payment method test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsPaymentMethodGettable() { $response = [self::PAYMENT_METHOD_RESPONSE]; $this->stubRequest( 'GET', '/payment_methods?customer_id=' . self::CUSTOMER_ID, [], [], $response ); $result = DirectDebit::getPaymentMethodsByCustomerID( self::CUSTOMER_ID ); $this->assertEquals($response, $result); } /** * Get payment method test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsPaymentMethodGettableButNotFound() { $result = DirectDebit::getPaymentMethodsByCustomerID(self::CUSTOMER_ID); $this->assertEquals($result, []); } /** * Create direct debit payment test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsDirectDebitPaymentCreatable() { $params = self::DIRECT_DEBIT_PAYMENT_PARAMS; $response = self::DIRECT_DEBIT_PAYMENT_RESPONSE; $this->stubRequest( 'POST', '/direct_debits', $params, [], $response ); $result = DirectDebit::createDirectDebitPayment($params); $this->assertEquals($response, $result); } /** * Create direct debit payment test with headers * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsDirectDebitPaymentCreatableWithHeaders() { $params = array_merge( self::DIRECT_DEBIT_PAYMENT_PARAMS, array('for-user-id' => 'user-id') ); $response = self::DIRECT_DEBIT_PAYMENT_RESPONSE; $this->stubRequest( 'POST', '/direct_debits', $params, [], $response ); $result = DirectDebit::createDirectDebitPayment($params); $this->assertEquals($response, $result); } /** * Create direct debit payment test * Should throw InvalidArgumentException * * @return void * @throws Exceptions\ApiException */ public function testIsDirectDebitPaymentCreatableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); $params = self::DIRECT_DEBIT_PAYMENT_PARAMS; DirectDebit::createDirectDebitPayment($params); } /** * Validate OTP for direct debit payment * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsDirectDebitPaymentOTPValidatable() { $params = self::VALIDATED_DIRECT_DEBIT_PAYMENT_PARAMS; $response = self::VALIDATED_DIRECT_DEBIT_PAYMENT_RESPONSE; $this->stubRequest( 'POST', '/direct_debits/' . self::DIRECT_DEBIT_PAYMENT_ID . '/validate_otp/', $params, [], $response ); $result = DirectDebit::validateOTPForDirectDebitPayment( self::DIRECT_DEBIT_PAYMENT_ID, $params ); $this->assertEquals($response, $result); } /** * Validate OTP for direct debit payment test with headers * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsDirectDebitPaymentOTPValidatableWithHeaders() { $params = array_merge( self::VALIDATED_DIRECT_DEBIT_PAYMENT_PARAMS, array('for-user-id' => 'user-id') ); $response = self::VALIDATED_DIRECT_DEBIT_PAYMENT_RESPONSE; $this->stubRequest( 'POST', '/direct_debits/' . self::DIRECT_DEBIT_PAYMENT_ID . '/validate_otp/', $params, [], $response ); $result = DirectDebit::validateOTPForDirectDebitPayment( self::DIRECT_DEBIT_PAYMENT_ID, $params ); $this->assertEquals($response, $result); } /** * Validate OTP for direct debit payment test * Should throw ApiException * * @return void * @throws Exceptions\ApiException */ public function testIsDirectDebitPaymentValidatableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); $params = self::VALIDATED_DIRECT_DEBIT_PAYMENT_PARAMS; DirectDebit::validateOTPForDirectDebitPayment( self::DIRECT_DEBIT_PAYMENT_ID, $params ); } /** * Get direct debit payment test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsDirectDebitPaymentGettableByID() { $response = self::VALIDATED_DIRECT_DEBIT_PAYMENT_RESPONSE; $this->stubRequest( 'GET', '/direct_debits/' . self::DIRECT_DEBIT_PAYMENT_ID . '/', [], [], $response ); $result = DirectDebit::getDirectDebitPaymentByID( self::DIRECT_DEBIT_PAYMENT_ID ); $this->assertEquals($response, $result); } /** * Get direct debit payment test * Should throw ApiException * * @return void * @throws Exceptions\ApiException */ public function testIsDirectDebitPaymentGettableByIDThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); DirectDebit::getDirectDebitPaymentByID(self::DIRECT_DEBIT_PAYMENT_ID); } /** * Get direct debit payment test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsDirectDebitPaymentGettableByReferenceID() { $response = [self::VALIDATED_DIRECT_DEBIT_PAYMENT_RESPONSE]; $this->stubRequest( 'GET', '/direct_debits?reference_id=' . self::REFERENCE_ID, [], [], $response ); $result = DirectDebit::getDirectDebitPaymentByReferenceID( self::REFERENCE_ID ); $this->assertEquals($response, $result); } /** * Get direct debit payment test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsDirectDebitPaymentGettableByReferenceIDButNotFound() { $result = DirectDebit::getDirectDebitPaymentByReferenceID( self::REFERENCE_ID ); $this->assertEquals($result, []); } } PKZ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; use Xendit\Cards; use Xendit\TestCase; /** * Class CardsTest * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class CardsTest extends TestCase { const TOKEN_ID = "token123"; const AUTH_ID = "auth123"; const CHARGE_ID = "charge123"; /** * Create Charge test * Should pass * * @return void */ public function testIsCreatable() { $expected = [ 'token_id' => self::TOKEN_ID, 'external_id' => 'card_' . time(), 'authentication_id' => self::AUTH_ID, 'amount'=> 100000, 'card_cvn'=>'123', 'capture'=> false ]; $this->stubRequest( 'POST', '/credit_card_charges', $expected, [], $expected ); $result = Cards::create($expected); $this->assertEquals($result['token_id'], $expected['token_id']); $this->assertEquals($result['external_id'], $expected['external_id']); $this->assertEquals( $result['authentication_id'], $expected['authentication_id'] ); $this->assertEquals($result['amount'], $expected['amount']); $this->assertEquals($result['card_cvn'], $expected['card_cvn']); $this->assertEquals($result['capture'], $expected['capture']); } /** * Get Charge test * Should pass * * @return void */ public function testIsGettable() { $expected = [ 'token_id' => self::TOKEN_ID, 'authentication_id' => self::AUTH_ID, ]; $this->stubRequest( 'get', '/credit_card_charges/' . self::CHARGE_ID, [], [], $expected ); $result = Cards::retrieve( self::CHARGE_ID ); $this->assertEquals( $result['token_id'], self::TOKEN_ID ); $this->assertEquals( $result['authentication_id'], self::AUTH_ID ); } /** * Capture charge test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsCaptureable() { $expected = [ 'amount'=> 100000 ]; $this->stubRequest( 'POST', '/credit_card_charges/' . self::CHARGE_ID . '/capture', $expected, [], $expected ); $result = Cards::capture(self::CHARGE_ID, $expected); $this->assertEquals($result['amount'], $expected['amount']); } /** * Get refund charge test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsRefundable() { $expected = [ 'amount'=> 100000, 'external_id' => 'card_' . time(), ]; $this->stubRequest( 'POST', '/credit_card_charges/' . self::CHARGE_ID . '/refunds', $expected, [], $expected ); $result = Cards::createRefund(self::CHARGE_ID, $expected); $this->assertEquals($result['amount'], $expected['amount']); $this->assertEquals($result['external_id'], $expected['external_id']); } /** * Reverse charge test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIsReversable() { $expected = [ 'external_id' => 'card_' . time() ]; $this->stubRequest( 'POST', '/credit_card_charges/' . self::CHARGE_ID . '/auth_reversal', $expected, [], $expected ); $result = Cards::reverseAuthorization(self::CHARGE_ID, $expected); $this->assertEquals($result['external_id'], $expected['external_id']); } /** * Create Charge test * Should throw InvalidArgumentException * * @return void */ public function testIsCreatableThrowsException() { $expected = [ 'token_id' => self::TOKEN_ID ]; $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); $result = Cards::create($expected); } /** * Get Charge test * Should throw ApiException * * @return void */ public function testIsGettableThrowException() { $this->expectException(\Xendit\Exceptions\ApiException::class); Cards::retrieve(self::CHARGE_ID); } /** * Capture charge test * Should throw ApiException * * @return void * @throws Exceptions\ApiException */ public function testIsCaptureableThrowException() { $params = [ 'amount'=> 100000 ]; $this->expectException(\Xendit\Exceptions\ApiException::class); Cards::capture(self::CHARGE_ID, $params); } /** * Get refund charge test * Should throw ApiException * * @return void * @throws Exceptions\ApiException */ public function testIsRefundableThrowException() { $params = [ 'amount'=> 100000, 'external_id' => 'card_' . time(), ]; $this->expectException(\Xendit\Exceptions\ApiException::class); Cards::createRefund(self::CHARGE_ID, $params); } /** * Reverse charge test * Should throw ApiException * * @return void * @throws Exceptions\ApiException */ public function testIsReversableThrowException() { $params = [ 'external_id' => 'card_' . time() ]; $this->expectException(\Xendit\Exceptions\ApiException::class); Cards::reverseAuthorization(self::CHARGE_ID, $params); } } PKZViDD(xendit-php/tests/Xendit/PayLaterTest.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\PayLater; use Xendit\TestCase; /** * Class PayLaterTest * * @category Class * @package Xendit * @author Asoka Wotulo * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class PayLaterTest extends TestCase { public function testIsPayLaterPlanCreateable() { $params = [ 'customer_id' => '14b4bf47-b97a-4c13-bea9-5b1734a46fd1', 'channel_code' => 'ID_AKULAKU', 'currency' => 'IDR', 'amount' => 6000000, 'order_items' => [ [ 'type' => 'PHYSICAL_PRODUCT', 'reference_id' => '1533', 'name' => 'iPhone X - 64 GB - Space Gray', 'net_unit_amount' => 6000000, 'quantity' => 1, 'url' => 'https://jagofon.com/en/product/apple-iphone-x-64-gb-space-gray-1533', 'category' => 'Smartphone' ] ] ]; $response = [ 'id' => 'plp_5b980f6b-0e15-4134-8eb2-4c500b74a7d9', 'customer_id' => '14b4bf47-b97a-4c13-bea9-5b1734a46fd1', 'channel_code' => 'ID_AKULAKU', 'currency' => 'IDR', 'amount' => 6000000, 'order_items' => [ [ 'type' => 'PHYSICAL_PRODUCT', 'reference_id' => '1533', 'name' => 'iPhone X - 64 GB - Space Gray', 'net_unit_amount' => 6000000, 'quantity' => 1, 'url' => 'https://jagofon.com/en/product/apple-iphone-x-64-gb-space-gray-1533', 'category' => 'Smartphone' ] ], 'options' => [ [ 'interval' => 'MONTH', 'interval_count' => 1, 'total_recurrence' => 1, 'total_amount' => 6212000, 'installment_amount' => 6212000, 'downpayment_amount' => 0, 'interest_rate' => 0, 'description' => '1 month' ], [ 'interval' => 'MONTH', 'interval_count' => 1, 'total_recurrence' => 2, 'total_amount' => 6374000, 'installment_amount' => 3187000, 'downpayment_amount' => 0, 'interest_rate' => 0, 'description' => '2 months' ], [ 'interval' => 'MONTH', 'interval_count' => 1, 'total_recurrence' => 3, 'total_amount' => 6546000, 'installment_amount' => 2182000, 'downpayment_amount' => 0, 'interest_rate' => 0, 'description' => '3 months' ] ], 'created' => '2021-10-08T10:08:38.032Z', ]; $this->stubRequest( 'POST', '/paylater/plans', $params, [], $response, ); $result = PayLater::initiatePayLaterPlans($params); $this->assertArrayHasKey('id', $result); $this->assertArrayHasKey('created', $result); $this->assertIsArray($result['options']); $this->assertEquals($params['order_items'], $result['order_items']); $this->assertEquals($params['customer_id'], $result['customer_id']); $this->assertEquals($params['channel_code'], $result['channel_code']); $this->assertEquals($params['currency'], $result['currency']); $this->assertEquals($params['amount'], $result['amount']); } public function testIsPayLaterPlanCreateableThrowInvalidArgumentException() { $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); $params = []; PayLater::initiatePayLaterPlans($params); } public function testIsPayLaterPlanCreateableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); $params = [ "customer_id" => "14b4bf47-b97a-4c13-bea9-5b1734a46fd1", "channel_code" => "ID_KREDIVO", "currency" => "IDR", "amount" => 6000000, "order_items" => [ [ "type" => "PHYSICAL_PRODUCT", "reference_id" => "1533", "name" => "iPhone X - 64 GB - Space Gray", "net_unit_amount" => 6000000, "quantity" => 1, "url" => "https://jagofon.com/en/product/apple-iphone-x-64-gb-space-gray-1533", "category" => "Smartphone" ] ] ]; PayLater::initiatePayLaterPlans($params); } public function testIsPayLaterChargeCreateable() { $params = [ 'plan_id' => 'plp_f7e93093-b949-4ccf-8be8-ea6abdab6149', 'reference_id' => 'order_id_234', 'checkout_method' => 'ONE_TIME_PAYMENT', 'success_redirect_url' => 'https://google.com', 'failure_redirect_url' => 'https://twitter.com', ]; $response = [ 'id' => 'plc_6606beb5-66ac-4165-be4b-e24c589fe01f', 'business_id' => '603f1c4172bbe840979fd408', 'reference_id' => 'order_id_234', 'customer_id' => 'f1172e79-1c9a-4e67-a177-de1bf4c90108', 'plan_id' => 'plp_f7e93093-b949-4ccf-8be8-ea6abdab6149', 'currency' => 'IDR', 'amount' => 10000, 'channel_code' => 'ID_AKULAKU', 'checkout_method' => 'ONE_TIME_PAYMENT', 'status' => 'PENDING', 'actions' => [ 'desktop_web_checkout_url' => 'https://paylater-mock-connector-dev.xendit.co/checkout?charge_id=6606beb5-66ac-4165-be4b-e24c589fe01f&connector_reference_id=ee0bad99-ce1a-44b5-b6ef-f838ce87bdf1&business_id=603f1c4172bbe840979fd408', 'mobile_web_checkout_url' => 'https://paylater-mock-connector-dev.xendit.co/checkout?charge_id=6606beb5-66ac-4165-be4b-e24c589fe01f&connector_reference_id=ee0bad99-ce1a-44b5-b6ef-f838ce87bdf1&business_id=603f1c4172bbe840979fd408' ], 'success_redirect_url' => 'https://google.com', 'failure_redirect_url' => 'https://twitter.com', 'callback_url' => 'https://webhook.site/d4478770-60be-4556-a8e5-f0d929e1f8cb', 'created' => '2021-10-08T05:00:31.413Z', 'updated' => '2021-10-08T05:00:31.545Z', 'order_items' => [ [ "type" => "PHYSICAL_PRODUCT", "reference_id" => "1533", "name" => "iPhone X - 64 GB - Space Gray", "net_unit_amount" => 6000000, "quantity" => 1, "url" => "https://jagofon.com/en/product/apple-iphone-x-64-gb-space-gray-1533", "category" => "Smartphone" ] ], 'voided_at' => null, 'payment_method_id' => null, 'metadata' => null, 'channel_reference' => 'ee0bad99-ce1a-44b5-b6ef-f838ce87bdf1' ]; $this->stubRequest( 'POST', '/paylater/charges', $params, [], $response, ); $result = PayLater::createPayLaterCharge($params); $this->assertArrayHasKey('id', $result); $this->assertEquals( $params['plan_id'], $result['plan_id'] ); $this->assertEquals( $params['reference_id'], $result['reference_id'] ); $this->assertEquals( $params['checkout_method'], $result['checkout_method'] ); $this->assertEquals( $params['success_redirect_url'], $result['success_redirect_url'] ); $this->assertEquals( $params['failure_redirect_url'], $result['failure_redirect_url'] ); } public function testIsPayLaterChargeCreateableThrowInvalidArgumentException() { $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); $params = []; PayLater::createPayLaterCharge($params); } public function testIsPayLaterChargeCreateableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); $params = [ 'plan_id' => '', 'reference_id' => '', 'checkout_method' => '', 'success_redirect_url' => '', ]; PayLater::createPayLaterCharge($params); } public function testIsGetPayLaterChargeStatusGettable() { $params = []; $id = 'plc_6606beb5-66ac-4165-be4b-e24c589fe01f'; $response = [ 'id' => 'plc_6606beb5-66ac-4165-be4b-e24c589fe01f', 'business_id' => '603f1c4172bbe840979fd408', 'reference_id' => 'order_id_234', 'customer_id' => 'f1172e79-1c9a-4e67-a177-de1bf4c90108', 'plan_id' => 'plp_f7e93093-b949-4ccf-8be8-ea6abdab6149', 'currency' => 'IDR', 'amount' => 10000, 'channel_code' => 'ID_AKULAKU', 'checkout_method' => 'ONE_TIME_PAYMENT', 'status' => 'PENDING', 'actions' => [ 'desktop_web_checkout_url' => 'https://paylater-mock-connector-dev.xendit.co/checkout?charge_id=6606beb5-66ac-4165-be4b-e24c589fe01f&connector_reference_id=ee0bad99-ce1a-44b5-b6ef-f838ce87bdf1&business_id=603f1c4172bbe840979fd408', 'mobile_web_checkout_url' => 'https://paylater-mock-connector-dev.xendit.co/checkout?charge_id=6606beb5-66ac-4165-be4b-e24c589fe01f&connector_reference_id=ee0bad99-ce1a-44b5-b6ef-f838ce87bdf1&business_id=603f1c4172bbe840979fd408' ], 'success_redirect_url' => 'https://google.com', 'failure_redirect_url' => 'https://twitter.com', 'callback_url' => 'https://webhook.site/d4478770-60be-4556-a8e5-f0d929e1f8cb', 'created' => '2021-10-08T05:00:31.413Z', 'updated' => '2021-10-08T05:00:31.545Z', 'order_items' => [ [ "type" => "PHYSICAL_PRODUCT", "reference_id" => "1533", "name" => "iPhone X - 64 GB - Space Gray", "net_unit_amount" => 6000000, "quantity" => 1, "url" => "https://jagofon.com/en/product/apple-iphone-x-64-gb-space-gray-1533", "category" => "Smartphone" ] ], 'voided_at' => null, 'payment_method_id' => null, 'metadata' => null, 'channel_reference' => 'ee0bad99-ce1a-44b5-b6ef-f838ce87bdf1' ]; $this->stubRequest( 'GET', '/paylater/charges/'.$id, $params, [], $response, ); $result = PayLater::getPayLaterChargeStatus($id, $params); $this->assertArrayHasKey('id', $result); $this->assertEquals( 'plp_f7e93093-b949-4ccf-8be8-ea6abdab6149', $result['plan_id'] ); $this->assertEquals( 'order_id_234', $result['reference_id'] ); $this->assertEquals( 'ONE_TIME_PAYMENT', $result['checkout_method'] ); $this->assertEquals( 'https://google.com', $result['success_redirect_url'] ); $this->assertEquals( 'https://twitter.com', $result['failure_redirect_url'] ); } public function testIsGetPayLaterChargeStatusGettableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); $params = []; $id = 'test'; PayLater::getPayLaterChargeStatus($id, $params); } public function testCreatePayLaterRefundCreateable() { $params = [ 'amount' => 1234.56, 'reason' => 'UNFULFILLED_ITEM' ]; $id = 'plc_8cb12305-9bcf-4441-a087-ee0d446e297b'; $response = [ 'id' => 'plr_2f2aa47f-2764-4b42-8712-c3fb1270b09e', 'charge_id' => 'plc_8cb12305-9bcf-4441-a087-ee0d446e297b', 'channel_code' => 'ID_AKULAKU', 'amount' => 1234.56, 'reason' => 'UNFULFILLED_ITEM', 'status' => 'PENDING', 'created' => '2021-04-20T16:23:52Z', 'updated' => null ]; $this->stubRequest( 'POST', '/paylater/charges/'.$id.'/refunds', $params, [], $response, ); $result = PayLater::createPayLaterRefund($id, $params); $this->assertArrayHasKey('id', $result); $this->assertEquals( 'plr_2f2aa47f-2764-4b42-8712-c3fb1270b09e', $result['id'] ); $this->assertEquals( 'plc_8cb12305-9bcf-4441-a087-ee0d446e297b', $result['charge_id'] ); $this->assertEquals( 'ID_AKULAKU', $result['channel_code'] ); $this->assertEquals( 1234.56, $result['amount'] ); $this->assertEquals( 'UNFULFILLED_ITEM', $result['reason'] ); $this->assertEquals( 'PENDING', $result['status'] ); } public function testIsCreatePayLaterRefundCreateableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); $params = []; $id = 'test'; PayLater::createPayLaterRefund($id, $params); } public function testIsGetPayLaterRefundGettable() { $params = []; $charge_id = 'plc_6606beb5-66ac-4165-be4b-e24c589fe01f'; $refund_id = 'plr_2f2aa47f-2764-4b42-8712-c3fb1270b09e'; $response = [ 'id' => 'plr_2f2aa47f-2764-4b42-8712-c3fb1270b09e', 'charge_id' => 'plc_8cb12305-9bcf-4441-a087-ee0d446e297b', 'channel_code' => 'ID_AKULAKU', 'amount' => 1234.56, 'reason' => 'UNFULFILLED_ITEM', 'status' => 'PENDING', 'created' => '2021-04-20T16:23:52Z', 'updated' => null ]; $this->stubRequest( 'GET', '/paylater/charges/'.$charge_id.'/refunds/'.$refund_id, $params, [], $response, ); $result = PayLater::getPayLaterRefund($charge_id, $refund_id, $params); $this->assertArrayHasKey('id', $result); $this->assertEquals( 'plr_2f2aa47f-2764-4b42-8712-c3fb1270b09e', $result['id'] ); $this->assertEquals( 'plc_8cb12305-9bcf-4441-a087-ee0d446e297b', $result['charge_id'] ); $this->assertEquals( 'ID_AKULAKU', $result['channel_code'] ); $this->assertEquals( 1234.56, $result['amount'] ); $this->assertEquals( 'UNFULFILLED_ITEM', $result['reason'] ); $this->assertEquals( 'PENDING', $result['status'] ); } public function testIsGetPayLaterRefundGettableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); $params = []; $charge_id = 'test'; $refund_id = 'test'; PayLater::getPayLaterRefund($charge_id, $refund_id, $params); } /** * Get list of transactions test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testListPayLaterRefundIsGettable() { $expectedResponse = [ 'has_more' => false ]; $charge_id = 'plc_6606beb5-66ac-4165-be4b-e24c589fe01f'; $this->stubRequest( 'GET', '/paylater/charges/'.$charge_id.'/refunds/', [], [], $expectedResponse ); $result = PayLater::listPayLaterRefund($charge_id); $this->assertEquals($result['has_more'], $expectedResponse['has_more']); } /** * Get list of transactions test * Should throw ApiException * * @return void */ public function testListPayLaterRefundIsGettableThrowsException() { $this->expectException(\Xendit\Exceptions\ApiException::class); $charge_id = 'plc_6606beb5-66ac-4165-be4b-e24c589fe01f'; PayLater::listPayLaterRefund($charge_id); } /** * Get detail of transactions test * Should throw ApiException * * @return void */ } PKZ?Em 'xendit-php/tests/Xendit/PayoutsTest.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Payouts; use Xendit\TestCase; /** * Class PayoutsTest * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class PayoutsTest extends TestCase { const TEST_ID = "TEST-123"; /** * Create Payout test * Should pass * * @return void */ public function testIsCreatable() { $params = [ 'external_id'=> 'payouts-123456789', 'amount'=> 50000, 'email'=> 'demo@xendit.co', ]; $this->stubRequest( 'POST', '/payouts', $params, [], $params ); $result = Payouts::create($params); $this->assertEquals($result['external_id'], $params['external_id']); $this->assertEquals($result['amount'], $params['amount']); $this->assertEquals($result['email'], $params['email']); } /** * Get Payout test * Should pass * * @return void */ public function testIsGettable() { $params = [ 'external_id'=> 'payouts-123456789', 'amount'=> 50000 ]; $this->stubRequest( 'GET', '/payouts/' . self::TEST_ID, [], [], $params ); $result = Payouts::retrieve(self::TEST_ID); $this->assertEquals($result['external_id'], $params['external_id']); $this->assertEquals($result['amount'], $params['amount']); } /** * Void Payout test * Should pass * * @return void * @throws \Xendit\Exceptions\ApiException */ public function testIsVoidable() { $this->stubRequest( 'POST', '/payouts/' . self::TEST_ID . '/void', [], [], [ 'id' => self::TEST_ID ] ); $result = Payouts::void(self::TEST_ID); $this->assertEquals($result['id'], self::TEST_ID); } /** * Create Payout test * Should throw InvalidArgumentException * * @return void */ public function testIsCreatableThrowInvalidArgumentException() { $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); $params = [ 'external_id' => 'demo_147580196270' ]; Payouts::create($params); } /** * Get Payout test * Should throw ApiException * * @return void */ public function testIsGettableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); Payouts::retrieve(self::TEST_ID); } /** * Void Payout test * Should throw * * @return void * @throws \Xendit\Exceptions\ApiException */ public function testIsVoidableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); Payouts::void(self::TEST_ID); } } PKZt|N  .xendit-php/tests/Xendit/VirtualAccountTest.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\VirtualAccounts; use Xendit\TestCase; /** * Class VirtualAccountTest * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class VirtualAccountTest extends TestCase { const TEST_RESOURCE_ID = "123"; /** * Create VA test * Should pass * * @return void */ public function testIsCreatable() { $params = [ 'external_id' => 'VA_fixed-12341234', 'bank_code' => 'MANDIRI', 'name' => 'Steve Wozniak' ]; $this->stubRequest( 'POST', '/callback_virtual_accounts', $params, [], $params ); $resource = VirtualAccounts::create($params); $this->assertEquals($resource['external_id'], $params['external_id']); $this->assertEquals($resource['bank_code'], $params['bank_code']); $this->assertEquals($resource['name'], $params['name']); } /** * Get VirtualAccountBanks test * Should pass * * @return void * @throws \Xendit\Exceptions\ApiException */ public function testVABanksIsGettable() { $expectedResponse = [[ 'name' => 'Bank Mandiri', 'code' => 'MANDIRI' ]]; $this->stubRequest( 'GET', '/available_virtual_account_banks', [], [], $expectedResponse ); $resource = VirtualAccounts::getVABanks(); $this->assertEquals($resource[0]['name'], $expectedResponse[0]['name']); $this->assertEquals($resource[0]['code'], $expectedResponse[0]['code']); } /** * Get VirtualAccount test * Should pass * * @return void */ public function testVAIsGettable() { $this->stubRequest( 'GET', '/callback_virtual_accounts/'.self::TEST_RESOURCE_ID, [], [], [ 'id' => self::TEST_RESOURCE_ID ] ); $resource = VirtualAccounts::retrieve(self::TEST_RESOURCE_ID); $this->assertEquals($resource['id'], self::TEST_RESOURCE_ID); } /** * Update VA test * Should pass * * @return void */ public function testIsUpdateable() { $params = [ 'suggested_amount' => 10000 ]; $this->stubRequest( 'PATCH', '/callback_virtual_accounts/'.self::TEST_RESOURCE_ID, $params, [], [ 'id' => self::TEST_RESOURCE_ID, 'suggested_amount' => 10000 ] ); $resource = VirtualAccounts::update(self::TEST_RESOURCE_ID, $params); $this->assertEquals($resource['id'], self::TEST_RESOURCE_ID); } /** * Get FVA Payment test * Should pass * * @return void * @throws \Xendit\Exceptions\ApiException */ public function testIsGettableFVAPayment() { $this->stubRequest( 'GET', '/callback_virtual_account_payments/payment_id='.self::TEST_RESOURCE_ID, [], [], [ 'id' => self::TEST_RESOURCE_ID ] ); $resource = VirtualAccounts::getFVAPayment(self::TEST_RESOURCE_ID); $this->assertEquals($resource['id'], self::TEST_RESOURCE_ID); } /** * Create VirtualAccount test * Should throw InvalidArgumentException * * @return void */ public function testIsCreatableThrowInvalidArgumentException() { $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); $params = [ 'external_id' => 'demo_147580196270' ]; VirtualAccounts::create($params); } /** * Get VirtualAccount test * Should throw ApiException * * @return void */ public function testIsVAGettableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); VirtualAccounts::retrieve(self::TEST_RESOURCE_ID); } /** * Create VirtualAccount test * Should throw * * @return void */ public function testIsUpdateableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); VirtualAccounts::update(self::TEST_RESOURCE_ID); } /** * Get FVAPayment test * Should throw ApiException * * @return void * @throws \Xendit\Exceptions\ApiException */ public function testIsFVAPaymentGettableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); VirtualAccounts::getFVAPayment(self::TEST_RESOURCE_ID); } } PKZ7߈88)xendit-php/tests/Xendit/CustomersTest.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; use Xendit\Customers; use Xendit\TestCase; /** * Class CustomersTest * * @category Class * @package Xendit * @author Glenda * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class CustomersTest extends TestCase { const CUSTOMER_PARAMS_20200519 = [ 'reference_id' => 'test-ref-id', 'given_names' => 'customer 1', 'email' => 'customer@website.com', 'mobile_number' => '+6281212345678', 'description' => 'dummy customer', 'middle_name' => 'middle', 'surname' => 'surname', 'addresses' => [ [ 'country' => 'ID', 'street_line1' => 'Jl. 123', 'street_line2' => 'Jl. 456', 'city' => 'Jakarta Selatan', 'province' => 'DKI Jakarta', 'state' => '-', 'postal_code' => '12345' ] ], 'metadata' => [ 'meta' => 'data' ] ]; const CUSTOMER_RESPONSE_20200519 = [ 'id' => '0f2de6f1-2023-403b-aaea-5f0a8a611f7d', 'reference_id' => 'test-ref-id', 'given_names' => 'customer 1', 'email' => 'customer@website.com', 'mobile_number' => '+6281212345678', 'description' => 'dummy customer', 'middle_name' => 'middle', 'surname' => 'surname', 'phone_number' => null, 'nationality' => null, 'date_of_birth' => null, 'metadata' => [ 'meta' => 'data' ], 'employment' => null, 'addresses' => [ [ 'category' => '', 'country' => 'ID', 'state' => '-', 'province' => 'DKI Jakarta', 'city' => 'Jakarta Selatan', 'postal_code' => '12345', 'street_line1' => 'Jl. 123', 'street_line2' => 'Jl. 456', 'is_preferred' => false ] ], 'source_of_wealth' => null ]; const CUSTOMER_PARAMS_20201031 = [ 'reference_id' => 'test-ref-id', 'type' => 'INDIVIDUAL', 'email' => 'customer@website.com', 'mobile_number' => '+6281212345678', 'phone_number' => '+6289987654321', 'description' => 'test description', 'kyc_documents' => [ [ 'country' => 'ID', 'type' => 'IDENTITY_CARD', 'sub_type' => 'NATIONAL_ID', 'document_name' => 'KTP', 'document_number' => '1234567890', 'expires_at' => '2025-06-02', 'holder_name' => 'Holder name', 'document_images' => [ 'https://file1.jpg', 'https://file2.jpg' ] ] ], 'metadata' => [ 'meta' => 'data' ], 'individual_detail' => [ 'given_names' => 'John', 'surname' => 'Doe', 'nationality' => 'ID', 'date_of_birth' => '1993-12-26', 'place_of_birth' => 'Cirebon', 'gender' => 'MALE', 'employment' => [ 'employer_name' => 'Employer name', 'nature_of_business' => 'Business', 'role_description' => 'Employer' ] ], 'business_detail' => [ 'business_name' => 'Business name', 'business_type' => 'NON_PROFIT', 'nature_of_business' => 'Charity', 'business_domicile' => 'ID', 'date_of_registration' => '2005-06-21' ], 'addresses' => [ [ 'country' => 'ID', 'street_line1' => 'street line 1', 'street_line2' => 'street line 2', 'city' => 'Cirebon', 'province_state' => 'Jawa Barat', 'postal_code' => '21345', 'category' => 'HOME', 'is_primary' => true ] ], 'identity_accounts' => [ [ 'type' => 'EWALLET', 'company' => 'GOPAY', 'description' => 'gopay', 'country' => 'ID', 'properties' => [ 'account_number' => '12345', 'account_holder_name' => 'John Doe', 'currency' => 'IDR' ] ] ] ]; const CUSTOMER_RESPONSE_20201031 = [ 'type' => 'INDIVIDUAL', 'email' => 'customer@website.com', 'mobile_number' => '+6281212345678', 'phone_number' => '+6289987654321', 'created' => '2021-08-13T12:42:19.476Z', 'updated' => '2021-08-13T12:42:19.476Z', 'description' => 'test description', 'kyc_documents' => [ [ 'country' => 'ID', 'type' => 'IDENTITY_CARD', 'sub_type' => 'NATIONAL_ID', 'document_name' => 'KTP', 'document_number' => '1234567890', 'expires_at' => '2025-06-02', 'holder_name' => 'Holder name', 'document_images' => [ 'https://file1.jpg', 'https://file2.jpg' ] ] ], 'id' => 'cust-db2b4ac3-518b-41bd-873a-4a64f7e18610', 'reference_id' => 'test-ref-id', 'metadata' => [ 'meta' => 'data' ], 'individual_detail' => [ 'given_names' => 'John', 'surname' => 'Doe', 'nationality' => 'ID', 'date_of_birth' => '1993-12-26', 'place_of_birth' => 'Cirebon', 'gender' => 'MALE', 'employment' => [ 'employer_name' => 'Employer name', 'role_description' => 'Employer', 'nature_of_business' => 'Business' ] ], 'business_detail' => null, 'addresses' => [ [ 'country' => 'ID', 'street_line1' => 'street line 1', 'street_line2' => 'street line 2', 'city' => 'Cirebon', 'province_state' => 'Jawa Barat', 'postal_code' => '21345', 'category' => 'HOME', 'is_primary' => true ] ], 'identity_accounts' => [ [ 'type' => 'EWALLET', 'company' => 'GOPAY', 'description' => 'gopay', 'country' => 'ID', 'properties' => [ 'currency' => 'IDR', 'account_number' => '12345', 'account_holder_name' => 'John Doe' ] ] ] ]; const REFERENCE_ID = 'test-ref-id'; const NEW_API_VERSION = array('api-version' => '2020-10-31'); /** * Create customer test 2020-05-19 version * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIs20200519CustomerCreatable() { $params = self::CUSTOMER_PARAMS_20200519; $response = self::CUSTOMER_RESPONSE_20200519; $this->stubRequest( 'POST', '/customers', $params, [], $response ); $result = Customers::createCustomer($params); $this->assertEquals($response, $result); } /** * Create customer test with mobile_number missing 2020-05-19 version * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIs20200519CustomerCreatableWithMobileNumberMissing() { $params = self::CUSTOMER_PARAMS_20200519; unset($params['mobile_number']); $response = self::CUSTOMER_RESPONSE_20200519; $response['mobile_number'] = null; $this->stubRequest( 'POST', '/customers', $params, [], $response ); $result = Customers::createCustomer($params); $this->assertEquals($response, $result); } /** * Create customer test with email missing 2020-05-19 version * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIs20200519CustomerCreatableWithEmailMissing() { $params = self::CUSTOMER_PARAMS_20200519; unset($params['email']); $response = self::CUSTOMER_RESPONSE_20200519; $response['email'] = null; $this->stubRequest( 'POST', '/customers', $params, [], $response ); $result = Customers::createCustomer($params); $this->assertEquals($response, $result); } /** * Create customer test with headers 2020-05-19 version * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIs20200519CustomerCreatableWithHeaders() { $params = array_merge( self::CUSTOMER_PARAMS_20200519, array('for-user-id' => 'user-id') ); $response = self::CUSTOMER_RESPONSE_20200519; $this->stubRequest( 'POST', '/customers', $params, [], $response ); $result = Customers::createCustomer($params); $this->assertEquals($response, $result); } /** * Create customer test 2020-05-19 version * Should throw InvalidArgumentException * * @return void * @throws Exceptions\ApiException */ public function testIs20200519CustomerCreatableThrowInvalidArgumentException() { $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); $params = [ 'reference_id' => self::REFERENCE_ID ]; Customers::createCustomer($params); } /** * Get customer test 2020-05-19 version * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIs20200519CustomerGettable() { $response = [self::CUSTOMER_RESPONSE_20200519]; $this->stubRequest( 'get', '/customers?reference_id=' . self::REFERENCE_ID, [], [], $response ); $result = Customers::getCustomerByReferenceID( self::REFERENCE_ID ); $this->assertEquals($response, $result); } /** * Get customer test 2020-05-19 version * Should throw ApiException * * @return void * @throws Exceptions\ApiException */ public function testIs20200519CustomerGettableThrowApiException() { $response = Customers::getCustomerByReferenceID( self::REFERENCE_ID ); $this->assertEquals($response, []); } /** * Create customer test 2020-10-31 version * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIs20201031CustomerCreatable() { $params = self::CUSTOMER_PARAMS_20201031; $response = self::CUSTOMER_RESPONSE_20201031; $this->stubRequest( 'POST', '/customers', $params, self::NEW_API_VERSION, $response ); $params = array_merge( $params, self::NEW_API_VERSION ); $result = Customers::createCustomer($params); $this->assertEquals($response, $result); } /** * Create customer test with headers 2020-10-31 version * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIs20201031CustomerCreatableWithHeaders() { $params = array_merge( self::CUSTOMER_PARAMS_20201031, array('for-user-id' => 'user-id') ); $response = self::CUSTOMER_RESPONSE_20201031; $this->stubRequest( 'POST', '/customers', $params, self::NEW_API_VERSION, $response ); $params = array_merge( $params, self::NEW_API_VERSION ); $result = Customers::createCustomer($params); $this->assertEquals($response, $result); } /** * Create customer test 2020-10-31 version * Should throw InvalidArgumentException * * @return void * @throws Exceptions\ApiException */ public function testIs20201031CustomerCreatableThrowInvalidArgumentException() { $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); $params = [ 'reference_id' => self::REFERENCE_ID, 'api-version' => '2020-10-31' ]; Customers::createCustomer($params); } /** * Get customer test 2020-10-31 version * Should pass * * @return void * @throws Exceptions\ApiException */ public function testIs20201031CustomerGettable() { $response = [self::CUSTOMER_RESPONSE_20201031]; $this->stubRequest( 'get', '/customers?reference_id=' . self::REFERENCE_ID, [], self::NEW_API_VERSION, $response ); $result = Customers::getCustomerByReferenceID( self::REFERENCE_ID, self::NEW_API_VERSION ); $this->assertEquals($response, $result); } /** * Get customer test 2020-10-31 version * Should throw ApiException * * @return void * @throws Exceptions\ApiException */ public function testIs20201031CustomerGettableThrowApiException() { $response = [ 'data' => [], 'has_more' => false ]; $result = Customers::getCustomerByReferenceID( self::REFERENCE_ID, self::NEW_API_VERSION ); $this->assertEquals($response, $result); } } PKZyC C &xendit-php/tests/Xendit/ReportTest.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; use Xendit\Report; use Xendit\TestCase; /** * Class ReportTest * * @category Class * @package Xendit * @author David * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class ReportTest extends TestCase { /** * Generate report test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testReportIsCreatetable() { $expectedResponse = [ 'type' => 'TRANSACTIONS' ]; $this->stubRequest( 'POST', '/reports', $expectedResponse, [], $expectedResponse ); $result = Report::generate($expectedResponse); $this->assertEquals($result['type'], $expectedResponse['type']); } /** * Get detail of report test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testDetailIsGettable() { $expectedResponse = [ 'id' => 'report_5c1b34a2-6ceb-4c24-aba9-c836bac82b28' ]; $this->stubRequest( 'GET', '/reports/report_5c1b34a2-6ceb-4c24-aba9-c836bac82b28', [], [], $expectedResponse ); $result = Report::detail('report_5c1b34a2-6ceb-4c24-aba9-c836bac82b28'); $this->assertEquals($result['id'], $expectedResponse['id']); } /** * Generate report test * Should throw InvalidArgumentException * * @return void */ public function testReportIsCreatetableThrowsException() { $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); Report::generate(); } /** * Get detail of report test * Should throw ApiException * * @return void */ public function testDetailIsGettableThrowsException() { $this->expectException(\Xendit\Exceptions\ApiException::class); Report::detail('report_5c1b34a2-6ceb-4c24-aba9-c836bac82b28'); } } PKZF$$+xendit-php/tests/Xendit/TransactionTest.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; use Xendit\Transaction; use Xendit\TestCase; /** * Class TransactionTest * * @category Class * @package Xendit * @author David * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class TransactionTest extends TestCase { /** * Get list of transactions test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testListIsGettable() { $expectedResponse = [ 'has_more' => false ]; $this->stubRequest( 'GET', '/transactions', [], [], $expectedResponse ); $result = Transaction::list(); $this->assertEquals($result['has_more'], $expectedResponse['has_more']); } /** * Get detail of transactions test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testDetailIsGettable() { $expectedResponse = [ 'id' => 'txn_4b401a5f-47b1-4aab-8136-f7c4440d571f' ]; $this->stubRequest( 'GET', '/transactions/txn_4b401a5f-47b1-4aab-8136-f7c4440d571f', [], [], $expectedResponse ); $result = Transaction::detail('txn_4b401a5f-47b1-4aab-8136-f7c4440d571f'); $this->assertEquals($result['id'], $expectedResponse['id']); } /** * Get detail of transactions test * Should throw ApiException * * @return void */ public function testDetailIsGettableThrowsException() { $this->expectException(\Xendit\Exceptions\ApiException::class); Transaction::detail('txn_4b401a5f-47b1-4aab-8136-f7c4440d571f'); } } PKZL &xendit-php/tests/Xendit/RetailTest.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Retail; use Xendit\TestCase; /** * Class RetailTest * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class RetailTest extends TestCase { const TEST_ID = "TEST-123"; /** * Create FPC test * Should pass * * @return void */ public function testIsCreatable() { $params = [ 'external_id'=> 'TEST-123456789', 'retail_outlet_name'=> 'ALFAMART', 'name'=> 'JOHN DOE', 'expected_amount'=> 25000 ]; $this->stubRequest( 'POST', '/fixed_payment_code', $params, [], $params ); $result = Retail::create($params); $this->assertEquals($result['external_id'], $params['external_id']); $this->assertEquals( $result['retail_outlet_name'], $params['retail_outlet_name'] ); $this->assertEquals($result['name'], $params['name']); $this->assertEquals( $result['expected_amount'], $params['expected_amount'] ); } /** * Get FPC test * Should pass * * @return void */ public function testIsGettable() { $this->stubRequest( 'GET', '/fixed_payment_code/'.self::TEST_ID, [], [], [ 'id' => self::TEST_ID ] ); $result = Retail::retrieve(self::TEST_ID); $this->assertEquals($result['id'], self::TEST_ID); } /** * Update FPC test * Should pass * * @return void */ public function testIsUpdateable() { $params = [ 'expected_amount' => 20000 ]; $this->stubRequest( 'PATCH', '/fixed_payment_code/'.self::TEST_ID, $params, [], [ 'id' => self::TEST_ID, 'suggested_amount' => 20000 ] ); $result = Retail::update(self::TEST_ID, $params); $this->assertEquals($result['id'], self::TEST_ID); } /** * Create FPC test * Should throw InvalidArgumentException * * @return void */ public function testIsCreatableThrowInvalidArgumentException() { $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); $params = [ 'external_id' => 'demo_147580196270' ]; Retail::create($params); } /** * Get FPC test * Should throw ApiException * * @return void */ public function testIsGettableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); Retail::retrieve(self::TEST_ID); } /** * Update FPC test * Should throw * * @return void */ public function testIsUpdateableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); $params = ['suggested_amount' => 10000]; Retail::update(self::TEST_ID, $params); } } PKZ>=||/xendit-php/tests/Xendit/PaymentChannelsTest.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; use Xendit\PaymentChannels; use Xendit\TestCase; /** * Class PaymentChannelsTest * * @category Class * @package Xendit * @author David * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class PaymentChannelsTest extends TestCase { /** * Get list of payment channel test * Should pass * * @return void * @throws Exceptions\ApiException */ public function testListIsGettable() { $expectedResponse = [ 'channel_code' => false ]; $this->stubRequest( 'GET', '/payment_channels', [], [], $expectedResponse ); $result = PaymentChannels::list(); $this->assertEquals($result['channel_code'], $expectedResponse['channel_code']); } } PKZk%]]xendit-php/tests/TestCase.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; /** * Class TestCase * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class TestCase extends \PHPUnit\Framework\TestCase { protected $oriApiBase; protected $oriApiKey; protected $oriApiVersion; protected $clientMock; /** * Setting up PHPUnit * * @return void */ protected function setUp(): void { $this->oriApiBase = Xendit::$apiBase; $this->oriApiKey = 'xnd_development_prHUBDfVuOQTxyWTQSNkpj' . 'n9OwX9ZSUjdqgF9GenZ6hwhUQkc3NZ9WVexdH'; $this->oriApiVersion = Xendit::getLibVersion(); $this->clientMock = $this->createMock('\Xendit\HttpClient\ClientInterface'); ApiRequestor::setHttpClient(HttpClient\GuzzleClient::instance()); } /** * Restore original values after tests * * @return void */ protected function tearDown(): void { Xendit::$apiBase = $this->oriApiBase; Xendit::setApiKey($this->oriApiKey); Xendit::$libVersion = $this->oriApiVersion; } /** * Request expectations * * @param string $method HTTP method * @param string $path relative url * @param array $params user params * @param array $headers request headers * @return void */ protected function expectsRequest( $method, $path, $params = [], $headers = [] ) { $this->_prepareRequestMock($method, $path, $params, $headers) ->will( $this->returnCallback( function ($method, $url, $headers, $params) { $guzzleClient = HttpClient\GuzzleClient::instance(); ApiRequestor::setHttpClient($guzzleClient); return $guzzleClient->sendRequest( $method, $url, $headers, $params ); } ) ); } /** * Set up request expectations without actually being emitted * * @param string $method HTTP method * @param string $path relative url * @param array $params user params * @param array $headers request headers * @param array $response response * @param int $rcode response code * * @return void */ protected function stubRequest( $method, $path, $params = [], $headers = [], $response = [], $rcode = 200 ) { $this->_prepareRequestMock($method, $path, $params, $headers) ->willReturn([json_encode($response), $rcode, []]); } /** * Prepares client mocker * * @param string $method HTTP method * @param string $path relative path * @param array $params user params * @param array $headers request headers * * @return \PHPUnit\Framework\MockObject\Builder\InvocationMocker */ private function _prepareRequestMock($method, $path, $params, $headers) { ApiRequestor::setHttpClient($this->clientMock); Xendit::setApiKey( <<clientMock ->expects($this->once()) ->method('sendRequest') ->with( $this->identicalTo(strtoupper($method)), $this->identicalTo($url), $headers === [] ? $this->anything() : $this->callback( function ($array) use ($headers) { foreach ($headers as $header) { if (!in_array($header, $array)) { return false; } } return true; } ), $params === [] ? $this->anything() : $this->identicalTo($params) ); } } PKZmLL xendit-php/src/Disbursements.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; /** * Class Disbursements * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class Disbursements { use ApiOperations\Request; use ApiOperations\Create; use ApiOperations\Retrieve; /** * Instantiate base URL * * @return string */ public static function classUrl() { return '/disbursements'; } /** * Instantiate required params for Create * * @return array */ public static function createReqParams() { return [ 'external_id', 'bank_code', 'account_holder_name', 'account_number', 'description', 'amount' ]; } /** * Send a create batch request * * @param array $params user's params * * @return array[ * 'created'=> string, * 'reference'=> string, * 'total_uploaded_amount'=> int, * 'total_uploaded_count'=> int, * 'status'=> 'NEEDS_APPROVAL', * 'id'=> string * ] * @throws Exceptions\ApiException */ public static function createBatch($params = []) { $requiredParams = ['reference', 'disbursements']; self::validateParams($params, $requiredParams); $url = '/batch_disbursements'; return static::_request('POST', $url, $params); } /** * Send GET request to retrieve data by external id * * @param string $external_id external id * * @return array[ * [ * 'user_id'=> '5785e6334d7b410667d355c4', * 'external_id'=> 'disbursement_12345', * 'amount'=> 500000, * 'bank_code'=> 'BCA', * 'account_holder_name'=> 'Rizky', * 'disbursement_description'=> 'Custom description', * 'status'=> 'PENDING', * 'id'=> '57c9010f5ef9e7077bcb96b6' * ],[ * 'user_id'=> '5785e6334d7b410667d355c4', * 'external_id'=> 'disbursement_12345', * 'amount'=> 450000, * 'bank_code'=> 'BNI', * 'account_holder_name'=> 'Jajang', * 'disbursement_description'=> 'Custom description', * 'status'=> 'COMPLETED', * 'id'=> '5a963089fd5fe5b6508f0b7b', * 'email_to'=> ['test+to1@xendit.co','test+to2@xendit.co'], * 'email_cc'=> ['test+bcc@xendit.co'], * 'email_bcc'=> ['test+bcc@xendit.co'] * ] * ] * @throws Exceptions\ApiException */ public static function retrieveExternal($external_id, $params = []) { $url = static::classUrl() . '?external_id=' . $external_id; return static::_request('GET', $url, $params); } /** * Send GET request to retrieve available banks * * @return array[ * [ * 'name'=> 'Bank Mandiri', * 'code'=> 'MANDIRI', * 'can_disburse'=> true, * 'can_name_validate'=> true * ],[ * 'name'=> 'Bank Rakyat Indonesia (BRI)', * 'code'=> 'BRI', * 'can_disburse'=> true, * 'can_name_validate'=> true * ],[ * 'name'=> 'Bank Central Asia (BCA)', * 'code'=> 'BCA', * 'can_disburse'=> true, * 'can_name_validate'=> true * ]] * @throws Exceptions\ApiException */ public static function getAvailableBanks() { $url = '/available_disbursements_banks'; return static::_request('GET', $url); } } PKZ"ww'xendit-php/src/ApiOperations/Update.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit\ApiOperations; /** * Trait Update * * @category Trait * @package Xendit\ApiOperations * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ trait Update { /** * Send an update request * * @param string $id data ID * @param array $params user's params * * @return array */ public static function update($id, $params = []) { self::validateParams($params, static::updateReqParams()); $url = static::classUrl() . '/' . $id; return static::_request('PATCH', $url, $params); } } PKZ8>>'xendit-php/src/ApiOperations/Create.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit\ApiOperations; /** * Trait Create * * @category Trait * @package Xendit\ApiOperations * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ trait Create { /** * Send a create request * * @param array $params user's params * * @return array */ public static function create($params = []) { self::validateParams($params, static::createReqParams()); $url = static::classUrl(); return static::_request('POST', $url, $params); } } PKZ6)##)xendit-php/src/ApiOperations/Retrieve.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit\ApiOperations; /** * Trait Retrieve * * @category Trait * @package Xendit\ApiOperations * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ trait Retrieve { /** * Send GET request to retrieve data * * @param string|null $id ID * * @return array */ public static function retrieve($id, $params = []) { $url = static::classUrl() . '/' . $id; return static::_request('GET', $url, $params); } } PKZ8H,xendit-php/src/ApiOperations/RetrieveAll.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit\ApiOperations; /** * Trait RetrieveAll * * @category Trait * @package Xendit\ApiOperations * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ trait RetrieveAll { /** * Send request to get all object, e.g Invoice * * @return array */ public static function retrieveAll($params = []) { $url = static::classUrl(); return static::_request('GET', $url, $params); } } PKZ,6> > (xendit-php/src/ApiOperations/Request.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit\ApiOperations; use Xendit\Exceptions\InvalidArgumentException; /** * Trait Request * * @category Trait * @package Xendit\ApiOperations * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ trait Request { /** * Parameters validation * * @param array $params user's parameters * @param array $requiredParams required parameters * * @return void */ protected static function validateParams($params = [], $requiredParams = []) { $currParams = array_diff_key(array_flip($requiredParams), $params); if ($params && !is_array($params)) { $message = "You must pass an array as params."; throw new InvalidArgumentException($message); } if (count($currParams) > 0) { $message = "You must pass required parameters on your params. " . "Check https://xendit.github.io/apireference/ for more information."; throw new InvalidArgumentException($message); } } /** * Send request to Api Requestor * * @param $method string * @param $url string ext url to the API * @param $params array parameters * * @return array * @throws \Xendit\Exceptions\ApiException */ protected static function _request( $method, $url, $params = [] ) { $headers = []; if (array_key_exists('for-user-id', $params)) { $headers['for-user-id'] = $params['for-user-id']; } if (array_key_exists('with-fee-rule', $params)) { $headers['with-fee-rule'] = $params['with-fee-rule']; } if (array_key_exists('Idempotency-key', $params)) { $headers['Idempotency-key'] = $params['Idempotency-key']; } if (array_key_exists('X-IDEMPOTENCY-KEY', $params)) { $headers['X-IDEMPOTENCY-KEY'] = $params['X-IDEMPOTENCY-KEY']; } if (array_key_exists('xendit-idempotency-key', $params)) { $headers['xendit-idempotency-key'] = $params['xendit-idempotency-key']; } if (array_key_exists('api-version', $params)) { $headers['api-version'] = $params['api-version']; unset($params['api-version']); } if (array_key_exists('X-API-VERSION', $params)) { $headers['X-API-VERSION'] = $params['X-API-VERSION']; } $requestor = new \Xendit\ApiRequestor(); return $requestor->request($method, $url, $params, $headers); } } PKZ#xendit-php/src/DisbursementsPHP.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; use InvalidArgumentException; /** * Class DisbursementsPHP * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class DisbursementsPHP { use ApiOperations\Request; use ApiOperations\Create; use ApiOperations\Retrieve; /** * Instantiate base URL * * @return string */ public static function classUrl() { return '/disbursements'; } /** * Instantiate required params for Create * * @return array */ public static function createPHPReqParams() { return [ 'xendit-idempotency-key', 'reference_id', 'currency', 'channel_code', 'account_name', 'account_number', 'description', 'amount' ]; } /** * Optional params for beneficiary * * @return array */ public static function beneficiaryReqParams() { return [ 'type', 'given_names', 'middle_name', 'surname', 'business_name', 'street_line1', 'street_line2', 'city', 'province', 'state', 'country', 'zip_code', 'mobile_number', 'phone_number', 'email', ]; } /** * Optional params for receipt Notification * * @return array */ public static function receiptNotificationReqParams() { return [ 'email_to', 'email_cc', 'email_bcc' ]; } /** * Send POST request to create disbursement * @param array $params required parameters * * @return array[ * [ * 'id'=> 'disb-random-id', * 'reference_id'=> 'random id', * 'currency'=> 'PHP', * 'amount'=> float * 'channel_code'=> 'BRI', * 'description'=> 'description', * 'status'=> 'Pending', * 'created'=> 'Date', * 'updated'=> 'Date', * receipt_notification => Array * beneficiary => Array * @throws Exceptions\ApiException */ public static function createPHPDisbursement($params = []) { self::validateParams($params, static::createPHPReqParams()); if (array_key_exists('beneficiary', $params)) { self::validateParams($params['beneficiary'], static::beneficiaryReqParams()); } if (array_key_exists('receipt_notification', $params)) { self::validateParams($params['receipt_notification'], static::receiptNotificationReqParams()); } return static::_request('POST', static::classUrl(), $params); } /** * Send GET request to get disbursement by id * * @param string $disbursement_id disbursement id * @param array $params extra parameters * * @return array[ * 'id'=> 'disb-random-id', * 'reference_id'=> 'random id', * 'currency'=> 'PHP', * 'amount'=> float * 'channel_code'=> 'BRI', * 'description'=> 'description', * 'status'=> 'Pending', * 'created'=> 'Date', * 'updated'=> 'Date', * receipt_notification => Array * beneficiary => Array * @throws Exceptions\ApiException */ public static function getPHPDisbursementByID($disbursement_id, $params = []) { $url = static::classUrl() . '/' . $disbursement_id; return static::_request('GET', $url, $params); } /** * Send GET request to get disbursement by reference_id * * @param string $reference_id reference_id id * @param array $params extra parameters * * @return array[ * [ * 'id'=> 'disb-random-id', * 'reference_id'=> 'random id', * 'currency'=> 'PHP', * 'amount'=> float, * 'channel_code'=> 'BRI', * 'description'=> 'description', * 'status'=> 'Pending', * 'created'=> 'Date', * 'updated'=> 'Date', * receipt_notification => Array * beneficiary => Array * ], [ * 'id'=> 'disb-random-id-2', * 'reference_id'=> 'random-id-2', * 'currency'=> 'PHP', * 'amount'=> float, * 'channel_code'=> 'BRI', * 'description'=> 'description', * 'status'=> 'Pending', * 'created'=> 'Date', * 'updated'=> 'Date', * receipt_notification => Array * beneficiary => Array * ]] * @throws Exceptions\ApiException */ public static function getPHPDisbursementsByReferenceID($reference_id, $params = []) { $url = static::classUrl() . '?reference_id=' . $reference_id; return static::_request('GET', $url, $params); } } PKZ3 0xendit-php/src/Exceptions/ExceptionInterface.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit\Exceptions; /** * Interface ExceptionInterface * * @category Interface * @package Xendit\Exception * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ interface ExceptionInterface extends \Throwable { /** * Get error code for the exception instance * * @return string */ public function getErrorCode(); } PKZԋee*xendit-php/src/Exceptions/ApiException.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit\Exceptions; /** * Class ApiException * * @category Exception * @package Xendit\Exceptions * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class ApiException extends \Exception implements ExceptionInterface { protected $errorCode; /** * Get error code for the exception instance * * @return string */ public function getErrorCode() { return $this->errorCode; } /** * Create new instance of ApiException * * @param string $message corresponds to message field in Xendit's HTTP error * @param string $code corresponds to http status in Xendit's HTTP response * @param string $errorCode corresponds to error_code field in Xendit's HTTP * error */ public function __construct($message, $code, $errorCode) { if (!$message) { throw new $this('Unknown '. get_class($this)); } parent::__construct($message, $code); $this->errorCode = $errorCode; } } PKZ {TRR6xendit-php/src/Exceptions/InvalidArgumentException.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit\Exceptions; /** * Class InvalidArgumentException * * @category Exception * @package Xendit\Exceptions * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class InvalidArgumentException extends \InvalidArgumentException { } PKZ12,xendit-php/src/QRCode.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; use Xendit\Exceptions\ApiException; use Xendit\Exceptions\InvalidArgumentException; /** * Class QRCode * * @category Class * @package Xendit * @author Dave * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class QRCode { use ApiOperations\Request; private static $apiVersion1 = '2020-07-01'; private static $apiVersion2 = '2022-07-31'; /** * Instantiate base URL * * @return string */ public static function classUrl() { return "/qr_codes"; } /** * Send a create request * * Create a QR Code * Required parameters: * For API version 2020-07-01: external_id, type, callback_url, amount (only if type = DYNAMIC). * For API version 2022-07-31: reference_id, type, currency, amount (only if type = DYNAMIC). * * To create QR Code for a Xenplatform sub-account, * include for-user-id in $params * * Please refer to this documentation for more detailed info * https://xendit.github.io/apireference/#create-qr-code * * @param array $params user's parameters * * @return array [ * 'id' => string, * 'external_id' => string, (only for API version 2020-07-01) * 'callback_url' => string, (only for API version 2020-07-01) * 'amount' => int, * 'qr_string' => string, * 'reference_id' => string, (only for API version 2022-07-31) * 'currency' => string, (only for API version 2022-07-31) * 'channel_code' => string, (only for API version 2022-07-31) * 'expires_at' => date, (only for API version 2022-07-31) * 'type' => 'DYNAMIC' || 'STATIC', * 'status' => 'ACTIVE' || 'INACTIVE', * 'created' => date, * 'updated' => date, * ] * * @throws InvalidArgumentException if some parameters are missing or invalid * @throws ApiException if request status code is not 2xx **/ public static function create($params = []) { if (!array_key_exists('type', $params)) { $message = 'Please specify "type" inside your parameters.'; throw new InvalidArgumentException($message); } $requiredParams = ['type']; if ($params['type'] === 'DYNAMIC') { array_push($requiredParams, 'amount'); } elseif ($params['type'] !== 'STATIC') { $message = 'Invalid QR Code type'; throw new InvalidArgumentException($message); } if (array_key_exists('api_version', $params)) { $params['api-version'] = $params['api_version']; unset($params['api_version']); } else { $params['api-version'] = QRCode::$apiVersion1; } if ($params['api-version'] === QRCode::$apiVersion1) { array_push($requiredParams, 'external_id', 'callback_url'); } elseif ($params['api-version'] === QRCode::$apiVersion2) { array_push($requiredParams, 'reference_id', 'currency'); if (array_key_exists('callback_url', $params)) { $message = 'The API version 2022-07-31 does not support passing callback URL in the request. Please set the callback URL from your Xendit Dashboard instead.'; throw new InvalidArgumentException($message); } } else { $message = 'Invalid API version'; throw new InvalidArgumentException($message); } self::validateParams($params, $requiredParams); $url = static::classUrl(); return static::_request('POST', $url, $params); } /** * Get QR Code * * Get a QR Code detail * * Please refer to this documentation for more detailed info * https://xendit.github.io/apireference/#get-qr-code-by-external-id * * @param string $id ID of the QR Code. * For API Version 2022-07-31, this should be the ID with `qr_` prefix that is returned after creating the QR Code. * Otherwise, this ID should be the external ID that is provided during the creation of the QR Code. * @param string|null $api_version The API version. * Valid values are: * - 2020-07-01 (default) * - 2022-07-31 * * @return array [ * 'id' => string, * 'external_id' => string, (only for API version 2020-07-01) * 'callback_url' => string, (only for API version 2020-07-01) * 'amount' => int, * 'qr_string' => string, * 'reference_id' => string, (only for API version 2022-07-31) * 'currency' => string, (only for API version 2022-07-31) * 'channel_code' => string, (only for API version 2022-07-31) * 'expires_at' => date, (only for API version 2022-07-31) * 'type' => 'DYNAMIC' || 'STATIC', * 'status' => 'ACTIVE' || 'INACTIVE', * 'created' => date, * 'updated' => date, * ] * * @throws ApiException */ public static function get(string $id, string $api_version = null) { $params = []; if ($api_version !== null) { $params['api-version'] = $api_version; } $url = static::classUrl(). '/' . $id; return static::_request('GET', $url, $params); } } PKZnm  xendit-php/src/Platform.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; use Xendit\Exceptions\InvalidArgumentException; /** * Class Platform * * @category Class * @package Xendit * @author David * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class Platform { use ApiOperations\Request; /** * Available account type * * @return array */ public static function accountType() { return ["MANAGED", "OWNED"]; } /** * Available unit route * * @return array */ public static function unitRoute() { return ["percent", "flat"]; } /** * Validation for account type * * @param string $account_type Account type * * @return void */ public static function validateAccountType($account_type = null) { if (!in_array($account_type, self::accountType())) { $msg = "Account type is invalid. Available types: MANAGED, OWNED"; throw new InvalidArgumentException($msg); } } /** * Validation for unit route * * @param string $unit unit route * * @return void */ public static function validateUnitRoute($unit = null) { if (!in_array($unit, self::unitRoute())) { $msg = "Unit value is invalid. Available values: percent, flat"; throw new InvalidArgumentException($msg); } } /** * Create account * * @param array $params user params * * @return array * https://developers.xendit.co/api-reference/#create-account * @throws Exceptions\ApiException */ public static function createAccount($params = []) { $requiredParams = ['email', 'type']; self::validateParams($params, $requiredParams); self::validateAccountType($params['type']); $url = '/v2/accounts'; return static::_request('POST', $url, $params); } /** * Get Account by ID * * @param string $account_id * * @return array * https://developers.xendit.co/api-reference/#get-account-by-id * @throws Exceptions\ApiException */ public static function getAccount($account_id) { $url = '/v2/accounts/'.$account_id; return static::_request('GET', $url); } /** * Update account * * @param string $account_id * @param array $params user params * * @return array * https://developers.xendit.co/api-reference/#update-account * @throws Exceptions\ApiException */ public static function updateAccount($account_id, $params = []) { $requiredParams = ['email']; self::validateParams($params, $requiredParams); $url = '/v2/accounts/'.$account_id; return static::_request('PATCH', $url, $params); } /** * Create transfer * * @param array $params user params * * @return array * https://developers.xendit.co/api-reference/#create-transfers * @throws Exceptions\ApiException */ public static function createTransfer($params = []) { $requiredParams = ['reference', 'amount', 'source_user_id', 'destination_user_id']; self::validateParams($params, $requiredParams); $url = '/transfers'; return static::_request('POST', $url, $params); } /** * Create fee rule * * @param array $params user params * * @return array * https://developers.xendit.co/api-reference/#create-fee-rule * @throws Exceptions\ApiException */ public static function createFeeRule($params = []) { $requiredParams = ['name', 'unit', 'amount', 'currency']; self::validateParams($params, $requiredParams); self::validateUnitRoute($params['unit']); $payload = array(); $payload['name'] = $params['name']; if (isset($params['description'])) { $payload['description'] = $params['description']; } $payload['routes'] = [ array( 'unit' => $params['unit'], 'amount' => $params['amount'], 'currency' => $params['currency'] ) ]; $url = '/fee_rules'; return static::_request('POST', $url, $payload); } /** * Set Callback URL * * @param string $type * @param array $params user params * * @return array * https://developers.xendit.co/api-reference/#set-callback-urls * @throws Exceptions\ApiException */ public static function setCallbackUrl($type, $params = []) { $requiredParams = ['url']; self::validateParams($params, $requiredParams); $url = '/callback_urls/'.$type; return static::_request('POST', $url, $params); } } PKZrTTxendit-php/src/Balance.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; use Xendit\Exceptions\InvalidArgumentException; /** * Class Balance * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class Balance { use ApiOperations\Request; /** * Available account type * * @return array */ public static function accountType() { return ["CASH", "HOLDING", "TAX"]; } /** * Validation for account type * * @param string $account_type Account type * * @return void */ public static function validateAccountType($account_type = null) { if (!in_array($account_type, self::accountType())) { $msg = "Account type is invalid. Available types: CASH, TAX, HOLDING"; throw new InvalidArgumentException($msg); } } /** * Send GET request to retrieve data * * @param string $account_type account type (CASH|HOLDING|TAX) * * @return array[ * 'balance' => int * ] * @throws Exceptions\ApiException */ public static function getBalance($account_type = null, $params = []) { self::validateAccountType($account_type); $url = '/balance?account_type=' . $account_type; return static::_request('GET', $url, $params); } } PKZ~ZM 'xendit-php/src/DisbursementChannels.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; /** * Class DisbursementChannels * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class DisbursementChannels { use ApiOperations\Request; use ApiOperations\Retrieve; /** * Instantiate base URL * * @return string */ public static function classUrl() { return '/disbursement-channels'; } /** * Send GET request to Get Disbursement Channels * * @param none * * @return array[ * [ * 'channel_code'=> 'PH_CIMB', * 'name'=> 'CIMB Bank Philippines Inc', * 'channel_category'=> 'BANK', * 'currency'=> 'PHP', * 'minimum'=> 50000, * 'maximum'=> 200000000, * 'minimum_increment'=> 0.01 * ], [ * 'channel_code'=> 'PH_CITI', * 'name'=> 'Citibank, N.A.', * 'channel_category'=> 'BANK', * 'currency'=> 'PHP', * 'minimum'=> 1, * 'maximum'=> 999999999, * 'minimum_increment'=> 1 * ]] * @throws Exceptions\ApiException */ public static function getDisbursementChannels() { $url = '/disbursement-channels'; return static::_request('GET', static::classUrl()); } /** * Send GET request to Get Disbursement Channels by Channel Category * * @param string $channel_category channel category * @param array $params extra parameters * * @return array[ * [ * 'channel_code'=> 'PH_CIMB', * 'name'=> 'CIMB Bank Philippines Inc', * 'channel_category'=> 'BANK', * 'currency'=> 'PHP', * 'minimum'=> 50000, * 'maximum'=> 200000000, * 'minimum_increment'=> 0.01 * ], [ * 'channel_code'=> 'PH_CITI', * 'name'=> 'Citibank, N.A.', * 'channel_category'=> 'BANK', * 'currency'=> 'PHP', * 'minimum'=> 1, * 'maximum'=> 999999999, * 'minimum_increment'=> 1 * ]] * @throws Exceptions\ApiException */ public static function getDisbursementChannelsByChannelCategory($channel_category, $params = []) { $url = static::classUrl() . '?channel_category=' . $channel_category; return static::_request('GET', $url, $params); } /** * Send GET request to Get Disbursement Channels by Channel Code * * @param string $channel_code channel Code * @param array $params extra parameters * * @return array[ * [ * 'channel_code'=> 'PH_CIMB', * 'name'=> 'CIMB Bank Philippines Inc', * 'channel_category'=> 'BANK', * 'currency'=> 'PHP', * 'minimum'=> 50000, * 'maximum'=> 200000000, * 'minimum_increment'=> 0.01 * ]] * @throws Exceptions\ApiException */ public static function getDisbursementChannelsByChannelCode($channel_code, $params = []) { $url = static::classUrl() . '?channel_code=' . $channel_code; return static::_request('GET', $url, $params); } } PKZH&xendit-php/src/HttpClientInterface.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://github.com/xendit/xendit-php/blob/master/src/HttpClientInterface.php */ namespace Xendit; /** * Interface HttpClientInterface * * @category Interface * @package Xendit * @author Stanley Nguyen * @license https://opensource.org/licenses/MIT MIT License * @link https://github.com/xendit/xendit-php/blob/master/src/HttpClientInterface.php */ interface HttpClientInterface { /** * Create and send an HTTP request. * * Use an absolute path to override the base path of the client, or a * relative path to append to the base path of the client. The URL can * contain the query string as well. * * @param string $method HTTP method. * @param string|UriInterface $uri URI object or string. * @param array $options Request options to apply. * * @return ResponseInterface * @throws GuzzleException */ public function request($method, $uri, array $options = []); }PKZZ^xendit-php/src/Cards.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; /** * Class Cards * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class Cards { use ApiOperations\Request; use ApiOperations\Retrieve; use ApiOperations\Create; /** * Instantiate base URL * * @return string */ public static function classUrl() { return "/credit_card_charges"; } /** * Capture charge, see https://xendit.github.io/apireference/?bash#capture-charge * for more details * * @param string $id charge ID * @param array $params user parameters * * @return array [ * 'created' => string, * 'status' => string, * 'business_id' => string, * 'authorized_amount' => int, * 'external_id' => string, * 'merchant_id' => string, * 'merchant_reference_code' => string, * 'card_type' => string, * 'masked_card_number' => string, * 'charge_type' => string, * 'card_brand' => string, * 'bank_reconciliation_id' => string, * 'capture_amount' => int, * 'descriptor' => string, * 'id' => string * ] * @throws Exceptions\ApiException */ public static function capture($id, $params = []) { $url = self::classUrl() . '/' . $id . '/capture'; $requiredParams = ['amount']; self::validateParams($params, $requiredParams); return static::_request('POST', $url, $params); } /** * Instantiate required params for Create * * @return array */ public static function createReqParams() { return ['token_id', 'external_id', 'amount']; } /** * Reverse authorized charge * * @param string $id charge ID * @param array $params user params * * @return array [ * 'created' => string, * 'credit_card_charge_id' => string, * 'external_id' => string, * 'business_id' => string, * 'amount' => int, * 'status' => string, * 'id' => string * ] * @throws Exceptions\ApiException */ public static function reverseAuthorization($id, $params = []) { $url = self::classUrl() . '/' . $id . '/auth_reversal'; $requiredParams = ['external_id']; self::validateParams($params, $requiredParams); return static::_request('POST', $url, $params); } /** * Create refund, see https://xendit.github.io/apireference/?bash#capture-charge * for more details * * @param string $id charge ID * @param array $params user parameters * * @return array [ * 'updated' => string, * 'created' => string, * 'credit_card_charge_id' => string, * 'user_id' => string, * 'amount' => int, * 'external_id' => string, * 'status' => 'SUCCEEDED' || 'FAILED', * 'fee_refund_amount' => int, * 'id' => string * ] * @throws Exceptions\ApiException */ public static function createRefund($id, $params = []) { $url = self::classUrl() . '/' . $id . '/refunds'; $requiredParams = ['amount', 'external_id']; self::validateParams($params, $requiredParams); return static::_request('POST', $url, $params); } } PKZ.q!xendit-php/src/CardlessCredit.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; /** * Class CardlessCredit * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class CardlessCredit { use ApiOperations\Request; use ApiOperations\Create; /** * Instantiate relative URL * * @return string */ public static function classUrl() { return "/cardless-credit"; } /** * Instantiate required params for Create * * @return array */ public static function createReqParams() { return [ 'cardless_credit_type', 'external_id', 'amount', 'payment_type', 'items', 'customer_details', 'shipping_address', 'redirect_url', 'callback_url' ]; } /** * Calculate payment types * * @param array $params user's parameters * * @return array * * @throws ApiException */ public static function calculatePaymentTypes($params = []) { $requiredParams = [ 'cardless_credit_type', 'amount', 'items', ]; self::validateParams($params, $requiredParams); $url = static::classUrl() . '/payment-types'; return static::_request('POST', $url, $params); } } PKZ`xendit-php/src/DirectDebit.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; use Xendit\Exceptions\InvalidArgumentException; /** * Class DirectDebit * * @category Class * @package Xendit * @author Glenda * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class DirectDebit { use ApiOperations\Request; /** * Instantiate linked account base URL * * @return string */ public static function linkedAccountUrl() { return "/linked_account_tokens/"; } /** * Instantiate payment method base URL * * @return string */ public static function paymentMethodUrl() { return "/payment_methods"; } /** * Instantiate direct debit payment base URL * * @return string */ public static function directDebitPaymentUrl() { return "/direct_debits"; } /** * Send a initialize linked account tokenization request * * @param array $params user's parameters * * @return array please check for responses parameters here * https://developers.xendit.co/api-reference/?bash#initialize-linked-account-tokenization * @throws Exceptions\ApiException */ public static function initializeLinkedAccountTokenization($params = []) { $requiredParams = ['customer_id', 'channel_code']; self::validateParams($params, $requiredParams); $url = static::linkedAccountUrl() . "auth"; return static::_request("POST", $url, $params); } /** * Send a validate OTP for linked account request * * @param string $linked_account_token_id linked account token ID * @param array $params user's parameters * * @return array please check for responses parameters here * https://developers.xendit.co/api-reference/?bash#validate-otp-for-linked-account-token * @throws Exceptions\ApiException */ public static function validateOTPForLinkedAccount( $linked_account_token_id, $params = [] ) { $requiredParams = ['otp_code']; self::validateParams($params, $requiredParams); $url = static::linkedAccountUrl() . $linked_account_token_id . "/validate_otp"; return static::_request("POST", $url, $params); } /** * Retrieve accessible accounts by linked account token * * @param string $linked_account_token_id linked account token ID * * @return array please check for responses parameters here * https://developers.xendit.co/api-reference/?bash#retrieve-accessible-accounts-by-linked-account-token * @throws Exceptions\ApiException */ public static function retrieveAccessibleLinkedAccounts($linked_account_token_id) { $url = static::linkedAccountUrl() . $linked_account_token_id . "/accounts"; return static::_request('GET', $url); } /** * Unbind linked account token * * @param string $linked_account_token_id linked account token ID * * @return array please check for responses parameters here * https://developers.xendit.co/api-reference/?bash#unbind-a-linked-account-token * @throws Exceptions\ApiException */ public static function unbindLinkedAccountToken($linked_account_token_id) { $url = static::linkedAccountUrl() . $linked_account_token_id; return static::_request('DELETE', $url); } /** * Send a create payment method request * * @param array $params user's parameters * * @return array please check for responses parameters here * https://developers.xendit.co/api-reference/?bash#create-payment-method * @throws Exceptions\ApiException */ public static function createPaymentMethod($params = []) { $requiredParams = ['type', 'properties']; self::validateParams($params, $requiredParams); $url = static::paymentMethodUrl(); return static::_request("POST", $url, $params); } /** * Get payment methods by customer ID * * @param string $customer_id customer ID * * @return array please check for responses parameters here * https://developers.xendit.co/api-reference/?bash#list-payment-methods * @throws Exceptions\ApiException */ public static function getPaymentMethodsByCustomerID($customer_id) { $url = static::paymentMethodUrl() . "?customer_id=" . $customer_id; return static::_request('GET', $url); } /** * Send a create direct debit payment request * * @param array $params user's parameters * * @return array please check for responses parameters here * https://developers.xendit.co/api-reference/?bash#create-direct-debit-payment * @throws Exceptions\ApiException */ public static function createDirectDebitPayment($params = []) { $requiredParams = [ 'reference_id', 'payment_method_id', 'currency', 'amount' ]; self::validateParams($params, $requiredParams); $url = static::DirectDebitPaymentUrl(); return static::_request("POST", $url, $params); } /** * Send a validate OTP for direct debit payment * * @param string $direct_debit_payment_id direct debit payment ID * @param array $params user's parameters * * @return array please check for responses parameters here * https://developers.xendit.co/api-reference/?bash#validate-otp-for-direct-debit-payment * @throws Exceptions\ApiException */ public static function validateOTPForDirectDebitPayment( $direct_debit_payment_id, $params = [] ) { $requiredParams = ['otp_code']; self::validateParams($params, $requiredParams); $url = static::directDebitPaymentUrl() . '/' . $direct_debit_payment_id . "/validate_otp/"; return static::_request("POST", $url, $params); } /** * Get direct debit payment by ID * * @param string $direct_debit_payment_id direct debit payment ID * * @return array please check for responses parameters here * https://developers.xendit.co/api-reference/?bash#get-payment-by-id * @throws Exceptions\ApiException */ public static function getDirectDebitPaymentByID($direct_debit_payment_id) { $url = static::directDebitPaymentUrl() . "/" . $direct_debit_payment_id . "/"; return static::_request('GET', $url); } /** * Get direct debit payment by reference ID * * @param string $reference_id reference ID * * @return array please check for responses parameters here * https://developers.xendit.co/api-reference/?bash#get-payment-by-reference-id * @throws Exceptions\ApiException */ public static function getDirectDebitPaymentByReferenceID($reference_id) { $url = static::directDebitPaymentUrl() . "?reference_id=" . $reference_id; return static::_request('GET', $url); } } PKZB7  "xendit-php/src/PaymentChannels.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; /** * Class PaymentChannels * * @category Class * @package Xendit * @author David * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class PaymentChannels { use ApiOperations\Request; /** * Payment channel list * * @return array * https://developers.xendit.co/api-reference/#get-payment-channels * @throws Exceptions\ApiException * * GetPaymentChannels is in maintenance mode. Existing behavior on the endpoint will continue to work as before, but newer channels will be missing from the returned result. */ public static function list() { $url = '/payment_channels'; return static::_request('GET', $url); } } PKZnxendit-php/src/Payouts.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; /** * Class Payouts * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class Payouts { use ApiOperations\Request; use ApiOperations\Create; use ApiOperations\Retrieve; /** * Instantiate relative URL * * @return string */ public static function classUrl() { return "/payouts"; } /** * Instantiate required params for Create * * @return array */ public static function createReqParams() { return ['external_id', 'amount', 'email']; } /** * Void a payout * * @param string $id payout ID * * @return array[ * 'id'=> string, * 'external_id'=> string, * 'amount'=> int, * 'merchant_name'=> string, * 'status'=> 'ISSUED' || 'DISBURSING' || 'VOIDED' || 'LOCKED' * || 'COMPLETED' || 'FAILED', * 'expiration_timestamp'=> string, * 'created'=> string', * 'email'=> string, * 'payout_url'=> string * ] * @throws Exceptions\ApiException */ public static function void($id) { $url = static::classUrl() . '/' . $id . '/void'; return static::_request('POST', $url); } } PKZSllxendit-php/src/EWallets.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; use Xendit\Exceptions\InvalidArgumentException; /** * Class EWallets * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class EWallets { use ApiOperations\Request; /** * Instantiate base URL * * @return string */ public static function classUrl() { return "/ewallets"; } /** * Send a create request * * @param array $params user's parameters * * @return array please check for responses for each e-wallet type * https://xendit.github.io/apireference/?bash#create-payment * @throws Exceptions\ApiException */ public static function create($params = []) { $requiredParams = []; if (!array_key_exists('ewallet_type', $params)) { $message = 'Please specify ewallet_type inside your parameters.'; throw new InvalidArgumentException($message); } if ($params['ewallet_type'] === 'OVO') { $requiredParams = ['external_id', 'amount', 'phone']; } elseif ($params['ewallet_type'] === 'DANA') { $requiredParams = ['external_id', 'amount', 'callback_url', 'redirect_url']; } elseif ($params['ewallet_type'] === 'LINKAJA') { $requiredParams = ['external_id', 'amount', 'phone', 'items', 'callback_url', 'redirect_url']; } self::validateParams($params, $requiredParams); $url = static::classUrl(); return static::_request('POST', $url, $params); } /** * Get Payment Status * * @param string $external_id external ID * @param string $ewallet_type E-wallet type (OVO, DANA, LINKAJA * * @return array please check for responses for each e-wallet type * https://xendit.github.io/apireference/?bash#get-payment-status * @throws Exceptions\ApiException */ public static function getPaymentStatus($external_id, $ewallet_type) { $url = static::classUrl() . '?external_id=' . $external_id . '&ewallet_type=' . $ewallet_type; return static::_request('GET', $url); } /** * Send a create e-wallet charge request * * @param array $params user's parameters * * @return array please check for responses parameters here * https://developers.xendit.co/api-reference/?bash#create-ewallet-charge * @throws Exceptions\ApiException */ public static function createEWalletCharge($params = []) { $requiredParams = ['reference_id', 'currency', 'amount', 'checkout_method']; self::validateParams($params, $requiredParams); $url = static::classUrl() . '/charges'; return static::_request("POST", $url, $params); } /** * Get e-wallet charge status * * @param string $charge_id charge ID * * @return array please check for responses parameters here * https://developers.xendit.co/api-reference/?bash#get-ewallet-charge-status * @throws Exceptions\ApiException */ public static function getEWalletChargeStatus($charge_id, $params=[]) { $url = static::classUrl() . '/charges/' . $charge_id; return static::_request('GET', $url, $params); } /** * Void eWallet Charge * * @param string $charge_id charge ID * * @return array please check for responses parameters here * https://developers.xendit.co/api-reference/#void-ewallet-charge * @throws Exceptions\ApiException */ public static function voidEwalletCharge($charge_id, $params=[]) { $url = static::classUrl() . '/charges/' . $charge_id.'/void'; return static::_request('POST', $url, $params); } /** * Refund eWallet Charge * * @param string $charge_id charge ID * * @return array please check for responses parameters here * https://developers.xendit.co/api-reference/#refund-ewallet-charge * @throws Exceptions\ApiException */ public static function refundEwalletCharge($charge_id, $params=[]) { $url = static::classUrl() . '/charges/' . $charge_id.'/refunds'; return static::_request('POST', $url, $params); } /** * Get eWallet Refund by Refund ID * * @param string $charge_id charge ID * @param string $refund_id refund ID * * @return array please check for responses parameters here * https://developers.xendit.co/api-reference/#refund-ewallet-charge * @throws Exceptions\ApiException */ public static function getRefund($charge_id, $refund_id, $params=[]) { $url = static::classUrl() . '/charges/' . $charge_id.'/refunds/'.$refund_id; return static::_request('GET', $url, $params); } /** * Get eWallet Refund by Refund ID * * @param string $charge_id charge ID * * @return array please check for responses parameters here * https://developers.xendit.co/api-reference/#refund-ewallet-charge * @throws Exceptions\ApiException */ public static function listRefund($charge_id, $params=[]) { $url = static::classUrl() . '/charges/' . $charge_id.'/refunds/'; return static::_request('GET', $url, $params); } } PKZxendit-php/src/Invoice.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; /** * Class Invoice * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class Invoice { use ApiOperations\Request; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\RetrieveAll; /** * Instantiate base URL * * @return string */ public static function classUrl() { return "/v2/invoices"; } /** * Instantiate required params for Create * * @return array */ public static function createReqParams() { return ['external_id', 'amount']; } /** * Expire Invoice * * @param string $id Invoice ID * * @return array[ * 'id'=> string, * 'user_id'=> string, * 'external_id'=> string, * 'status'=> 'EXPIRED', * 'merchant_name'=> string, * 'merchant_profile_picture_url'=> string, * 'amount'=> int, * 'payer_email'=> string, * 'description'=> string, * 'invoice_url'=> string, * 'expiry_date'=> string, * 'available_banks'=> array, * 'should_exclude_credit_card'=> bool, * 'should_send_email'=> bool, * 'created'=> string, * 'updated'=> string * ] * @throws Exceptions\ApiException */ public static function expireInvoice($id, $params=[]) { $url = '/invoices/' . $id . '/expire!'; return static::_request('POST', $url, $params); } } PKZώzzxendit-php/src/Retail.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; /** * Class Retail * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class Retail { use ApiOperations\Request; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; /** * Instantiate relative URL * * @return string */ public static function classUrl() { return "/fixed_payment_code"; } /** * Instantiate required params for Create * * @return array */ public static function createReqParams() { return ['external_id', 'retail_outlet_name', 'name', 'expected_amount']; } /** * Instantiate required params for Update * * @return array */ public static function updateReqParams() { return []; } } PKZxendit-php/src/PayLater.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; use Xendit\Exceptions\InvalidArgumentException; use Xendit\Exceptions\ApiException; /** * Class PayLater * * @category Class * @package Xendit * @author Asoka Wotulo * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class PayLater { use ApiOperations\Request; /** * Instantiate relative URL * * @return string */ public static function classUrl() { return "/paylater"; } /** * Retrieve list of PayLater plans * * @param array $params * @return array * @throws InvalidArgumentException * @throws ApiException */ public static function initiatePayLaterPlans($params = []) { $requiredParams = [ 'customer_id', 'channel_code', 'currency', 'amount', 'order_items', ]; self::validateParams($params, $requiredParams); $url = static::classUrl() . '/plans'; return static::_request('POST', $url, $params); } /** * Create PayLater transaction / generate checkout URL * * @param array $params * @return array * @throws InvalidArgumentException * @throws ApiException */ public static function createPayLaterCharge($params = []) { $requiredParams = [ 'plan_id', 'reference_id', 'checkout_method', 'success_redirect_url', ]; self::validateParams($params, $requiredParams); $url = static::classUrl() . '/charges'; return static::_request('POST', $url, $params); } /** * Get PayLater Charge by ID * * @param string $id * @param array $params * @return array * @throws InvalidArgumentException * @throws ApiException */ public static function getPayLaterChargeStatus($id, $params = []) { $requiredParams = [ ]; self::validateParams($params, $requiredParams); $url = static::classUrl() . '/charges/'.$id; return static::_request('GET', $url, $params); } /** * Create Paylater Refund * * @param string $id * @param array $params * @return array * @throws InvalidArgumentException * @throws ApiException */ public static function createPayLaterRefund($id, $params = []) { $requiredParams = [ ]; self::validateParams($params, $requiredParams); $url = static::classUrl() . '/charges/'.$id.'/refunds'; return static::_request('POST', $url, $params); } /** * Get Refund by Refund ID * * @param string $charge_id * @param string $refund_id * @param array $params * @return array * @throws InvalidArgumentException * @throws ApiException */ public static function getPayLaterRefund($charge_id, $refund_id, $params = []) { $requiredParams = [ ]; self::validateParams($params, $requiredParams); $url = static::classUrl() . '/charges/'.$charge_id.'/refunds/'.$refund_id; return static::_request('GET', $url, $params); } /** * List Paylater Refunds * * @param array $params Paylater Refunds params * * @return array * https://developers.xendit.co/api-reference/#list-paylater-refunds * @throws Exceptions\ApiException */ public static function listPayLaterRefund($charge_id, $params = []) { $url = static::classUrl() . '/charges/'.$charge_id.'/refunds/'; return static::_request('GET', $url, $params); } } PKZ G5 5 xendit-php/src/ApiRequestor.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; /** * Class ApiRequestor * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class ApiRequestor { private static $_httpClient; /** * Send request and processing response * * @param string $method request method (get, post, patch, etc) * @param string $url base url * @param array $params user's params * @param array $headers user's additional headers * * @return array * @throws Exceptions\ApiException */ public function request($method, $url, $params = [], $headers = []) { list($rbody, $rcode, $rheaders) = $this->_requestRaw($method, $url, $params, $headers); return json_decode($rbody, true); } /** * Set must-have headers * * @param array $headers user's headers * * @return array */ private function _setDefaultHeaders($headers) { $defaultHeaders = []; $lib = 'php'; $libVersion = Xendit::getLibVersion(); $defaultHeaders['Content-Type'] = 'application/json'; $defaultHeaders['xendit-lib'] = $lib; $defaultHeaders['xendit-lib-ver'] = $libVersion; return array_merge($defaultHeaders, $headers); } /** * Send request from client * * @param string $method request method * @param string $url additional url to base url * @param array $params user's params * @param array $headers request' headers * * @return array * @throws Exceptions\ApiException */ private function _requestRaw($method, $url, $params, $headers) { $defaultHeaders = self::_setDefaultHeaders($headers); $response = $this->_httpClient()->sendRequest( $method, $url, $defaultHeaders, $params ); $rbody = $response[0]; $rcode = $response[1]; $rheaders = $response[2]; return [$rbody, $rcode, $rheaders]; } /** * Create HTTP CLient * * @return HttpClient\GuzzleClient */ private function _httpClient() { if (!self::$_httpClient) { self::$_httpClient = HttpClient\GuzzleClient::instance(); } return self::$_httpClient; } /** * GuzzleClient Setter * * @param HttpClient\GuzzleClient $client client * * @return void */ public static function setHttpClient($client) { self::$_httpClient = $client; } } PKZT xendit-php/src/Promotion.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; use Xendit\Exceptions\InvalidArgumentException; /** * Class Promotion * * @category Class * @package Xendit * @author Christian * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class Promotion { use ApiOperations\Request; /** * Instantiate base URL * * @return string */ public static function classUrl() { return "/promotions"; } /** * Send a create request * * Create a Promotion * * either promo_code or bin_list is required * either discount_percent or discount_amount is required * * Please refer to this documentation for more detailed info * https://developers.xendit.co/api-reference/#create-promotion * * @param array $params user's parameters * * @return array [ * 'business_id' => string, * 'currency' => string, * 'created' => string, * 'description' => string, * 'discount_amount' => int, * 'end_time' => string, * 'id' => string, * 'promo_code' => string, * 'reference_id' => string, * 'start_time' => string, * 'status' => string, * 'type' => string, * ] * * @throws Exceptions\InvalidArgumentException * * @throws Exceptions\ApiException if request status code is not 2xx **/ public static function create($params = []) { if (!array_key_exists('promo_code', $params) && !array_key_exists('bin_list', $params) ) { $message = 'Please specify "promo_code" or "bin_list"' . 'inside your parameters.'; throw new InvalidArgumentException($message); } if (!array_key_exists('discount_percent', $params) && !array_key_exists('discount_amount', $params) ) { $message = 'Please specify "discount_percent" or "discount_amount"' . 'inside your parameters.'; throw new InvalidArgumentException($message); } $requiredParams = [ 'reference_id', 'description', 'currency', 'start_time', 'end_time', ]; self::validateParams($params, $requiredParams); $url = static::classUrl(); return static::_request('POST', $url, $params); } } PKZK~xendit-php/src/Recurring.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; /** * Class Recurring * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class Recurring { use ApiOperations\Request; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; /** * Instantiate base URL * * @return string */ public static function classUrl() { return "/recurring_payments"; } /** * Instantiate required params for Create * * @return array */ public static function createReqParams() { return [ 'external_id', 'payer_email', 'description', 'amount', 'interval', 'interval_count' ]; } /** * Instantiate required params for Update * * @return array */ public static function updateReqParams() { return []; } /** * Stop a recurring payment * * @param string $id recurring payment ID * * @return array[ * 'id'=> string, * 'user_id'=> string, * 'external_id'=> string, * 'status'=> 'ACTIVE' || 'STOPPED' || 'PAUSED', * 'amount'=> int, * 'payer_email'=> string, * 'description'=> string, * 'interval'=> string, * 'interval_count'=> int, * 'recurrence_progress'=> int, * 'should_send_email'=> bool, * 'missed_payment_action'=> string, * 'recharge'=> bool, * 'created'=> string, * 'updated'=> string, * 'start_date'=> string * ] * @throws Exceptions\ApiException */ public static function stop($id) { $url = '/recurring_payments/' . $id . '/stop!'; return static::_request('POST', $url); } /** * Pause a recurring payment * * @param string $id recurring payment ID * * @return array[ * 'id'=> string, * 'user_id'=> string, * 'external_id'=> string, * 'status'=> 'ACTIVE' || 'STOPPED' || 'PAUSED', * 'amount'=> int, * 'payer_email'=> string, * 'description'=> string, * 'interval'=> string, * 'interval_count'=> int, * 'recurrence_progress'=> int, * 'should_send_email'=> bool, * 'missed_payment_action'=> string, * 'recharge'=> bool, * 'created'=> string, * 'updated'=> string, * 'start_date'=> string * ] * @throws Exceptions\ApiException */ public static function pause($id) { $url = '/recurring_payments/' . $id . '/pause!'; return static::_request('POST', $url); } /** * Resume a recurring payment * * @param string $id recurring payment ID * * @return array[ * 'id'=> string, * 'user_id'=> string, * 'external_id'=> string, * 'status'=> 'ACTIVE' || 'STOPPED' || 'PAUSED', * 'amount'=> int, * 'payer_email'=> string, * 'description'=> string, * 'interval'=> string, * 'interval_count'=> int, * 'recurrence_progress'=> int, * 'should_send_email'=> bool, * 'missed_payment_action'=> string, * 'recharge'=> bool, * 'created'=> string, * 'updated'=> string, * 'start_date'=> string * ] * @throws Exceptions\ApiException */ public static function resume($id) { $url = '/recurring_payments/' . $id . '/resume!'; return static::_request('POST', $url); } } PKZH  xendit-php/src/Transaction.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; /** * Class Transaction * * @category Class * @package Xendit * @author David * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class Transaction { use ApiOperations\Request; /** * List transactions * * @param array $params transaction params * * @return array * https://developers.xendit.co/api-reference/#get-transaction * @throws Exceptions\ApiException */ public static function list($params = []) { $url = '/transactions'; return static::_request('GET', $url, $params); } /** * Get transaction * * @param string $transaction_id * * @return array * https://developers.xendit.co/api-reference/#get-transaction * @throws Exceptions\ApiException */ public static function detail(string $transaction_id) { $url = '/transactions/'.$transaction_id; return static::_request('GET', $url); } } PKZz} xendit-php/src/Customers.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; use Xendit\Exceptions\InvalidArgumentException; /** * Class Customers * * @category Class * @package Xendit * @author Glenda * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class Customers { use ApiOperations\Request; /** * Instantiate base URL * * @return string */ public static function classUrl() { return "/customers"; } /** * Send a create customer request * * @param array $params user's parameters * * @return array please check for responses parameters here * https://developers.xendit.co/api-reference/?bash#create-customer * @throws Exceptions\ApiException */ public static function createCustomer($params = []) { $requiredParams = ['reference_id']; if (array_key_exists('api-version', $params) && $params['api-version'] == '2020-10-31' ) { array_push( $requiredParams, 'type', 'identity_accounts', 'kyc_documents' ); } else { array_push($requiredParams, 'given_names'); if (!array_key_exists('mobile_number', $params)) { array_push($requiredParams, 'email'); } if (!array_key_exists('email', $params)) { array_push($requiredParams, 'mobile_number'); } } self::validateParams($params, $requiredParams); $url = static::classUrl(); return static::_request("POST", $url, $params); } /** * Get customer by reference ID * * @param string $reference_id reference ID * @param array $params user's parameters * * @return array please check for responses parameters here * https://developers.xendit.co/api-reference/?bash#get-customer-by-reference-id * @throws Exceptions\ApiException */ public static function getCustomerByReferenceID($reference_id, $params=[]) { $url = static::classUrl() . '?reference_id=' . $reference_id; return static::_request('GET', $url, $params); } } PKZQn n xendit-php/src/Xendit.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; use Dotenv\Dotenv; /** * Class Xendit * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class Xendit { public static $apiKey; public static $apiBase = 'https://api.xendit.co'; public static $libVersion; private static $_httpClient; const VERSION = "2.18.0"; /** * ApiBase getter * * @return string */ public static function getApiBase(): string { return self::$apiBase; } /** * ApiBase setter * * @param string $apiBase api base url * * @return void */ public static function setApiBase(string $apiBase): void { self::$apiBase = $apiBase; } /** * Get the value of apiKey * * @return string Secret API key */ public static function getApiKey() { return self::$apiKey; } /** * Set the value of apiKey * * @param string $apiKey Secret API key * * @return void */ public static function setApiKey($apiKey) { self::$apiKey = $apiKey; } /** * Get library version * * @return mixed */ public static function getLibVersion() { if (self::$libVersion === null) { self::$libVersion = self::VERSION; } return self::$libVersion; } /** * Set library version * * @param string $libVersion library version * * @return void */ public static function setLibVersion($libVersion = null): void { self::$libVersion = $libVersion; } /** * Set custom http client * * @param HttpCLientInterface $client custom http client * * @return void */ public static function setHttpClient(HttpClientInterface $client): void { self::$_httpClient = $client; } /** * Get current http client being used in the package * * @return HttpClientInterface */ public static function getHttpClient() { return self::$_httpClient; } } PKZ,+ss*xendit-php/src/HttpClient/GuzzleClient.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit\HttpClient; use GuzzleHttp\Client as Guzzle; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\RequestOptions; use Xendit\Exceptions\ApiException; use Xendit\Xendit; /** * Class GuzzleClient * * @category Class * @package Xendit\HttpClient * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class GuzzleClient implements ClientInterface { private static $_instance; protected $http; /** * XenditClient constructor */ public function __construct() { if (Xendit::getHttpClient()) { $this->http = Xendit::getHttpClient(); } else { $baseUri = strval(Xendit::$apiBase); $this->http = new Guzzle( [ 'base_uri' => $baseUri, 'verify' => false, 'timeout' => 60 ] ); } } /** * Create Client instance * * @return GuzzleClient */ public static function instance() { if (!self::$_instance) { self::$_instance = new self(); } return self::$_instance; } /** * Create a request to execute in _executeRequest * * @param string $method request method * @param string $url url * @param array $defaultHeaders request headers * @param array $params parameters * * @return array * @throws ApiException */ public function sendRequest($method, string $url, array $defaultHeaders, $params) { $method = strtoupper($method); $opts = []; $opts['method'] = $method; $opts['headers'] = $defaultHeaders; $opts['params'] = $params; $response = $this->_executeRequest($opts, $url); $rbody = $response[0]; $rcode = $response[1]; $rheader = $response[2]; return [$rbody, $rcode, $rheader]; } /** * Execute request * * @param array $opts request options (headers, params) * @param string $url request url * * @return array * @throws ApiException */ private function _executeRequest(array $opts, string $url) { $headers = $opts['headers']; $params = $opts['params']; $apiKey = Xendit::$apiKey; $url = strval($url); try { if (count($params) > 0) { $isQueryParam = isset($params['query-param']) && $params['query-param'] === 'true'; // additional condition to check if the requestor is imposing query param, otherwise default json if($isQueryParam) unset($params['query-param']); $response = $this->http->request( $opts['method'], $url, [ 'auth' => [$apiKey, ''], 'headers' => $headers, $isQueryParam ? RequestOptions::QUERY : RequestOptions::JSON => $params ] ); } else { $response = $this->http->request( $opts['method'], $url, [ 'auth' => [$apiKey, ''], 'headers' => $headers ] ); } } catch (RequestException $e) { $response = $e->getResponse(); $rbody = json_decode($response->getBody()->getContents(), true); $rcode = $response->getStatusCode(); $rheader = $response->getHeaders(); self::_handleAPIError( array('body' => $rbody, 'code' => $rcode, 'header' => $rheader) ); } $rbody = $response->getBody(); $rcode = (int) $response->getStatusCode(); $rheader = $response->getHeaders(); return [$rbody, $rcode, $rheader]; } /** * Handles API Error * * @param array $response response from GuzzleClient * * @return void * @throws ApiException */ private static function _handleAPIError($response) { $rbody = $response['body']; $rhttp = strval($response['code']); $message = $rbody['message']; $rcode = $rbody['error_code']; throw new ApiException($message, $rhttp, $rcode); } } PKZ_-xendit-php/src/HttpClient/ClientInterface.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit\HttpClient; use Xendit\Exceptions\ApiException; /** * Interface ClientInterface * * @category Interface * @package Xendit\HttpClient * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ interface ClientInterface { /** * Create a request to execute in _executeRequest * * @param string $method request method * @param string $url url * @param array $defaultHeaders request headers * @param array $params parameters * * @return array * @throws ApiException */ public function sendRequest($method, string $url, array $defaultHeaders, $params ); } PKZP9HH"xendit-php/src/VirtualAccounts.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; /** * Class VirtualAccounts * * @category Class * @package Xendit * @author Ellen * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class VirtualAccounts { use ApiOperations\Request; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; /** * Instantiate base URL * * @return string */ public static function classUrl() { return "/callback_virtual_accounts"; } /** * Instantiate required params for Create * * @return array */ public static function createReqParams() { return ['external_id', 'bank_code', 'name']; } /** * Instantiate required params for Update * * @return array */ public static function updateReqParams() { return []; } /** * Get available VA banks * * @return array[ * 'name' => string, * 'code' => string * ] * @throws Exceptions\ApiException */ public static function getVABanks() { $url = '/available_virtual_account_banks'; return static::_request('GET', $url); } /** * Get FVA payment * * @param string $payment_id payment ID * * @return array[ * 'id'=> string, * 'payment_id'=> string, * 'callback_virtual_account_id'=> string, * 'external_id'=> string, * 'merchant_code'=> string, * 'account_number'=> string, * 'bank_code'=> string, * 'amount'=> int, * 'transaction_timestamp'=> string * ] * @throws Exceptions\ApiException */ public static function getFVAPayment($payment_id) { $url = '/callback_virtual_account_payments/payment_id=' . $payment_id; return static::_request('GET', $url); } } PKZduJxendit-php/src/Report.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ namespace Xendit; use Xendit\Exceptions\InvalidArgumentException; /** * Class Report * * @category Class * @package Xendit * @author David * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class Report { use ApiOperations\Request; /** * Available report type * * @return array */ public static function reportType() { return ["BALANCE_HISTORY", "TRANSACTIONS", "UPCOMING_TRANSACTIONS"]; } /** * Validation for report type * * @param string $report_type Report type * * @return void */ public static function validateReportType($report_type = null) { if (!in_array($report_type, self::reportType())) { $msg = "Report type is invalid. Available types: MANAGED, OWNED"; throw new InvalidArgumentException($msg); } } /** * Generate report * * @param array $params reports params * * @return array * https://developers.xendit.co/api-reference/#generate-report * @throws Exceptions\ApiException */ public static function generate($params = []) { $requiredParams = ['type']; self::validateParams($params, $requiredParams); self::validateReportType($params['type']); $url = '/reports'; return static::_request('POST', $url, $params); } /** * Get report * * @param string $report_id * * @return array * https://developers.xendit.co/api-reference/#get-report * @throws Exceptions\ApiException */ public static function detail(string $report_id) { $url = '/reports/'.$report_id; return static::_request('GET', $url); } } PKZQyvxendit-php/README.mdnu[# Xendit API PHP Client This library is the abstraction of Xendit API for access from applications written with PHP. - [Documentation](#documentation) - [Installation](#installation) - [Usage](#usage) - [Methods' Signature and Examples](#methods-signature-and-examples) - [Balance](#balance) - [Get Balance](#get-balance) - [Payment Channels](#payment-channels) - [Get Payment Channels](#get-payment-channels) - [Cards](#cards) - [Create Charge](#create-charge) - [Reverse Authorization](#reverse-authorization) - [Capture Charge](#capture-charge) - [Get Charge](#get-charge) - [Create Refund](#create-refund) - [Cardless Credit](#cardless-credit) - [Create Cardless Credit Payment](#create-cardless-credit-payment) - [Calculate Payment Types](#calculate-payment-types) - [Customers](#customers) - [Create Customer](#create-customer) - [Get Customer by Reference ID](#get-customer-by-reference-id) - [Direct Debit](#direct-debit) - [Initialize linked account tokenization](#initialize-linked-account-tokenization) - [Validate OTP for Linked Account Token](#validate-otp-for-linked-account-token) - [Retrieve accessible accounts by linked account token](#retrieve-accessible-accounts-by-linked-account-token) - [Unbind linked account token](#unbind-linked-account-token) - [Create payment method](#create-payment-method) - [Get payment methods by customer ID](#get-payment-methods-by-customer-id) - [Create direct debit payment](#create-direct-debit-payment) - [Validate OTP for direct debit payment](#validate-otp-for-direct-debit-payment) - [Get direct debit payment by ID](#get-direct-debit-payment-by-id) - [Get direct debit payment by reference ID](#get-direct-debit-payment-by-reference-id) - [IDR Disbursements for Indonesia](#idr-disbursements-for-indonesia) - [Create an IDR Disbursement](#create-an-idr-disbursement) - [Create an IDR Batch Disbursement](#create-an-idr-batch-disbursement) - [Get an IDR Disbursement by ID](#get-an-idr-disbursement-by-id) - [Get an IDR Disbursement by External ID](#get-an-idr-disbursement-by-external-id) - [Get an IDR Disbursement Available Banks](#get-an-idr-disbursement-available-banks) - [PHP Disbursements for Philippines](#php-disbursements-for-philippines) - [Create a PHP Disbursement](#create-a-php-disbursement) - [Get a PHP Disbursement by ID](#get-a-php-disbursement-by-id) - [Get a PHP Disbursement by Reference ID](#get-a-php-disbursement-by-reference-id) - [Disbursement Channels](#disbursement-channels) - [Get Disbursement Channels](#get-disbursement-channels) - [Get Disbursement Channels By Channel Category](#get-disbursement-channels-by-channel-category) - [Get Disbursement Channels By Channel Code](#get-disbursement-channels-by-channel-code) - [E-Wallets](#e-wallets) - [Create E-Wallet Charge](#create-e-wallet-charge) - [Get E-Wallet Charge Status](#get-e-wallet-charge-status) - [Void E-Wallet Charge](#void-e-wallet-charge) - [Refund E-Wallet Charge](#refund-e-wallet-charge) - [Get Refund By ID](#get-refund-by-id) - [List Refunds](#list-refunds) - [Invoice](#invoice) - [Create Invoice](#create-invoice) - [Get Invoice](#get-invoice) - [Get All Invoice](#get-all-invoice) - [Expire Invoice](#expire-invoice) - [Paylater](#paylater) - [Initiate PayLater Plans](#initiate-paylater-plans) - [Create PayLater Charges](#create-paylater-charges) - [Get PayLater Charge by ID](#get-paylater-charge-by-id) - [Refund PayLater Charge](#refund-paylater-charge) - [Get PayLater Refund by ID](#get-paylater-refund-by-id) - [List PayLater Refunds](#list-paylater-refunds) - [Payouts](#payouts) - [Create a Payout](#create-payout) - [Get a Payout](#get-payout) - [Void a Payout](#void-payout) - [QR Code](#qr-code) - [Create a QR Code](#create-a-qr-code) - [Get QR Code](#get-qr-code) - [Recurring](#recurring-payments) - [Create a Recurring Payment](#create-a-recurring-payment) - [Get a Recurring Payment](#get-a-recurring-payment) - [Edit a Recurring Payment](#edit-recurring-payment) - [Pause a Recurring Payment](#pause-recurring-payment) - [Stop a Recurring Payment](#stop-recurring-payment) - [Resume a Recurring Payment](#resume-recurring-payment) - [Retail Outlets](#retail-outlets) - [Create Fixed Payment Code](#create-fixed-payment-code) - [Update Fixed Payment Code](#update-fixed-payment-code) - [Get Fixed Payment Code](#get-fixed-payment-code) - [Virtual Accounts](#virtual-accounts) - [Create Fixed Virtual Account](#create-fixed-virtual-account) - [Get Virtual Account Bank](#get-virtual-account-bank) - [Get Fixed Virtual Account](#get-fixed-virtual-account) - [Update Fixed Virtual Account](#update-fixed-virtual-account) - [Get Fixed Virtual Account Payment](#get-fixed-virtual-account-payment) - [xenPlatform](#xenplatform) - [Create Account](#create-account) - [Get Account](#get-account) - [Update Account](#update-account) - [Create Transfers](#create-transfers) - [Create Fee Rule](#create-fee-rule) - [Set Callback URLs](#set-callback-urls) - [Transaction](#transaction) - [List of transactions](#list-of-transactions) - [Detail of transaction](#detail-of-transaction) - [Report](#report) - [Generate Report](#generate-report) - [Detail of Report](#detail-of-report) - [Exceptions](#exceptions) - [InvalidArgumentException](#invalidargumentexception) - [ApiException](#apiexception) - [Contributing](#contributing) - [Test](#tests) - [Running test suite](#running-test-suite) - [Running examples](#running-examples) --- ## Documentation For the API documentation, check [Xendit API Reference](https://xendit.github.io/apireference). ## Installation Install xendit-php-clients with composer by following command: ```bash composer require xendit/xendit-php ``` or add it manually in your `composer.json` file. ### Update from v1.4.0 to v2.0.0 To update xendit-php-clients with composer, use the following command: ```bash composer update xendit/xendit-php ``` To migrate, see [MIGRATE.md](MIGRATE.md) for more information. ## Usage Configure package with your account's secret key obtained from [Xendit Dashboard](https://dashboard.xendit.co/settings/developers#api-keys). ```php Xendit::setApiKey('secretKey'); ``` See [example codes](./examples) for more details. ### Use Custom HTTP Client A custom HTTP Client that implements [HttpClientInterface](./src/HttpClientInterface.php) can be injected like so ```php Xendit::setHttpClient($client); ``` Checkout [custom http client example](./examples/CustomHttpClient.php) for implementation reference. ## Methods' Signature and Examples ### Balance #### Get Balance ```php $params = array( 'for-user-id' => '' //The sub-account user-id that you want to make this transaction for (Optional). ); \Xendit\Balance::getBalance(string $account_type, array $params); ``` Usage example: ```php $getBalance = \Xendit\Balance::getBalance('CASH'); var_dump($getBalance); ``` ### Payment Channels #### Get Payment Channels GetPaymentChannels is in `maintenance mode`. Existing behavior on the endpoint will continue to work as before, but newer channels will be missing from the returned result. ```php \Xendit\PaymentChannels::list(); ``` Usage example: ```php $getPaymentChannels = \Xendit\PaymentChannels::list(); var_dump($getPaymentChannels); ``` ### Cards #### Create Charge ```php \Xendit\Cards::create(array $params); ``` Usage example: ```php $params = [ 'token_id' => '5e2e8231d97c174c58bcf644', 'external_id' => 'card_' . time(), 'authentication_id' => '5e2e8658bae82e4d54d764c0', 'amount' => 100000, 'card_cvn' => '123', 'capture' => false ]; $createCharge = \Xendit\Cards::create($params); var_dump($createCharge); ``` #### Reverse Authorization ```php \Xendit\Cards::reverseAuthorization(string $id, array $params); ``` Usage example: ```php $id = 'charge-id'; $params = ['external_id' => 'ext-id']; $reverseAuth = \Xendit\Cards::reverseAuthorization( $id, $params ); var_dump($reverseAuth); ``` #### Capture Charge ```php \Xendit\Cards::capture(string $id, array $params); ``` Usage example: ```php $id = 'charge-id'; $params = ['amount' => 100000]; $captureCharge = \Xendit\Cards::capture($id, $params); var_dump($captureCharge); ``` #### Get Charge ```php \Xendit\Cards::retrieve(string $id); ``` Usage example: ```php $id = 'charge-id'; $getCharge = \Xendit\Cards::retrieve($id); var_dump($getCharge); ``` #### Create Refund ```php \Xendit\Cards::createRefund(string $id, array $params); ``` Usage examples Without idempotency key: ```php $params = [ 'external_id' => 'ext-id', 'amount' => 20000 ]; $refund = \Xendit\Cards::createRefund($id, $params); var_dump($refund); ``` With idempotency key: ```php $params = [ 'external_id' => 'ext-id', 'amount' => 20000, 'X-IDEMPOTENCY-KEY' => 'unique-id' ]; $refund = \Xendit\Cards::createRefund($id, $params); var_dump($refund); ``` #### Create Promotion ```php \Xendit\Promotion::create(array $params); ``` usage examples: ```php $params = [ 'reference_id' => 'reference_123', 'description' => 'test promotion', 'currency' => 'IDR', 'start_time' => '2021-01-01T00:00:00.000Z', 'end_time' => '2021-01-02T00:00:00.000Z', 'promo_code' => 'testpromo', 'discount_amount' => 5000 ]; $createPromotion = \Xendit\Promotion::create($params); var_dump($createPromotion); ``` ### Cardless Credit #### Create Cardless Credit Payment ```php \Xendit\CardlessCredit::create(array $params); ``` Usage example: ```php $params = [ 'cardless_credit_type' => 'KREDIVO', 'external_id' => 'test-cardless-credit-02', 'amount' => 800000, 'payment_type' => '3_months', 'items' => [ [ 'id' => '123123', 'name' => 'Phone Case', 'price' => 200000, 'type' => 'Smartphone', 'url' => 'http=>//example.com/phone/phone_case', 'quantity' => 2 ], [ 'id' => '234567', 'name' => 'Bluetooth Headset', 'price' => 400000, 'type' => 'Audio', 'url' => 'http=>//example.com/phone/bluetooth_headset', 'quantity' => 1 ] ], 'customer_details' => [ 'first_name' => 'customer first name', 'last_name' => 'customer last name', 'email' => 'customer@yourwebsite.com', 'phone' => '081513114262' ], 'shipping_address' => [ 'first_name' => 'first name', 'last_name' => 'last name', 'address' => 'Jalan Teknologi No. 12', 'city' => 'Jakarta', 'postal_code' => '12345', 'phone' => '081513114262', 'country_code' => 'IDN' ], 'redirect_url' => 'https://example.com', 'callback_url' => 'http://example.com/callback-cardless-credit' ]; $createPayment = \Xendit\CardlessCredit::create($params); var_dump($createPayment); ``` #### Calculate Payment Types ```php \Xendit\CardlessCredit::calculatePaymentTypes(array $params); ``` Usage example: ```php $params = [ 'cardless_credit_type' => 'KREDIVO', 'amount' => 2000000, 'items' => [ [ 'id' => '123123', 'name' => 'Phone Case', 'price' => 1000000, 'type' => 'Smartphone', 'url' => 'http://example.com/phone/phone_case', 'quantity' => 2 ] ] ]; $calculatePaymentTypes = \Xendit\CardlessCredit::calculatePaymentTypes($params); var_dump($calculatePaymentTypes); ``` ### Customers #### Create Customer ```php \Xendit\Customers::createCustomer(array $params); ``` Usage example: ```php $customerParams = [ 'reference_id' => '' . time(), 'given_names' => 'customer 1', 'email' => 'customer@website.com', 'mobile_number' => '+6281212345678', 'description' => 'dummy customer', 'middle_name' => 'middle', 'surname' => 'surname', 'addresses' => [ [ 'country' => 'ID', 'street_line1' => 'Jl. 123', 'street_line2' => 'Jl. 456', 'city' => 'Jakarta Selatan', 'province' => 'DKI Jakarta', 'state' => '-', 'postal_code' => '12345' ] ], 'metadata' => [ 'meta' => 'data' ] ]; $createCustomer = \Xendit\Customers::createCustomer($customerParams); var_dump($createCustomer); ``` #### Get Customer by Reference ID ```php \Xendit\Customers::getCustomerByReferenceID(string $reference_id); ``` Usage example: ```php $reference_id = 'ref_id'; $getCustomer = \Xendit\Customers::getCustomerByReferenceID($reference_id); var_dump($getCustomer); ``` ### Direct Debit #### Initialize linked account tokenization ```php \Xendit\DirectDebit::initializeLinkedAccountTokenization(array $params); ``` Usage example: ```php $params = [ 'customer_id' => '4b7b6050-0830-440a-903b-37d527dbbaa9', 'channel_code' => 'DC_BRI', 'properties' => [ 'account_mobile_number' => '+62818555988', 'card_last_four' => '8888', 'card_expiry' => '06/24', 'account_email' => 'test.email@xendit.co' ], 'metadata' => [ 'meta' => 'data' ] ]; $initializeTokenization = \Xendit\DirectDebit::initializeLinkedAccountTokenization($params); var_dump($initializeTokenization); ``` #### Validate OTP for Linked Account Token ```php \Xendit\DirectDebit::validateOTPForLinkedAccount(string $linked_account_token_id, array $params); ``` Usage example: ```php $params = [ 'otp_code' => '333000' ]; $validateOTPForLinkedAccount = \Xendit\DirectDebit::validateOTPForLinkedAccount( 'lat-a08fba1b-100c-445b-b788-aaeaf8215e8f', $params ); var_dump($validateOTPForLinkedAccount); ``` #### Retrieve accessible accounts by linked account token ```php \Xendit\DirectDebit::retrieveAccessibleLinkedAccounts(string $linked_account_token_id); ``` Usage example: ```php $retrieveAccessibleLinkedAccounts = \Xendit\DirectDebit::retrieveAccessibleLinkedAccounts( 'lat-a08fba1b-100c-445b-b788-aaeaf8215e8f' ); var_dump($retrieveAccessibleLinkedAccounts); ``` #### Unbind linked account token ```php \Xendit\DirectDebit::unbindLinkedAccountToken(string $linked_account_token_id); ``` Usage example: ```php $unbindLinkedAccountToken = \Xendit\DirectDebit::unbindLinkedAccountToken( 'lat-a08fba1b-100c-445b-b788-aaeaf8215e8f' ); var_dump($unbindLinkedAccountToken); ``` #### Create payment method ```php \Xendit\DirectDebit::createPaymentMethod(array $params); ``` Usage example: ```php $params = [ 'customer_id' => '4b7b6050-0830-440a-903b-37d527dbbaa9', 'type' => 'DEBIT_CARD', 'properties' => [ 'id' => 'la-052d3e2d-bc4d-4c98-8072-8d232a552299' ], 'metadata' => [ 'meta' => 'data' ] ]; $createPaymentMethod = \Xendit\DirectDebit::createPaymentMethod($params); var_dump($createPaymentMethod); ``` #### Get payment methods by customer ID ```php \Xendit\DirectDebit::getPaymentMethodsByCustomerID(string $customer_id); ``` Usage example: ```php $getPaymentMethods = \Xendit\DirectDebit::getPaymentMethodsByCustomerID('4b7b6050-0830-440a-903b-37d527dbbaa9'); var_dump($getPaymentMethods); ``` #### Create direct debit payment ```php \Xendit\DirectDebit::createDirectDebitPayment(array $params); ``` Usage example: ```php $params = [ 'reference_id' => 'test-direct-debit-ref', 'payment_method_id' => 'pm-ebb1c863-c7b5-4f20-b116-b3071b1d3aef', 'currency' => 'IDR', 'amount' => 15000, 'callback_url' => 'http://webhook.site/', 'enable_otp' => true, 'description' => 'test description', 'basket' => [ [ 'reference_id' => 'basket-product-ref-id', 'name' => 'product name', 'category' => 'mechanics', 'market' => 'ID', 'price' => 50000, 'quantity' => 5, 'type' => 'product type', 'sub_category' => 'product sub category', 'description' => 'product description', 'url' => 'https://product.url' ] ], 'device' => [ 'id' => 'device_id', 'ip_address' => '0.0.0.0', 'ad_id' => 'ad-id', 'imei' => '123a456b789c' ], 'success_redirect_url' => 'https://success-redirect.url', 'failure_redirect_url' => 'https://failure-redirect.url', 'metadata' => [ 'meta' => 'data' ], 'Idempotency-key' => '' . time() ]; $createDirectDebitPayment = \Xendit\DirectDebit::createDirectDebitPayment( $params ); var_dump($createDirectDebitPayment); ``` #### Validate OTP for direct debit payment ```php \Xendit\DirectDebit::validateOTPForDirectDebitPayment( string $direct_debit_payment_id, array $params ); ``` Usage example: ```php $params = [ 'otp_code' => '222000' ]; $validateOTPForDirectDebitPayment = \Xendit\DirectDebit::validateOTPForDirectDebitPayment( 'ddpy-7e61b0a7-92f9-4762-a994-c2936306f44c', $params ); var_dump($validateOTPForDirectDebitPayment); ``` #### Get direct debit payment by ID ```php \Xendit\DirectDebit::getDirectDebitPaymentByID( string $direct_debit_payment_id ); ``` Usage example: ```php $getDirectDebitPaymentByID = \Xendit\DirectDebit::getDirectDebitPaymentByID( 'ddpy-7e61b0a7-92f9-4762-a994-c2936306f44c' ); var_dump($getDirectDebitPaymentByID); ``` #### Get direct debit payment by reference ID ```php \Xendit\DirectDebit::getDirectDebitPaymentByReferenceID( string $reference_id ); ``` Usage example: ```php $getDirectDebitPaymentByReferenceID = \Xendit\DirectDebit::getDirectDebitPaymentByReferenceID( 'test-direct-debit-ref' ); var_dump($getDirectDebitPaymentByReferenceID); ``` ### IDR Disbursements for Indonesia #### Create an IDR Disbursement ```php \Xendit\Disbursements::create(array $params); ``` Usage examples Without idempotency key: ```php $params = [ 'external_id' => 'disb-12345678', 'amount' => 15000, 'bank_code' => 'BCA', 'account_holder_name' => 'Joe', 'account_number' => '1234567890', 'description' => 'Disbursement from Example' ]; $createDisbursements = \Xendit\Disbursements::create($params); var_dump($createDisbursements); ``` With idempotency key: ```php $params = [ 'external_id' => 'disb-12345678', 'amount' => 15000, 'bank_code' => 'BCA', 'account_holder_name' => 'Joe', 'account_number' => '1234567890', 'description' => 'Disbursement from Example', 'X-IDEMPOTENCY-KEY' => 'unique-id' ]; $createDisbursements = \Xendit\Disbursements::create($params); var_dump($createDisbursements); ``` #### Create an IDR Batch Disbursement ```php \Xendit\Disbursements::createBatch(array $params); ``` Usage example: ```php $batch_params = [ 'reference' => 'disb_batch-12345678', 'disbursements' => [ [ 'amount' => 20000, 'bank_code' => 'BCA', 'bank_account_name' => 'Fadlan', 'bank_account_number' => '1234567890', 'description' => 'Batch Disbursement', 'external_id' => 'disbursement-1' ], [ 'amount' => 30000, 'bank_code' => 'MANDIRI', 'bank_account_name' => 'Lutfi', 'bank_account_number' => '1234567891', 'description' => 'Batch Disbursement with email notifications', 'external_id' => 'disbursement-2', 'email_to' => ['test+to@xendit.co'], 'email_cc' => ['test+cc@xendit.co'], 'email_bcc' => ['test+bcc1@xendit.co', 'test+bcc2@xendit.co'] ] ] ]; $createBatchDisbursements = \Xendit\Disbursements::createBatch($batch_params); var_dump($createBatchDisbursements); ``` #### Get an IDR Disbursement by ID ```php \Xendit\Disbursements::retrieve(string $id, array $params); ``` Usage example: ```php $id = 'disbursements-id'; $retrieveParams = [ 'for-user-id' => 'test-reference-user-id' ] $getDisbursements = \Xendit\Disbursements::retrieve($id, $retrieveParams); var_dump($getDisbursements); ``` #### Get an IDR Disbursement by External ID ```php \Xendit\Disbursements::retrieveExternal(string $external_id); ``` Usage example: ```php $external_id = 'disbursements-ext-id'; $getDisbursementsByExt = \Xendit\Disbursements::retrieveExternal($external_id); var_dump($getDisbursementsByExt); ``` #### Get an IDR Disbursement Available Banks ```php \Xendit\Disbursements::getAvailableBanks(); ``` Usage example: ```php $getDisbursementsBanks = \Xendit\Disbursements::getAvailableBanks(); var_dump($getDisbursementsBanks); ``` ### PHP Disbursements for Philippines #### Create a PHP Disbursement ```php \Xendit\DisbursementsPHP::createPHPDisbursement(array $params); ``` Usage examples Without optional fields: ```php $params = [ 'reference_id' => 'reference_id', 'currency' => 'PHP', 'amount' => 15000, 'channel_code' => 'PH_BDO', 'account_name' => 'Test', 'account_number' => '1234567890', 'description' => 'PHP Disbursement from Example', 'xendit-idempotency-key' => 'unique-id' ]; $createDisbursements = \Xendit\DisbursementsPHP::createPHPDisbursement($params); var_dump($createDisbursements); ``` With beneficiary optional field: ```php $params = [ 'reference_id' => 'reference_id', 'currency' => 'PHP', 'amount' => 15000, 'channel_code' => 'PH_BDO', 'account_name' => 'Test', 'account_number' => '1234567890', 'description' => 'PHP Disbursement from Example', 'xendit-idempotency-key' => 'unique-id', 'beneficiary' => [ 'type' => 'INDIVIDUAL', 'given_names' => 'Test Name', 'middle_name' => 'middle_name', 'surname' => 'surname', 'business_name' => 'business_name', 'street_line1' => 'street_line1', 'street_line2' => 'street_line2', 'city' => 'city', 'province' => 'province', 'state' => 'state', 'country' => 'country', 'zip_code' => '12345', 'mobile_number' => '9876543210', 'phone_number' => '987654321', 'email' => 'email@test.com' ] ]; $createDisbursementsWithbeneficiary = \Xendit\DisbursementsPHP::createPHPDisbursement($params); var_dump($createDisbursementsWithbeneficiary); ``` With receipt_notification optional field: ```php $params = [ 'reference_id' => 'reference_id', 'currency' => 'PHP', 'amount' => 15000, 'channel_code' => 'PH_BDO', 'account_name' => 'Test', 'account_number' => '1234567890', 'description' => 'PHP Disbursement from Example', 'xendit-idempotency-key' => 'unique-id', 'beneficiary' => [ 'type' => 'INDIVIDUAL', 'given_names' => 'Test Name', 'middle_name' => 'middle_name', 'surname' => 'surname', 'business_name' => 'business_name', 'street_line1' => 'street_line1', 'street_line2' => 'street_line2', 'city' => 'city', 'province' => 'province', 'state' => 'state', 'country' => 'country', 'zip_code' => '12345', 'mobile_number' => '9876543210', 'phone_number' => '987654321', 'email' => 'email@test.com' ], 'receipt_notification' => [ 'email_to' => ['test@test.com'], 'email_cc' => [], 'email_bcc' => [] ] ]; $createDisbursementsWithReceipt = \Xendit\DisbursementsPHP::createPHPDisbursement($params); var_dump($createDisbursementsWithReceipt); ``` #### Get a PHP Disbursement by ID ```php \Xendit\DisbursementsPHP::getPHPDisbursementByID(string $id, array $params); ``` Usage example: ```php $id = 'php-disbursements-id'; $retrieveParams = [ 'for-user-id' => 'test-reference-user-id' ] $getDisbursements = \Xendit\DisbursementsPHP::getPHPDisbursementByID($id, $retrieveParams); var_dump($getDisbursements); ``` #### Get a PHP Disbursement by Reference ID ```php \Xendit\DisbursementsPHP::getPHPDisbursementsByReferenceID(string $reference_id); ``` Usage example: ```php $reference_id = 'reference_id'; $getDisbursementsByRef = \Xendit\DisbursementsPHP::getPHPDisbursementsByReferenceID($reference_id); var_dump($getDisbursementsByRef); ``` ### Disbursement Channels #### Get Disbursement Channels ```php \Xendit\DisbursementChannels::getDisbursementChannels(); ``` Usage examples ```php $disbursementChannels = \Xendit\DisbursementChannels::getDisbursementChannels(); var_dump($disbursementChannels); ``` #### Get Disbursement Channels By Channel Category ```php \Xendit\DisbursementChannels::getDisbursementChannelsByChannelCategory(string $channelCategory); ``` Usage examples ```php $channelCategory = 'Test'; $getdisbursementChannelsByCategory = \Xendit\DisbursementChannels::getDisbursementChannelsByChannelCategory($channelCategory); var_dump($getdisbursementChannelsByCategory); ``` #### Get Disbursement Channels By Channel Code ```php \Xendit\DisbursementChannels::getDisbursementChannelsByChannelCode(string $channelCode); ``` Usage examples ```php $channelCode = 'Test'; $getdisbursementChannelsByCode = \Xendit\DisbursementChannels::getDisbursementChannelsByChannelCode($channelCode); var_dump($getdisbursementChannelsByCode); ``` ### E-Wallets #### Create E-Wallet Charge ```php \Xendit\EWallets::createEWalletCharge(array $params); ``` For more information about the params, please check [Xendit API Reference - E-Wallets](https://developers.xendit.co/api-reference/#create-ewallet-charge). Usage example: ```php $ewalletChargeParams = [ 'reference_id' => 'test-reference-id', 'currency' => 'IDR', 'amount' => 50000, 'checkout_method' => 'ONE_TIME_PAYMENT', 'channel_code' => 'ID_SHOPEEPAY', 'channel_properties' => [ 'success_redirect_url' => 'https://yourwebsite.com/order/123', ], 'metadata' => [ 'meta' => 'data' ] ]; $createEWalletCharge = \Xendit\EWallets::createEWalletCharge($ewalletChargeParams); var_dump($createEWalletCharge); ``` #### Get E-Wallet Charge Status ```php \Xendit\EWallets::getEWalletChargeStatus(string $charge_id, array $params); ``` Usage example: ```php $charge_id = 'ewc_f3925450-5c54-4777-98c1-fcf22b0d1e1c'; $eWalletStatusParam = [ 'for-user-id' => 'test-reference-user-id' ] $getEWalletChargeStatus = \Xendit\EWallets::getEWalletChargeStatus($charge_id, $eWalletStatusParam); var_dump($getEWalletChargeStatus); ``` #### Void E-Wallet Charge ```php \Xendit\EWallets::voidEwalletCharge(string $charge_id,array $params); ``` Usage example: ```php $charge_id = 'ewc_f3925450-5c54-4777-98c1-fcf22b0d1e1c'; $voidEwalletChargeParam = [ 'for-user-id' => 'test-reference-user-id' // OPTIONAL ] $voidEwalletCharge = \Xendit\EWallets::voidEwalletCharge($charge_id, $voidEwalletChargeParam); var_dump($voidEwalletCharge); ``` #### Refund E-Wallet Charge ```php \Xendit\EWallets::refundEwalletCharge(string $charge_id,array $params); ``` Usage example: ```php $charge_id = 'ewc_f3925450-5c54-4777-98c1-fcf22b0d1e1c'; $refundEwalletChargeParam = [ 'for-user-id' => 'test-reference-user-id' // OPTIONAL ] $refundEwalletCharge = \Xendit\EWallets::refundEwalletCharge($charge_id, $refundEwalletChargeParam); var_dump($refundEwalletCharge); ``` #### Get Refund By ID ```php \Xendit\EWallets::getRefund(string $charge_id,string $refund_id, array $params); ``` Usage example: ```php $charge_id = 'ewc_f3925450-5c54-4777-98c1-fcf22b0d1e1c'; $refund_id = 'ewr_532as23lew2321id'; $getRefundEwalletChargeParam = [ 'for-user-id' => 'test-reference-user-id' // OPTIONAL ] $getRefundEwalletCharge = \Xendit\EWallets::getRefund($charge_id, $refund_id, $getRefundEwalletChargeParam); var_dump($getRefundEwalletCharge); ``` #### List Refunds ```php \Xendit\EWallets::listRefund(string $charge_id, array $params); ``` Usage example: ```php $charge_id = 'ewc_f3925450-5c54-4777-98c1-fcf22b0d1e1c'; $listRefundEwalletChargeParam = [ 'for-user-id' => 'test-reference-user-id' // OPTIONAL ] $listRefundEwalletCharge = \Xendit\EWallets::listRefund($charge_id, $getRefundEwalletChargeParam); var_dump($listRefundEwalletCharge); ``` ### Invoice #### Create Invoice ```php \Xendit\Invoice::create(array $params); ``` Usage example: ```php $params = ['external_id' => 'demo_147580196270', 'payer_email' => 'sample_email@xendit.co', 'description' => 'Trip to Bali', 'amount' => 32000, 'for-user-id' => '5c2323c67d6d305ac433ba20' ]; $createInvoice = \Xendit\Invoice::create($params); var_dump($createInvoice); ``` #### Get Invoice ```php \Xendit\Invoice::retrieve(string $id, array $params); ``` Usage example: ```php $id = 'invoice-id'; $retrieveParam = [ 'for-user-id' => 'test-reference-user-id' // OPTIONAL ]; $getInvoice = \Xendit\Invoice::retrieve($id, $retrieveParam); var_dump($getInvoice); ``` #### Get All Invoice ```php \Xendit\Invoice::retrieveAll(array $params); ``` Usage example: ```php $retrieveAllParam = [ 'for-user-id' => 'test-reference-user-id' // OPTIONAL ]; $getAllInvoice = \Xendit\Invoice::retrieveAll($retrieveAllParam); var_dump(($getAllInvoice)); ``` #### Expire Invoice ```php \Xendit\Invoice::expireInvoice(string $id, array $params); ``` Usage example: ```php $id = 'invoice-id'; $params = [ 'for-user-id' => 'test-reference-user-id' // OPTIONAL ]; $expireInvoice = \Xendit\Invoice::expireInvoice($id, $params); var_dump($expireInvoice); ``` ### Paylater #### Initiate PayLater Plans ```php \Xendit\PayLater::initiatePayLaterPlans(array $params); ``` Usage example: ```php $params = [ 'customer_id' => '', 'channel_code' => 'ID_KREDIVO', 'currency' => 'IDR', 'amount' => 6000000, 'order_items' => [ [ 'type' => 'PHYSICAL_PRODUCT', 'reference_id' => '1533', 'name' => 'Mobile Phone', 'net_unit_amount' => 6000000, 'quantity' => 1, 'url' => '', 'category' => 'Smartphone' ] ] ]; $payLaterPlan = \Xendit\PayLater::initiatePayLaterPlans($params); var_dump($payLaterPlan); ``` #### Create Paylater Charges ```php \Xendit\PayLater::createPayLaterCharge(array $params); ``` Usage example: ```php $params = [ 'plan_id' => $payLaterPlan['id'], 'reference_id' => 'order_id_' . time(), 'checkout_method' => 'ONE_TIME_PAYMENT', 'success_redirect_url' => '', 'failure_redirect_url' => '', ]; $payLaterCharge = \Xendit\PayLater::createPayLaterCharge($params); var_dump($payLaterCharge); ``` #### Get PayLater Charge by ID ```php \Xendit\PayLater::getPayLaterChargeStatus($id, array $params); ``` Usage example: ```php $params = []; // Optional (You can put for-user-id if needed) $id = ''; $payLaterCharge = \Xendit\PayLater::getPayLaterChargeStatus($id, $params); var_dump($payLaterCharge); ``` #### Refund Paylater Charge ```php \Xendit\PayLater::createPayLaterRefund($id, array $params); ``` Usage example: ```php $params = []; // Optional (You can put for-user-id if needed) $id = ''; $payLaterCharge = \Xendit\PayLater::createPayLaterRefund($id, $params); var_dump($payLaterCharge); ``` #### Create Paylater Refund ```php \Xendit\PayLater::createPayLaterRefund($id, array $params); ``` Usage example: ```php $params = []; // Optional (You can put for-user-id if needed) $id = ''; $payLaterChargeRefundCreate = \Xendit\PayLater::createPayLaterRefund($id, $params); var_dump($payLaterChargeRefundCreate); ``` #### Get PayLater Refund by ID ```php \Xendit\PayLater::getPayLaterRefund($charge_id, $refund_id, array $params); ``` Usage example: ```php $params = []; // Optional (You can put for-user-id if needed) $charge_id = ''; $refund_id = ''; $payLaterChargeRefund = \Xendit\PayLater::getPayLaterRefund($charge_id, $refund_id, $params); var_dump($payLaterChargeRefund); ``` #### List PayLater Refunds ```php \Xendit\PayLater::listPayLaterRefund($charge_id, array $params); ``` Usage example: ```php $params = []; // Optional (You can put for-user-id if needed) $charge_id = ''; $payLaterChargeRefundList = \Xendit\PayLater::listPayLaterRefund($charge_id, $params); var_dump($payLaterChargeRefundList); ``` #### Void Payout ```php \Xendit\Payouts::void(string $id); ``` Usage example: ```php $id = 'payout-id'; $voidPayout = \Xendit\Payouts::void($id); var_dump($voidPayout); ``` ### Payouts #### Create Payout ```php \Xendit\Payouts::create(array $params); ``` Usage example: ```php $params = [ 'external_id' => 'payouts-123456789', 'amount' => 50000 ]; $createPayout = \Xendit\Payouts::create($params); var_dump($createPayout); ``` #### Get Payout ```php \Xendit\Payouts::retrieve(string $id, array $params); ``` Usage example: ```php $id = 'payout-id'; $params = [ 'for-user-id' => 'test-reference-user-id' // OPTIONAL ] $getPayout = \Xendit\Payouts::retrieve($id, $params); var_dump($getPayout); ``` #### Void Payout ```php \Xendit\Payouts::void(string $id); ``` Usage example: ```php $id = 'payout-id'; $voidPayout = \Xendit\Payouts::void($id); var_dump($voidPayout); ``` ### QR Code #### Create a QR Code ```php \Xendit\QRCode::create(array $params); ``` Usage example: ```php $params = [ 'external_id' => 'demo_123456', 'type' => 'STATIC', 'callback_url' => 'https://webhook.site', 'amount' => 10000, ]; $qr_code = \Xendit\QRCode::create($params); var_dump($qr_code) ``` #### Get QR Code ```php \Xendit\QRCode::get(string $external_id); ``` Usage example: ```php $qr_code = \Xendit\QRCode::get('external_123'); var_dump($qr_code); ``` ### Recurring Payments #### Create a Recurring Payment ```php \Xendit\Recurring::create(array $params); ``` Usage example: ```php $params = [ 'external_id' => 'demo_147580196270', 'payer_email' => 'sample_email@xendit.co', 'description' => 'Trip to Bali', 'amount' => 32000, 'interval' => 'MONTH', 'interval_count' => 1 ]; $createRecurring = \Xendit\Recurring::create($params); var_dump($createRecurring); ``` #### Get a Recurring Payment ```php \Xendit\Recurring::retrieve(string $id, array $params); ``` Usage example: ```php $id = 'recurring-payment-id'; $params = [ 'for-user-id' => 'test-reference-user-id' // OPTIONAL ] $getRecurring = \Xendit\Recurring::retrieve($id, $params); var_dump($getRecurring); ``` #### Edit Recurring Payment ```php \Xendit\Recurring::update(string $id, array $params); ``` Usage example: ```php $id = 'recurring-payment-id'; $params = ['amount' => 10000]; $editRecurring = \Xendit\Recurring::update($id, $params); var_dump($editRecurring); ``` #### Stop Recurring Payment ```php \Xendit\Recurring::stop(string $id); ``` Usage example: ```php $id = 'recurring-payment-id'; $stopRecurring = \Xendit\Recurring::stop($id); var_dump($stopRecurring); ``` #### Pause Recurring Payment ```php \Xendit\Recurring::pause(string $id); ``` Usage example: ```php $id = 'recurring-payment-id'; $pauseRecurring = \Xendit\Recurring::pause($id); var_dump($pauseRecurring); ``` #### Resume Recurring Payment ```php \Xendit\Recurring::resume(string $id); ``` Usage example: ```php $id = 'recurring-payment-id'; $resumeRecurring = \Xendit\Recurring::resume($id); var_dump($resumeRecurring); ``` ### Retail Outlets #### Create Fixed Payment Code ```php \Xendit\Retail::create(array $params); ``` Usage example: ```php $params = [ 'external_id' => 'TEST-123456789', 'retail_outlet_name' => 'ALFAMART', 'name' => 'JOHN DOE', 'expected_amount' => 25000 ]; $createFPC = \Xendit\Retail::create($params); var_dump($createFPC); ``` #### Update Fixed Payment Code ```php \Xendit\Retail::update(string $id, array $params); ``` Usage example: ```php $id = 'FPC-id'; $updateParams = ['expected_amount' => 20000]; $updateFPC = \Xendit\Retail::update($id, $updateParams); var_dump($updateFPC); ``` #### Get Fixed Payment Code ```php \Xendit\Retail::retrieve(string $id); ``` Usage example: ```php $id = 'FPC-id'; $getFPC = \Xendit\Retail::retrieve($id); var_dump($getFPC); ``` ### Virtual Accounts #### Create Fixed Virtual Account ```php \Xendit\VirtualAccounts::create(array $params); ``` Usage example: ```php $params = ["external_id" => "VA_fixed-12341234", "bank_code" => "MANDIRI", "name" => "Steve Wozniak" ]; $createVA = \Xendit\VirtualAccounts::create($params); var_dump($createVA); ``` #### Get Virtual Account Bank ```php \Xendit\VirtualAccounts::getVABanks(); ``` Usage example: ```php $getVABanks = \Xendit\VirtualAccounts::getVABanks(); var_dump($getVABanks); ``` #### Get Fixed Virtual Account ```php \Xendit\VirtualAccounts::retrieve(string $id, array $params); ``` Usage example: ```php $id = 'VA-id'; $params = [ 'for-user-id' => 'test-reference-user-id' //OPTIONAL ] $getVA = \Xendit\VirtualAccounts::retrieve($id, $params); var_dump($getVA); ``` #### Update Fixed Virtual Account ```php \Xendit\VirtualAccounts::update(string $id, array $params); ``` Usage example: ```php $id = 'VA-id'; $updateParams = ["suggested_amount" => 1000]; $updateVA = \Xendit\VirtualAccounts::update($id, $updateParams); var_dump($updateVA); ``` #### Get Fixed Virtual Account Payment ```php \Xendit\VirtualAccounts::getFVAPayment(string $paymentID); ``` Usage example: ```php $paymentID = 'payment-ID'; $getFVAPayment = \Xendit\VirtualAccounts::getFVAPayment($paymentID); var_dump($getFVAPayment); ``` ### xenPlatform #### Create Account ```php \Xendit\Platform::createAccount(array $params); ``` Usage example: ```php $params = [ 'email' => 'customer@website.com', 'type' => 'OWNED', 'public_profile' => ['business_name' => 'customer company'] ]; $createAccount = \Xendit\Platform::createAccount(array $params); var_dump($createAccount); ``` #### Get Account ```php \Xendit\Platform::getAccount(string $account_id); ``` Usage example: ```php $getAccount = \Xendit\Platform::getAccount($accountId); var_dump($getAccount); ``` #### Update Account ```php $updateAccount = \Xendit\Platform::updateAccount(string $account_id, array $params); ``` Usage example: ```php $updateParams = [ 'email' => 'customer@website.com', 'public_profile' => ['business_name' => 'customer company updated'] ]; $updateAccount = \Xendit\Platform::updateAccount($accountId, $updateParams); var_dump($updateAccount); ``` #### Create Transfers ```php $createTransfer = \Xendit\Platform::createTransfer(array $transferParams); ``` Usage example: ```php $transferParams = [ 'reference' => ''.time(), 'amount' => 50000, 'source_user_id' => '54afeb170a2b18519b1b8768', 'destination_user_id' => '5cafeb170a2b1851246b8768', ]; $createTransfer = \Xendit\Platform::createTransfer($transferParams); var_dump($createTransfer); ``` #### Create Fee Rule ```php $createFeeRule = \Xendit\Platform::createFeeRule(array $feeRuleParams); ``` Usage example: ```php $feeRuleParams = [ 'name' => 'standard_platform_fee', 'description' => 'Fee charged to insurance agents based in Java', 'unit' => 'flat', 'amount' => 6500, 'currency' => 'IDR' ]; $createFeeRule = \Xendit\Platform::createFeeRule($feeRuleParams); var_dump($createFeeRule); ``` #### Set Callback URLs ```php $setCallbackUrl = \Xendit\Platform::setCallbackUrl(string $callbackType, array $callbackUrlParams); ``` Usage example: ```php $callbackUrlParams = [ 'url' => 'https://webhook.site/c9c9140b-96b8-434c-9c59-7440eeae4d7f' ]; $callbackType = 'invoice'; $setCallbackUrl = \Xendit\Platform::setCallbackUrl($callbackType, $callbackUrlParams); var_dump($setCallbackUrl); ``` ### Transaction #### List of Transactions ```php \Xendit\Transaction::list(array $params); ``` Usage example: ```php $params = [ 'types' => 'DISBURSEMENT' 'for-user-id' => 'Your User Id', //Optional 'query-param'=> 'true' //This is to enable parameters as query strings ]; $transactions = \Xendit\Transaction::list(array $params); var_dump($transactions); ``` #### Detail of Transaction ```php \Xendit\Transaction::detail(string $transaction_id); ``` Usage example: ```php $detailTransaction = \Xendit\Transaction::detail(string $transaction_id); var_dump($detailTransaction); ``` ### Report #### Generate Report ```php \Xendit\Report::generate(array $params); ``` Usage example: ```php $params = [ 'type' => 'TRANSACTIONS' ]; $generate = \Xendit\Report::generate($params); var_dump($generate); ``` #### Detail of Report ```php \Xendit\Report::detail(string $report_id); ``` Usage example: ```php $detailReport = \Xendit\Report::detail('report_5c1b34a2-6ceb-4c24-aba9-c836bac82b28'); var_dump($detailReport); ``` ## Exceptions ### InvalidArgumentException `InvalidArgumentException` will be thrown if the argument provided by user is not sufficient to create the request. For example, there are required arguments such as `external_id`, `payer_email`, `description`, and `amount` to create an invoice. If user lacks one or more arguments when attempting to create one, `InvalidArgumentException` will be thrown. `InvalidArgumentException` is derived from PHP's `InvalidArgumentException`. For more information about this Exception methods and properties, please check [PHP Documentation](https://www.php.net/manual/en/class.invalidargumentexception.php). ### ApiException `ApiException` wraps up Xendit API error. This exception will be thrown if there are errors from Xendit API side, e.g. get fixed virtual account with invalid `id`. To get exception message: ```php try { $getInvoice = \Xendit\Invoice::retrieve('123'); } catch (\Xendit\Exceptions\ApiException $e) { var_dump($e->getMessage()); } ``` To get exception HTTP error code: ```php try { $getInvoice = \Xendit\Invoice::retrieve('123'); } catch (\Xendit\Exceptions\ApiException $e) { var_dump($e->getCode()); } ``` To get exception Xendit API error code: ```php try { $getInvoice = \Xendit\Invoice::retrieve('123'); } catch (\Xendit\Exceptions\ApiException $e) { var_dump($e->getErrorCode()); } ``` ## Contributing For any requests, bugs, or comments, please open an [issue](https://github.com/xendit/xendit-php-clients/issues) or [submit a pull request](https://github.com/xendit/xendit-php-clients/pulls). ### Installing Packages Before you start to code, run this command to install all of the required packages. Make sure you have `composer` installed in your computer ```bash composer install ``` ### Tests #### Running test suite: ```bash vendor\bin\phpunit tests ``` #### Running examples: ```bash php examples\InvoiceExample.php ``` There is a pre-commit hook to run phpcs and phpcbf. Please make sure they passed before making commits/pushes. PKZss$xendit-php/.github/workflows/php.ymlnu[name: Continuous Integration on: push: branches: [ master ] pull_request: branches: [ master ] jobs: build: runs-on: ubuntu-latest strategy: matrix: php: ['7.0', '7.1', '7.2', '7.3', '7.4'] name: Test with php version ${{ matrix.php }} steps: - uses: actions/checkout@v2 - name: Validate composer.json and composer.lock run: composer validate - name: Cache Composer packages id: composer-cache uses: actions/cache@v2 with: path: vendor key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} restore-keys: | ${{ runner.os }}-php- - name: Install dependencies if: steps.composer-cache.outputs.cache-hit != 'true' run: composer install --prefer-dist --no-progress --no-suggest - name: Run test suite run: vendor/bin/phpunit tests PKZN8> > xendit-php/MIGRATE.mdnu[# Migrations ## v1.4.0 to v2.0.0 ### New package name For standardization purpose, package `xendit-php-clients` will be renamed to `xendit-php`. To install this package with `composer`, run command: ```bash composer require xendit/xendit-php ``` To update with `composer`, run command: ```bash composer update xendit/xendit-php ``` ### Instantiate API Key In the v1.4.0, secret API key is instantiated inside the config file. However in v2.0.0, secret API key is instantiated with: ```php Xendit::setApiKey('secretKey'); ``` ### Calling methods In v2.0.0, we restructured classes based on product, so it will impact on how the method is called. #### Create Invoice In v1.4.0, we used the following command to create an invoice: ```php $external_id = 'demo_147580196270'; $payer_email = 'sample_email@xendit.co'; $description = 'Trip to Bali'; $amount = 32000; $response = $xenditPHPClient->createInvoice($external_id, $amount, $payer_email, $description); ``` In v2.0.0, we will use this command to create an invoice: ```php $params = ['external_id' => 'demo_147580196270', 'payer_email' => 'sample_email@xendit.co', 'description' => 'Trip to Bali', 'amount' => 32000 ]; $response = \Xendit\Invoice::create($params); ``` #### Get Invoice In v1.4.0, to get an invoice: ```php $response = $xenditPHPClient->getInvoice($invoice_id); ``` In v2.0.0, to get an invoice: ```php $response = \Xendit\Invoice::retrieve($id); ``` #### Create Disbursement In v1.4.0, to create a disbursement: ```php $external_id = 'disb-12345678'; $amount = 15000; $bank_code = 'BCA'; $account_holder_name = 'Joe'; $account_number = '1234567890'; $response = $xenditPHPClient->createDisbursement($external_id, $amount, $bank_code, $account_holder_name, $account_number); ``` In v2.0.0, to create a disbursement: ```php $params = [ 'external_id'=> 'disb-12345678', 'amount'=> 15000, 'bank_code'=> 'BCA', 'account_holder_name'=> 'Joe', 'account_number'=> '1234567890', 'description'=>'Disbursement from Example' ]; $response = \Xendit\Disbursements::create($params); ``` #### Get Balance In v1.4.0, to get current balance: ```php $response = $xenditPHPClient->getBalance(); ``` In v2.0.0, to get current balance: ```php $response = \Xendit\Balance::getBalance('CASH'); ``` #### Capture Credit Card Payment In v1.4.0, to capture a credit card payment: ```php $external_id = 'ext-id'; $token_id = 'token-id'; $amount = 100000; $response = $xenditPHPClient->captureCreditCardPayment($external_id, $token_id, $amount); ``` In v2.0.0, to capture a credit card payment: ```php $captureParams = ['amount' => 100000]; $response = \Xendit\Cards::capture($id, $captureParams); ``` #### Refund Credit Card Payment In v1.4.0, to refund credit card payment: ```php $id = 'id'; $amount = 20000; $external_id = 'ext-id'; $response = $xenditPHPClient->issueCreditCardRefund($id, $amount, $external_id); ``` In v2.0.0, to refund credit card payment: ```php $refundParams = [ 'external_id' => 'ext-id', 'amount' => 20000 ]; $response = \Xendit\Cards::createRefund($id, $refundParams); ```PKZOArr*xendit-php/examples/TransactionExample.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Xendit; require 'vendor/autoload.php'; Xendit::setApiKey('SECRET_API_KEY'); $params = [ 'types' => 'DISBURSEMENT', 'for-user-id' => '', 'query-param'=> 'true' ]; $list = \Xendit\Transaction::list($params); var_dump($list); $detail = \Xendit\Transaction::detail('txn_13dd178d-41fa-40b7-8fd3-f83675d6f413'); var_dump($detail); PKZC9*xendit-php/examples/DirectDebitExample.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Xendit; require 'vendor/autoload.php'; Xendit::setApiKey('SECRET_API_KEY'); $customerParams = [ 'reference_id' => '' . time(), 'given_names' => 'customer 1', 'email' => 'customer@website.com', 'mobile_number' => '+6281212345678', 'description' => 'dummy customer', 'middle_name' => 'middle', 'surname' => 'surname', 'addresses' => [ [ 'country' => 'ID', 'street_line1' => 'Jl. 123', 'street_line2' => 'Jl. 456', 'city' => 'Jakarta Selatan', 'province' => 'DKI Jakarta', 'state' => '-', 'postal_code' => '12345' ] ], 'metadata' => [ 'meta' => 'data' ] ]; $customer = \Xendit\Customers::createCustomer($customerParams); $linkedAccountTokenizationParams = [ 'customer_id' => $customer['id'], 'channel_code' => 'DC_BRI', 'properties' => [ 'account_mobile_number' => '+62818555988', 'card_last_four' => '8888', 'card_expiry' => '06/24', 'account_email' => 'test.email@xendit.co' ], 'metadata' => [ 'meta' => 'data' ] ]; echo "Initializing linked account tokenization...\n"; $initializeTokenization = \Xendit\DirectDebit::initializeLinkedAccountTokenization( $linkedAccountTokenizationParams ); var_dump($initializeTokenization); $validateOTPForLinkedAccountParams = [ 'otp_code' => '333000' ]; echo "Validating OTP for linked account token...\n"; $validateOTPForLinkedAccount = \Xendit\DirectDebit::validateOTPForLinkedAccount( $initializeTokenization['id'], $validateOTPForLinkedAccountParams ); var_dump($validateOTPForLinkedAccount); echo "Retrieving accessible linked accounts...\n"; $retrieveLinkedAccounts = \Xendit\DirectDebit::retrieveAccessibleLinkedAccounts( $initializeTokenization['id'] ); var_dump($retrieveLinkedAccounts); echo "Unbinding linked account token...\n"; $unbindLinkedAccountToken = \Xendit\DirectDebit::unbindLinkedAccountToken( $initializeTokenization['id'] ); var_dump($unbindLinkedAccountToken); $createPaymentMethodParams = [ 'customer_id' => $customer['id'], 'type' => 'DEBIT_CARD', 'properties' => [ 'id' => $retrieveLinkedAccounts[0]['id'] ], 'metadata' => [ 'meta' => 'data' ] ]; echo "Creating payment method...\n"; $createPaymentMethod = \Xendit\DirectDebit::createPaymentMethod( $createPaymentMethodParams ); var_dump($createPaymentMethod); echo "Retrieving payment methods by customer ID...\n"; $getPaymentMethods = \Xendit\DirectDebit::getPaymentMethodsByCustomerID( $customer['id'] ); var_dump($getPaymentMethods); $createDirectDebitPaymentParams = [ 'reference_id' => 'test-direct-debit-ref-0101', 'payment_method_id' => $createPaymentMethod['id'], 'currency' => 'IDR', 'amount' => 15000, 'callback_url' => 'http://webhook.site/', 'enable_otp' => true, 'description' => 'test description', 'basket' => [ [ 'reference_id' => 'basket-product-ref-id', 'name' => 'product name', 'category' => 'mechanics', 'market' => 'ID', 'price' => 50000, 'quantity' => 5, 'type' => 'product type', 'sub_category' => 'product sub category', 'description' => 'product description', 'url' => 'https://product.url' ] ], 'device' => [ 'id' => 'device_id', 'ip_address' => '0.0.0.0', 'ad_id' => 'ad-id', 'imei' => '123a456b789c' ], 'success_redirect_url' => 'https://success-redirect.url', 'failure_redirect_url' => 'https://failure-redirect.url', 'metadata' => [ 'meta' => 'data' ], 'Idempotency-key' => '' . time() ]; echo "Creating direct debit payment...\n"; $createDDP = \Xendit\DirectDebit::createDirectDebitPayment( $createDirectDebitPaymentParams ); var_dump($createDDP); $validateOTPForDirectDebitPaymentParams = [ 'otp_code' => '222000' ]; echo "Validating OTP for direct debit payment...\n"; $validateOTPForDDP = \Xendit\DirectDebit::validateOTPForDirectDebitPayment( $createDDP['id'], $validateOTPForDirectDebitPaymentParams ); var_dump($validateOTPForDDP); echo "Retrieving direct debit payment by ID...\n"; $getDDPByID = \Xendit\DirectDebit::getDirectDebitPaymentByID( $createDDP['id'] ); var_dump($getDDPByID); echo "Retrieving direct debit payment by reference ID...\n"; $getDDPByReferenceID = \Xendit\DirectDebit::getDirectDebitPaymentByReferenceID( $createDDP['reference_id'] ); var_dump($getDDPByReferenceID); PKZDF F /xendit-php/examples/DisbursementsPHPExample.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Xendit; require 'vendor/autoload.php'; Xendit::setApiKey('SECRET_API_KEY'); $params = [ 'reference_id' => 'reference_id', 'currency' => 'PHP', 'amount' => 15000, 'channel_code' => 'PH_BDO', // if you do not know the channel code. You can find it from DisbursementChannels 'account_name' => 'Test', 'account_number' => '1234567890', 'description' => 'PHP Disbursement from Example', 'xendit-idempotency-key' => time() ]; $createDisbursements = \Xendit\DisbursementsPHP::createPHPDisbursement($params); var_dump($createDisbursements); // create php disbursement with beneficiary optional field $beneficiary = [ 'type' => 'INDIVIDUAL', 'given_names' => 'Test Name', 'middle_name' => 'middle_name', 'surname' => 'surname', 'business_name' => 'business_name', 'street_line1' => 'street_line1', 'street_line2' => 'street_line2', 'city' => 'city', 'province' => 'province', 'state' => 'state', 'country' => 'country', 'zip_code' => '12345', 'mobile_number' => '9876543210', 'phone_number' => '987654321', 'email' => 'email@test.com' ]; $params['beneficiary'] = $beneficiary; $params['xendit-idempotency-key'] = time(); $createDisbursementsWithbeneficiary = \Xendit\DisbursementsPHP::createPHPDisbursement($params); var_dump($createDisbursementsWithbeneficiary); // create php disbursement with receipt_notification optional field. We can pass either of them or both. $receiptNotification = [ 'email_to' => ['test@test.com'], 'email_cc' => [], 'email_bcc' => [] ]; $params['xendit-idempotency-key'] = time(); $params['receipt_notification'] = $receiptNotification; $createDisbursementsWithReceipt = \Xendit\DisbursementsPHP::createPHPDisbursement($params); var_dump($createDisbursementsWithReceipt); $id = $createDisbursements['id']; $getDisbursements = \Xendit\DisbursementsPHP::getPHPDisbursementByID($id); var_dump($getDisbursements); $reference_id = 'reference_id'; $getDisbursementsByRef = \Xendit\DisbursementsPHP::getPHPDisbursementsByReferenceID($reference_id); var_dump($getDisbursementsByRef); PKZ{%xendit-php/examples/RetailExample.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Xendit; require 'vendor/autoload.php'; Xendit::setApiKey('SECRET_API_KEY'); $params = [ 'external_id' => 'TEST-123456789', 'retail_outlet_name' => 'ALFAMART', 'name' => 'JOHN DOE', 'expected_amount' => 25000 ]; $createFPC = \Xendit\Retail::create($params); var_dump($createFPC); $id = $createFPC['id']; $getFPC = \Xendit\Retail::retrieve($id); var_dump($getFPC); $updateParams = ['expected_amount' => 20000]; $updateFPC = \Xendit\Retail::update($id, $updateParams); var_dump($updateFPC); PKZ.xendit-php/examples/PaymentChannelsExample.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Xendit; require 'vendor/autoload.php'; Xendit::setApiKey('SECRET_API_KEY'); $list = \Xendit\PaymentChannels::list(); var_dump($list); PKZs&xendit-php/examples/InvoiceExample.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Xendit; require 'vendor/autoload.php'; Xendit::setApiKey('SECRET_API_KEY'); $params = ['external_id' => 'demo_147580196270', 'payer_email' => 'sample_email@xendit.co', 'description' => 'Trip to Bali', 'amount' => 32000 ]; $createInvoice = \Xendit\Invoice::create($params); var_dump($createInvoice); $id = $createInvoice['id']; $getInvoice = \Xendit\Invoice::retrieve($id); var_dump($getInvoice); $params = [ 'for-user-id' => '' ]; $expireInvoice = \Xendit\Invoice::expireInvoice($id, $params); var_dump($expireInvoice); $retrieveAll = [ 'for-user-id' => '' ]; $getAllInvoice = \Xendit\Invoice::retrieveAll($retrieveAll); var_dump(($getAllInvoice)); PKZ)2??+xendit-php/examples/CardsReverseExample.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Xendit; require 'vendor/autoload.php'; Xendit::setApiKey('SECRET_API_KEY'); $params = [ 'token_id' => '5e3149b915faf8739dd96178', 'external_id' => 'card_' . time(), 'authentication_id' => '5e3149b915faf8739dd96179', 'amount' => 100000, 'card_cvn' =>'123', 'capture' => false ]; $createCharge = \Xendit\Cards::create($params); var_dump($createCharge); $reverseParams = ['external_id' => $createCharge['external_id']]; $reverseAuth = \Xendit\Cards::reverseAuthorization( $createCharge['id'], $reverseParams ); var_dump($reverseAuth); PKZ(xendit-php/examples/CustomHttpClient.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Dotenv\Dotenv; use Xendit\Xendit; use Xendit\HttpClientInterface; use GuzzleHttp\Client as Guzzle; require 'vendor/autoload.php'; class HttpCliImp implements HttpClientInterface { private $_guzz; public function __construct(Guzzle $guzz) { $this->_guzz = $guzz; } public function request($method, $uri, array $options = []) { return $this->_guzz->request($method, $uri, $options); } } $dotenv = Dotenv::createImmutable(__DIR__ . '/..'); $dotenv->load(); Xendit::setApiKey(getenv('SECRET_API_KEY')); Xendit::setHttpClient(new HttpCliImp(new Guzzle( [ 'base_uri' => Xendit::$apiBase, 'verify' => false, 'timeout' => 60 ] ))); $getBalance = \Xendit\Balance::getBalance('CASH'); var_dump($getBalance); PKZ:f(xendit-php/examples/PromotionExample.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Xendit; require 'vendor/autoload.php'; Xendit::setApiKey('SECRET_API_KEY'); $params = [ 'reference_id' => 'reference_123', 'description' => 'test promotion', 'currency' => 'IDR', 'start_time' => (new DateTime('NOW'))->format('Y-d-m\TH:i:s.v\Z'), 'end_time' => (new DateTime('NOW +1 day'))->format('Y-d-m\TH:i:s.v\Z'), 'promo_code' => 'testpromo', 'discount_amount' => 5000 ]; $promotion = \Xendit\Promotion::create($params); var_dump($promotion); PKZ/'xendit-php/examples/EWalletsExample.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Xendit; require 'vendor/autoload.php'; Xendit::setApiKey('SECRET_API_KEY'); $ovoParams = [ 'external_id' => 'demo-' . time(), 'amount' => 32000, 'phone' => '081298498259', 'ewallet_type' => 'OVO' ]; $danaParams = [ 'external_id' => 'demo_' . time(), 'amount' => 32000, 'phone' => '081298498259', 'expiration_date' => '2100-02-20T00:00:00.000Z', 'callback_url' => 'https://my-shop.com/callbacks', 'redirect_url' => 'https://my-shop.com/home', 'ewallet_type' => 'DANA' ]; $linkajaParams = [ 'external_id' => 'demo_' . time(), 'amount' => 32000, 'phone' => '081298498259', 'items' => [ [ 'id' => '123123', 'name' => 'Phone Case', 'price' => 100000, 'quantity' => 1 ], [ 'id' => '345678', 'name' => 'Powerbank', 'price' => 200000, 'quantity' => 1 ] ], 'callback_url' => 'https =>//yourwebsite.com/callback', 'redirect_url' => 'https =>//yourwebsite.com/order/123', 'ewallet_type' => 'LINKAJA' ]; $ewalletChargeParams = [ 'reference_id' => 'test-reference-id', 'currency' => 'IDR', 'amount' => 50000, 'checkout_method' => 'ONE_TIME_PAYMENT', 'channel_code' => 'ID_SHOPEEPAY', 'channel_properties' => [ 'success_redirect_url' => 'https://yourwebsite.com/order/123', ], 'metadata' => [ 'meta' => 'data' ] ]; try { $createOvo = \Xendit\EWallets::create($ovoParams); var_dump($createOvo); } catch (\Xendit\Exceptions\ApiException $exception) { var_dump($exception); } $createDana = \Xendit\EWallets::create($danaParams); var_dump($createDana); $createLinkaja = \Xendit\EWallets::create($linkajaParams); var_dump($createLinkaja); $getOvo = \Xendit\EWallets::getPaymentStatus($ovoParams['external_id'], 'OVO'); var_dump($getOvo); $getDana = \Xendit\EWallets::getPaymentStatus($danaParams['external_id'], 'DANA'); var_dump($getDana); $getLinkaja = \Xendit\EWallets::getPaymentStatus( $linkajaParams['external_id'], 'LINKAJA' ); var_dump($getLinkaja); echo "Creating E-Wallet Charge...\n"; $createEWalletCharge = \Xendit\EWallets::createEWalletCharge($ewalletChargeParams); var_dump($createEWalletCharge); echo "Retrieving E-Wallet Charge Status with ID: {$createEWalletCharge['id']}...\n"; $walletChargeStatusParams = [ 'for-user-id' => 'test-user-id' ]; $getEWalletChargeStatus = \Xendit\EWallets::getEWalletChargeStatus( $createEWalletCharge['id'], $walletChargeStatusParams ); var_dump($getEWalletChargeStatus); $eWalletChargeId = ''; $voidEwalletChargeParam = []; $voidEwalletCharge = \Xendit\EWallets::voidEwalletCharge( $eWalletChargeId, $voidEwalletChargeParam ); var_dump($voidEwalletCharge); $eWalletChargeId = ''; $refundEwalletChargeParam = []; $refundEwalletCharge = \Xendit\EWallets::refundEwalletCharge( $eWalletChargeId, $refundEwalletChargeParam ); var_dump($refundEwalletCharge); $eWalletChargeId = ''; $refundEwalletChargeId = ''; $getRefundEWalletParam = []; $getRefundEWallet = \Xendit\EWallets::getRefund( $eWalletChargeId, $refundEwalletChargeId, $getRefundEWalletParam ); var_dump($getRefundEWallet); $eWalletChargeId = ''; $listRefundParam = []; $listRefund = \Xendit\EWallets::listRefund( $eWalletChargeId, $listRefundParam ); var_dump($listRefund);PKZىNN3xendit-php/examples/DisbursementChannelsExample.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Xendit; require 'vendor/autoload.php'; Xendit::setApiKey('SECRET_API_KEY'); $disbursementChannels = \Xendit\DisbursementChannels::getDisbursementChannels(); var_dump($disbursementChannels); $channelCategory = 'BANK'; $getdisbursementChannelsByCategory = \Xendit\DisbursementChannels::getDisbursementChannelsByChannelCategory($channelCategory); var_dump($getdisbursementChannelsByCategory); $channelCode = 'PH_BDO'; $getdisbursementChannelsByCode = \Xendit\DisbursementChannels::getDisbursementChannelsByChannelCode($channelCode); var_dump($getdisbursementChannelsByCode); PKZܓ!//%xendit-php/examples/ReportExample.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Xendit; require 'vendor/autoload.php'; Xendit::setApiKey('SECRET_API_KEY'); $params = [ 'type' => 'TRANSACTIONS' ]; $generate = \Xendit\Report::generate($params); var_dump($generate); $detail = \Xendit\Report::detail('report_5c1b34a2-6ceb-4c24-aba9-c836bac82b28'); var_dump($detail); PKZrW&xendit-php/examples/PayoutsExample.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Xendit; require 'vendor/autoload.php'; Xendit::setApiKey('SECRET_API_KEY'); $params = [ 'external_id' => 'payouts-123456789', 'amount' => 50000, "email" => 'demo@xendit.co' ]; $createPayout = \Xendit\Payouts::create($params); var_dump($createPayout); $id = $createPayout['id']; $getPayout = \Xendit\Payouts::retrieve($id); var_dump($getPayout); $voidPayout = \Xendit\Payouts::void($id); var_dump($voidPayout); PKZlOP(xendit-php/examples/CustomersExample.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Xendit; require 'vendor/autoload.php'; Xendit::setApiKey('SECRET_API_KEY'); $customerParamsOld = [ 'reference_id' => '' . time(), 'given_names' => 'customer 1', 'email' => 'customer@website.com', 'description' => 'dummy customer', 'middle_name' => 'middle', 'surname' => 'surname', 'addresses' => [ [ 'country' => 'ID', 'street_line1' => 'Jl. 123', 'street_line2' => 'Jl. 456', 'city' => 'Jakarta Selatan', 'province' => 'DKI Jakarta', 'state' => '-', 'postal_code' => '12345' ] ], 'metadata' => [ 'meta' => 'data' ] ]; echo "Creating customer (2020-05-19)...\n"; $createCustomerOld = \Xendit\Customers::createCustomer($customerParamsOld); var_dump($createCustomerOld); echo "Retrieving customer by reference ID (2020-05-19)...\n"; $getCustomerOld = \Xendit\Customers::getCustomerByReferenceID( $customerParamsOld['reference_id'] ); var_dump($getCustomerOld); $customerParamsNew = [ 'reference_id' => '' . time(), 'type' => 'INDIVIDUAL', 'email' => 'customer@website.com', 'mobile_number' => '+6281212345678', 'phone_number' => '+6289987654321', 'description' => 'test description', 'kyc_documents' => [ [ 'country' => 'ID', 'type' => 'IDENTITY_CARD', 'sub_type' => 'NATIONAL_ID', 'document_name' => 'KTP', 'document_number' => '1234567890', 'expires_at' => '2025-06-02', 'holder_name' => 'Holder name', 'document_images' => [ 'https://file1.jpg', 'https://file2.jpg' ] ] ], 'metadata' => [ 'meta' => 'data' ], 'individual_detail' => [ 'given_names' => 'John', 'surname' => 'Doe', 'nationality' => 'ID', 'date_of_birth' => '1993-12-26', 'place_of_birth' => 'Cirebon', 'gender' => 'MALE', 'employment' => [ 'employer_name' => 'Employer name', 'nature_of_business' => 'Business', 'role_description' => 'Employer' ] ], 'business_detail' => [ 'business_name' => 'Business name', 'business_type' => 'NON_PROFIT', 'nature_of_business' => 'Charity', 'business_domicile' => 'ID', 'date_of_registration' => '2005-06-21' ], 'addresses' => [ [ 'country' => 'ID', 'street_line1' => 'street line 1', 'street_line2' => 'street line 2', 'city' => 'Cirebon', 'province_state' => 'Jawa Barat', 'postal_code' => '21345', 'category' => 'HOME', 'is_primary' => true ] ], 'identity_accounts' => [ [ 'type' => 'EWALLET', 'company' => 'GOPAY', 'description' => 'gopay', 'country' => 'ID', 'properties' => [ 'account_number' => '12345', 'account_holder_name' => 'John Doe', 'currency' => 'IDR' ] ] ], 'api-version' => '2020-10-31' ]; echo "Creating customer (2020-10-31)...\n"; $createCustomerNew = \Xendit\Customers::createCustomer($customerParamsNew); var_dump($createCustomerNew); echo "Retrieving customer by reference ID (2020-10-31)...\n"; $getCustomerNew = \Xendit\Customers::getCustomerByReferenceID( $customerParamsNew['reference_id'], ['api-version' => '2020-10-31'] ); var_dump($getCustomerNew); PKZRNc'xendit-php/examples/PlatformExample.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Xendit; require 'vendor/autoload.php'; Xendit::setApiKey('SECRET_API_KEY'); $params = [ 'email' => 'customer@website.com', 'type' => 'OWNED', 'public_profile' => ['business_name' => 'customer company'] ]; $createAccount = \Xendit\Platform::createAccount($params); var_dump($createAccount); $accountId = $createAccount['id']; $getAccount = \Xendit\Platform::getAccount($accountId); var_dump($getAccount); $updateParams = [ 'email' => 'customer@website.com', 'public_profile' => ['business_name' => 'customer company updated'] ]; $updateAccount = \Xendit\Platform::updateAccount($accountId, $updateParams); var_dump($updateAccount); $transferParams = [ 'reference' => ''.time(), 'amount' => 50000, 'source_user_id' => '54afeb170a2b18519b1b8768', 'destination_user_id' => '5cafeb170a2b1851246b8768', ]; $createTransfer = \Xendit\Platform::createTransfer($transferParams); var_dump($createTransfer); $feeRuleParams = [ 'name' => 'standard_platform_fee', 'description' => 'Fee charged to insurance agents based in Java', 'unit' => 'flat', 'amount' => 6500, 'currency' => 'IDR' ]; $createFeeRule = \Xendit\Platform::createFeeRule($feeRuleParams); var_dump($createFeeRule); $callbackUrlParams = [ 'url' => 'https://webhook.site/c9c9140b-96b8-434c-9c59-7440eeae4d7f' ]; $callbackType = 'invoice'; $setCallbackUrl = \Xendit\Platform::setCallbackUrl($callbackType, $callbackUrlParams); var_dump($setCallbackUrl); PKZ̟X_44&xendit-php/examples/BalanceExample.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Xendit; require 'vendor/autoload.php'; Xendit::setApiKey('SECRET_API_KEY'); $params = array( 'for-user-id' => '' //The sub-account user-id that you want to make this transaction for (Optional). ); $getBalance = \Xendit\Balance::getBalance('CASH', $params); var_dump($getBalance); PKZ -xendit-php/examples/CardlessCreditExample.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Xendit; require 'vendor/autoload.php'; Xendit::setApiKey('SECRET_API_KEY'); $params = [ 'cardless_credit_type' => 'KREDIVO', 'external_id' => 'test-cardless-credit-02', 'amount' => 800000, 'payment_type' => '3_months', 'items' => [ [ 'id' => '123123', 'name' => 'Phone Case', 'price' => 200000, 'type' => 'Smartphone', 'url' => 'http=>//example.com/phone/phone_case', 'quantity' => 2 ], [ 'id' => '234567', 'name' => 'Bluetooth Headset', 'price' => 400000, 'type' => 'Audio', 'url' => 'http=>//example.com/phone/bluetooth_headset', 'quantity' => 1 ] ], 'customer_details' => [ 'first_name' => 'customer first name', 'last_name' => 'customer last name', 'email' => 'customer@yourwebsite.com', 'phone' => '081513114262' ], 'shipping_address' => [ 'first_name' => 'first name', 'last_name' => 'last name', 'address' => 'Jalan Teknologi No. 12', 'city' => 'Jakarta', 'postal_code' => '12345', 'phone' => '081513114262', 'country_code' => 'IDN' ], 'redirect_url' => 'https://example.com', 'callback_url' => 'http://example.com/callback-cardless-credit' ]; $createPayment = \Xendit\CardlessCredit::create($params); var_dump($createPayment); $params = [ 'cardless_credit_type' => 'KREDIVO', 'amount' => 2000000, 'items' => [ [ 'id' => '123123', 'name' => 'Phone Case', 'price' => 1000000, 'type' => 'Smartphone', 'url' => 'http://example.com/phone/phone_case', 'quantity' => 2 ] ] ]; $calculatePaymentTypes = \Xendit\CardlessCredit::calculatePaymentTypes($params); var_dump($calculatePaymentTypes); PKZ EE,xendit-php/examples/DisbursementsExample.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Xendit; require 'vendor/autoload.php'; Xendit::setApiKey('SECRET_API_KEY'); $params = [ 'external_id' => 'disb-12345678', 'amount' => 15000, 'bank_code' => 'BCA', 'account_holder_name' => 'Joe', 'account_number' => '1234567890', 'description' => 'Disbursement from Example', 'X-IDEMPOTENCY-KEY' ]; $batch_params = [ 'reference'=> 'disb_batch-12345678', 'disbursements'=> [ [ 'amount'=> 20000, 'bank_code'=> 'BCA', 'bank_account_name'=> 'Fadlan', 'bank_account_number'=> '1234567890', 'description'=> 'Batch Disbursement', 'external_id'=> 'disbursement-1' ], [ 'amount'=> 30000, 'bank_code'=> 'MANDIRI', 'bank_account_name'=> 'Lutfi', 'bank_account_number'=> '1234567891', 'description'=> 'Batch Disbursement with email notifications', 'external_id'=> 'disbursement-2', 'email_to'=> ['test+to@xendit.co'], 'email_cc'=> ['test+cc@xendit.co'], 'email_bcc'=> ['test+bcc1@xendit.co', 'test+bcc2@xendit.co'] ] ] ]; $createDisbursements = \Xendit\Disbursements::create($params); var_dump($createDisbursements); $id = $createDisbursements['id']; $external_id = $params['external_id']; $getDisbursementsBanks = \Xendit\Disbursements::getAvailableBanks(); var_dump($getDisbursementsBanks); $retrieveParams = [ 'for-user-id' => '' ]; $getDisbursements = \Xendit\Disbursements::retrieve($id, $retrieveParams); var_dump($getDisbursements); $getDisbursementsByExt = \Xendit\Disbursements::retrieveExternal($external_id, $retrieveParams); var_dump($getDisbursementsByExt); $createBatchDisbursements = \Xendit\Disbursements::createBatch($batch_params); var_dump($createBatchDisbursements); PKZйՄ(xendit-php/examples/RecurringExample.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Xendit; require 'vendor/autoload.php'; Xendit::setApiKey('SECRET_API_KEY'); $params = [ 'external_id' => 'demo_147580196270', 'payer_email' => 'sample_email@xendit.co', 'description' => 'Trip to Bali', 'amount' => 32000, 'interval' => 'MONTH', 'interval_count' => 1 ]; $createRecurring = \Xendit\Recurring::create($params); var_dump($createRecurring); $id = $createRecurring['id']; $retrieveParams = [ 'for-user-id' => '' ]; $getRecurring = \Xendit\Recurring::retrieve($id, $retrieveParams); var_dump($getRecurring); $editRecurring = \Xendit\Recurring::update($id, ['amount' => 10000]); var_dump($editRecurring); $pauseRecurring = \Xendit\Recurring::pause($id); var_dump($pauseRecurring); $resumeRecurring = \Xendit\Recurring::resume($id); var_dump($resumeRecurring); $stopRecurring = \Xendit\Recurring::stop($id); var_dump($stopRecurring); PKZEpp'xendit-php/examples/PayLaterExample.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Xendit; require 'vendor/autoload.php'; Xendit::setApiKey('SECRET_API_KEY'); $params = [ 'customer_id' => '14b4bf47-b97a-4c13-bea9-5b1734a46fd1', 'channel_code' => 'ID_KREDIVO', 'currency' => 'IDR', 'amount' => 6000000, 'order_items' => [ [ 'type' => 'PHYSICAL_PRODUCT', 'reference_id' => '1533', 'name' => 'Mobile Phone', 'net_unit_amount' => 6000000, 'quantity' => 1, 'url' => '', 'category' => 'Smartphone' ] ] ]; $payLaterPlan = \Xendit\PayLater::initiatePayLaterPlans($params); var_dump($payLaterPlan); $params = [ 'plan_id' => $payLaterPlan['id'], 'reference_id' => 'order_id_' . time(), 'checkout_method' => 'ONE_TIME_PAYMENT', 'success_redirect_url' => 'https://your-site.com/redirect-success', 'failure_redirect_url' => 'https://your-site.com/redirect-failure', ]; $payLaterCharge = \Xendit\PayLater::createPayLaterCharge($params); var_dump($payLaterCharge); $params = []; // Optional $id = 'plc_8cb12305-9bcf-4441-a087-ee0d446e297b'; $payLaterCharge = \Xendit\PayLater::getPayLaterChargeStatus($id, $params); var_dump($payLaterCharge); $params = []; // Optional $id = 'plc_8cb12305-9bcf-4441-a087-ee0d446e297b'; $payLaterChargeRefundCreate = \Xendit\PayLater::createPayLaterRefund($id, $params); var_dump($payLaterChargeRefundCreate); $params = []; // Optional $charge_id = 'plc_8cb12305-9bcf-4441-a087-ee0d446e297b'; $refund_id = 'plr_2f2aa47f-2764-4b42-8712-c3fb1270b09e'; $payLaterChargeRefund = \Xendit\PayLater::getPayLaterRefund($charge_id, $refund_id, $params); var_dump($payLaterChargeRefund); $params = []; // Optional $charge_id = 'plc_8cb12305-9bcf-4441-a087-ee0d446e297b'; $payLaterChargeRefundList = \Xendit\PayLater::listPayLaterRefund($charge_id, $params); var_dump($payLaterChargeRefundList); PKZn:ވ-xendit-php/examples/VirtualAccountExample.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Xendit; require 'vendor/autoload.php'; Xendit::setApiKey('SECRET_API_KEY'); $params = ["external_id" => "VA_fixed-12341234", "bank_code" => "MANDIRI", "name" => "Steve Wozniak" ]; $createVA = \Xendit\VirtualAccounts::create($params); var_dump($createVA); $id = $createVA['id']; $getVABanks = \Xendit\VirtualAccounts::getVABanks(); var_dump($getVABanks); $getVA = \Xendit\VirtualAccounts::retrieve($id); var_dump($getVA); $updateParams = ["suggested_amount" => 1000]; $updateVA = \Xendit\VirtualAccounts::update($id, $updateParams); var_dump($updateVA); $paymentID = "VA_fixed-1579666681_1579666702976"; $getFVAPayment = \Xendit\VirtualAccounts::getFVAPayment($paymentID); var_dump($getFVAPayment); PKZ7MDD$xendit-php/examples/CardsExample.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Xendit; require 'vendor/autoload.php'; Xendit::setApiKey('SECRET_API_KEY'); $params = [ 'token_id' => '5e2e8231d97c174c58bcf644', 'external_id' => 'card_' . time(), 'authentication_id' => '5e2e8658bae82e4d54d764c0', 'amount' => 100000, 'card_cvn' =>'123', 'capture' => false ]; $captureParams = ['amount' => 100000]; $refundParams = [ 'external_id' => $params['external_id'], 'amount' => 20000 ]; $createCharge = \Xendit\Cards::create($params); var_dump($createCharge); $id = $createCharge['id']; $getCharge = \Xendit\Cards::retrieve($id); var_dump($getCharge); $captureCharge = \Xendit\Cards::capture($id, $captureParams); var_dump($captureParams); $getCharge = \Xendit\Cards::retrieve($id); var_dump($getCharge); $refund = \Xendit\Cards::createRefund($id, $refundParams); var_dump($refund); PKZ 8'pp%xendit-php/examples/QRCodeExample.phpnu[ * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Xendit; require 'vendor/autoload.php'; Xendit::setApiKey('SECRET_API_KEY'); $params = [ 'external_id' => 'external_123', 'type' => 'STATIC', 'callback_url' => 'https://webhook.site', 'amount' => 10000, ]; $created_qr_code = \Xendit\QRCode::create($params); var_dump($created_qr_code); $qr_code = \Xendit\QRCode::get('external_123'); var_dump($qr_code); PKZhJFFxendit-php/composer.locknu[{ "_readme": [ "This file locks the dependencies of your project to a known state", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], "content-hash": "ae12a150fd21b75a10d62065ba5ae51a", "packages": [ { "name": "guzzlehttp/guzzle", "version": "7.5.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", "reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b50a2a1251152e43f6a37f0fa053e730a67d25ba", "reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba", "shasum": "" }, "require": { "ext-json": "*", "guzzlehttp/promises": "^1.5", "guzzlehttp/psr7": "^1.9 || ^2.4", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" }, "provide": { "psr/http-client-implementation": "1.0" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.1", "ext-curl": "*", "php-http/client-integration-tests": "^3.0", "phpunit/phpunit": "^8.5.29 || ^9.5.23", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "suggest": { "ext-curl": "Required for CURL handler support", "ext-intl": "Required for Internationalized Domain Name (IDN) support", "psr/log": "Required for using the Log middleware" }, "type": "library", "extra": { "bamarni-bin": { "bin-links": true, "forward-command": false }, "branch-alias": { "dev-master": "7.5-dev" } }, "autoload": { "files": [ "src/functions_include.php" ], "psr-4": { "GuzzleHttp\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Graham Campbell", "email": "hello@gjcampbell.co.uk", "homepage": "https://github.com/GrahamCampbell" }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" }, { "name": "Jeremy Lindblom", "email": "jeremeamia@gmail.com", "homepage": "https://github.com/jeremeamia" }, { "name": "George Mponos", "email": "gmponos@gmail.com", "homepage": "https://github.com/gmponos" }, { "name": "Tobias Nyholm", "email": "tobias.nyholm@gmail.com", "homepage": "https://github.com/Nyholm" }, { "name": "Márk Sági-Kazár", "email": "mark.sagikazar@gmail.com", "homepage": "https://github.com/sagikazarmark" }, { "name": "Tobias Schultze", "email": "webmaster@tubo-world.de", "homepage": "https://github.com/Tobion" } ], "description": "Guzzle is a PHP HTTP client library", "keywords": [ "client", "curl", "framework", "http", "http client", "psr-18", "psr-7", "rest", "web service" ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", "source": "https://github.com/guzzle/guzzle/tree/7.5.0" }, "funding": [ { "url": "https://github.com/GrahamCampbell", "type": "github" }, { "url": "https://github.com/Nyholm", "type": "github" }, { "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", "type": "tidelift" } ], "time": "2022-08-28T15:39:27+00:00" }, { "name": "guzzlehttp/promises", "version": "1.5.2", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", "reference": "b94b2807d85443f9719887892882d0329d1e2598" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/guzzle/promises/zipball/b94b2807d85443f9719887892882d0329d1e2598", "reference": "b94b2807d85443f9719887892882d0329d1e2598", "shasum": "" }, "require": { "php": ">=5.5" }, "require-dev": { "symfony/phpunit-bridge": "^4.4 || ^5.1" }, "type": "library", "extra": { "branch-alias": { "dev-master": "1.5-dev" } }, "autoload": { "files": [ "src/functions_include.php" ], "psr-4": { "GuzzleHttp\\Promise\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Graham Campbell", "email": "hello@gjcampbell.co.uk", "homepage": "https://github.com/GrahamCampbell" }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" }, { "name": "Tobias Nyholm", "email": "tobias.nyholm@gmail.com", "homepage": "https://github.com/Nyholm" }, { "name": "Tobias Schultze", "email": "webmaster@tubo-world.de", "homepage": "https://github.com/Tobion" } ], "description": "Guzzle promises library", "keywords": [ "promise" ], "support": { "issues": "https://github.com/guzzle/promises/issues", "source": "https://github.com/guzzle/promises/tree/1.5.2" }, "funding": [ { "url": "https://github.com/GrahamCampbell", "type": "github" }, { "url": "https://github.com/Nyholm", "type": "github" }, { "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", "type": "tidelift" } ], "time": "2022-08-28T14:55:35+00:00" }, { "name": "guzzlehttp/psr7", "version": "2.4.1", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", "reference": "69568e4293f4fa993f3b0e51c9723e1e17c41379" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/guzzle/psr7/zipball/69568e4293f4fa993f3b0e51c9723e1e17c41379", "reference": "69568e4293f4fa993f3b0e51c9723e1e17c41379", "shasum": "" }, "require": { "php": "^7.2.5 || ^8.0", "psr/http-factory": "^1.0", "psr/http-message": "^1.0", "ralouphie/getallheaders": "^3.0" }, "provide": { "psr/http-factory-implementation": "1.0", "psr/http-message-implementation": "1.0" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.1", "http-interop/http-factory-tests": "^0.9", "phpunit/phpunit": "^8.5.29 || ^9.5.23" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, "type": "library", "extra": { "bamarni-bin": { "bin-links": true, "forward-command": false }, "branch-alias": { "dev-master": "2.4-dev" } }, "autoload": { "psr-4": { "GuzzleHttp\\Psr7\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Graham Campbell", "email": "hello@gjcampbell.co.uk", "homepage": "https://github.com/GrahamCampbell" }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" }, { "name": "George Mponos", "email": "gmponos@gmail.com", "homepage": "https://github.com/gmponos" }, { "name": "Tobias Nyholm", "email": "tobias.nyholm@gmail.com", "homepage": "https://github.com/Nyholm" }, { "name": "Márk Sági-Kazár", "email": "mark.sagikazar@gmail.com", "homepage": "https://github.com/sagikazarmark" }, { "name": "Tobias Schultze", "email": "webmaster@tubo-world.de", "homepage": "https://github.com/Tobion" }, { "name": "Márk Sági-Kazár", "email": "mark.sagikazar@gmail.com", "homepage": "https://sagikazarmark.hu" } ], "description": "PSR-7 message implementation that also provides common utility methods", "keywords": [ "http", "message", "psr-7", "request", "response", "stream", "uri", "url" ], "support": { "issues": "https://github.com/guzzle/psr7/issues", "source": "https://github.com/guzzle/psr7/tree/2.4.1" }, "funding": [ { "url": "https://github.com/GrahamCampbell", "type": "github" }, { "url": "https://github.com/Nyholm", "type": "github" }, { "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", "type": "tidelift" } ], "time": "2022-08-28T14:45:39+00:00" }, { "name": "psr/http-client", "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/php-fig/http-client.git", "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", "shasum": "" }, "require": { "php": "^7.0 || ^8.0", "psr/http-message": "^1.0" }, "type": "library", "extra": { "branch-alias": { "dev-master": "1.0.x-dev" } }, "autoload": { "psr-4": { "Psr\\Http\\Client\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "PHP-FIG", "homepage": "http://www.php-fig.org/" } ], "description": "Common interface for HTTP clients", "homepage": "https://github.com/php-fig/http-client", "keywords": [ "http", "http-client", "psr", "psr-18" ], "support": { "source": "https://github.com/php-fig/http-client/tree/master" }, "time": "2020-06-29T06:28:15+00:00" }, { "name": "psr/http-factory", "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/php-fig/http-factory.git", "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be", "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be", "shasum": "" }, "require": { "php": ">=7.0.0", "psr/http-message": "^1.0" }, "type": "library", "extra": { "branch-alias": { "dev-master": "1.0.x-dev" } }, "autoload": { "psr-4": { "Psr\\Http\\Message\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "PHP-FIG", "homepage": "http://www.php-fig.org/" } ], "description": "Common interfaces for PSR-7 HTTP message factories", "keywords": [ "factory", "http", "message", "psr", "psr-17", "psr-7", "request", "response" ], "support": { "source": "https://github.com/php-fig/http-factory/tree/master" }, "time": "2019-04-30T12:38:16+00:00" }, { "name": "psr/http-message", "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/php-fig/http-message.git", "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", "shasum": "" }, "require": { "php": ">=5.3.0" }, "type": "library", "extra": { "branch-alias": { "dev-master": "1.0.x-dev" } }, "autoload": { "psr-4": { "Psr\\Http\\Message\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "PHP-FIG", "homepage": "http://www.php-fig.org/" } ], "description": "Common interface for HTTP messages", "homepage": "https://github.com/php-fig/http-message", "keywords": [ "http", "http-message", "psr", "psr-7", "request", "response" ], "support": { "source": "https://github.com/php-fig/http-message/tree/master" }, "time": "2016-08-06T14:39:51+00:00" }, { "name": "ralouphie/getallheaders", "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/ralouphie/getallheaders.git", "reference": "120b605dfeb996808c31b6477290a714d356e822" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", "reference": "120b605dfeb996808c31b6477290a714d356e822", "shasum": "" }, "require": { "php": ">=5.6" }, "require-dev": { "php-coveralls/php-coveralls": "^2.1", "phpunit/phpunit": "^5 || ^6.5" }, "type": "library", "autoload": { "files": [ "src/getallheaders.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Ralph Khattar", "email": "ralph.khattar@gmail.com" } ], "description": "A polyfill for getallheaders.", "support": { "issues": "https://github.com/ralouphie/getallheaders/issues", "source": "https://github.com/ralouphie/getallheaders/tree/develop" }, "time": "2019-03-08T08:55:37+00:00" }, { "name": "symfony/deprecation-contracts", "version": "v3.1.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", "reference": "07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918", "reference": "07f1b9cc2ffee6aaafcf4b710fbc38ff736bd918", "shasum": "" }, "require": { "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { "dev-main": "3.1-dev" }, "thanks": { "name": "symfony/contracts", "url": "https://github.com/symfony/contracts" } }, "autoload": { "files": [ "function.php" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Nicolas Grekas", "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { "source": "https://github.com/symfony/deprecation-contracts/tree/v3.1.1" }, "funding": [ { "url": "https://symfony.com/sponsor", "type": "custom" }, { "url": "https://github.com/fabpot", "type": "github" }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], "time": "2022-02-25T11:15:52+00:00" } ], "packages-dev": [ { "name": "doctrine/instantiator", "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { "doctrine/coding-standard": "^9", "ext-pdo": "*", "ext-phar": "*", "phpbench/phpbench": "^0.16 || ^1", "phpstan/phpstan": "^1.4", "phpstan/phpstan-phpunit": "^1", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", "vimeo/psalm": "^4.22" }, "type": "library", "autoload": { "psr-4": { "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Marco Pivetta", "email": "ocramius@gmail.com", "homepage": "https://ocramius.github.io/" } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", "homepage": "https://www.doctrine-project.org/projects/instantiator.html", "keywords": [ "constructor", "instantiate" ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", "source": "https://github.com/doctrine/instantiator/tree/1.4.1" }, "funding": [ { "url": "https://www.doctrine-project.org/sponsorship.html", "type": "custom" }, { "url": "https://www.patreon.com/phpdoctrine", "type": "patreon" }, { "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", "type": "tidelift" } ], "time": "2022-03-03T08:28:38+00:00" }, { "name": "myclabs/deep-copy", "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "conflict": { "doctrine/collections": "<1.6.8", "doctrine/common": "<2.13.3 || >=3,<3.2.2" }, "require-dev": { "doctrine/collections": "^1.6.8", "doctrine/common": "^2.13.3 || ^3.2.2", "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", "autoload": { "files": [ "src/DeepCopy/deep_copy.php" ], "psr-4": { "DeepCopy\\": "src/DeepCopy/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "description": "Create deep copies (clones) of your objects", "keywords": [ "clone", "copy", "duplicate", "object", "object graph" ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" }, "funding": [ { "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", "type": "tidelift" } ], "time": "2022-03-03T13:19:32+00:00" }, { "name": "phar-io/manifest", "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", "reference": "97803eca37d319dfa7826cc2437fc020857acb53" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", "reference": "97803eca37d319dfa7826cc2437fc020857acb53", "shasum": "" }, "require": { "ext-dom": "*", "ext-phar": "*", "ext-xmlwriter": "*", "phar-io/version": "^3.0.1", "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { "dev-master": "2.0.x-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Arne Blankerts", "email": "arne@blankerts.de", "role": "Developer" }, { "name": "Sebastian Heuer", "email": "sebastian@phpeople.de", "role": "Developer" }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de", "role": "Developer" } ], "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", "source": "https://github.com/phar-io/manifest/tree/2.0.3" }, "time": "2021-07-20T11:28:43+00:00" }, { "name": "phar-io/version", "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "shasum": "" }, "require": { "php": "^7.2 || ^8.0" }, "type": "library", "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Arne Blankerts", "email": "arne@blankerts.de", "role": "Developer" }, { "name": "Sebastian Heuer", "email": "sebastian@phpeople.de", "role": "Developer" }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de", "role": "Developer" } ], "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", "source": "https://github.com/phar-io/version/tree/3.2.1" }, "time": "2022-02-21T01:04:05+00:00" }, { "name": "phpoption/phpoption", "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/schmittjoh/php-option.git", "reference": "dc5ff11e274a90cc1c743f66c9ad700ce50db9ab" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/dc5ff11e274a90cc1c743f66c9ad700ce50db9ab", "reference": "dc5ff11e274a90cc1c743f66c9ad700ce50db9ab", "shasum": "" }, "require": { "php": "^7.2.5 || ^8.0" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8", "phpunit/phpunit": "^8.5.28 || ^9.5.21" }, "type": "library", "extra": { "bamarni-bin": { "bin-links": true, "forward-command": true }, "branch-alias": { "dev-master": "1.9-dev" } }, "autoload": { "psr-4": { "PhpOption\\": "src/PhpOption/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "Apache-2.0" ], "authors": [ { "name": "Johannes M. Schmitt", "email": "schmittjoh@gmail.com", "homepage": "https://github.com/schmittjoh" }, { "name": "Graham Campbell", "email": "hello@gjcampbell.co.uk", "homepage": "https://github.com/GrahamCampbell" } ], "description": "Option Type for PHP", "keywords": [ "language", "option", "php", "type" ], "support": { "issues": "https://github.com/schmittjoh/php-option/issues", "source": "https://github.com/schmittjoh/php-option/tree/1.9.0" }, "funding": [ { "url": "https://github.com/GrahamCampbell", "type": "github" }, { "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", "type": "tidelift" } ], "time": "2022-07-30T15:51:26+00:00" }, { "name": "phpunit/php-code-coverage", "version": "7.0.15", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", "reference": "819f92bba8b001d4363065928088de22f25a3a48" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/819f92bba8b001d4363065928088de22f25a3a48", "reference": "819f92bba8b001d4363065928088de22f25a3a48", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", "php": ">=7.2", "phpunit/php-file-iterator": "^2.0.2", "phpunit/php-text-template": "^1.2.1", "phpunit/php-token-stream": "^3.1.3 || ^4.0", "sebastian/code-unit-reverse-lookup": "^1.0.1", "sebastian/environment": "^4.2.2", "sebastian/version": "^2.0.1", "theseer/tokenizer": "^1.1.3" }, "require-dev": { "phpunit/phpunit": "^8.2.2" }, "suggest": { "ext-xdebug": "^2.7.2" }, "type": "library", "extra": { "branch-alias": { "dev-master": "7.0-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de", "role": "lead" } ], "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", "homepage": "https://github.com/sebastianbergmann/php-code-coverage", "keywords": [ "coverage", "testing", "xunit" ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/7.0.15" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" } ], "time": "2021-07-26T12:20:09+00:00" }, { "name": "phpunit/php-file-iterator", "version": "2.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", "shasum": "" }, "require": { "php": ">=7.1" }, "require-dev": { "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { "branch-alias": { "dev-master": "2.0.x-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de", "role": "lead" } ], "description": "FilterIterator implementation that filters files based on a list of suffixes.", "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", "keywords": [ "filesystem", "iterator" ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/2.0.5" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" } ], "time": "2021-12-02T12:42:26+00:00" }, { "name": "phpunit/php-text-template", "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", "shasum": "" }, "require": { "php": ">=5.3.3" }, "type": "library", "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de", "role": "lead" } ], "description": "Simple template engine.", "homepage": "https://github.com/sebastianbergmann/php-text-template/", "keywords": [ "template" ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", "source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1" }, "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", "version": "2.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/2454ae1765516d20c4ffe103d85a58a9a3bd5662", "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662", "shasum": "" }, "require": { "php": ">=7.1" }, "require-dev": { "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { "branch-alias": { "dev-master": "2.1-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de", "role": "lead" } ], "description": "Utility class for timing", "homepage": "https://github.com/sebastianbergmann/php-timer/", "keywords": [ "timer" ], "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", "source": "https://github.com/sebastianbergmann/php-timer/tree/2.1.3" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" } ], "time": "2020-11-30T08:20:02+00:00" }, { "name": "phpunit/php-token-stream", "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/a853a0e183b9db7eed023d7933a858fa1c8d25a3", "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3", "shasum": "" }, "require": { "ext-tokenizer": "*", "php": "^7.3 || ^8.0" }, "require-dev": { "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { "dev-master": "4.0-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" } ], "description": "Wrapper around PHP's tokenizer extension.", "homepage": "https://github.com/sebastianbergmann/php-token-stream/", "keywords": [ "tokenizer" ], "support": { "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", "source": "https://github.com/sebastianbergmann/php-token-stream/tree/master" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" } ], "abandoned": true, "time": "2020-08-04T08:28:15+00:00" }, { "name": "phpunit/phpunit", "version": "8.5.30", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", "reference": "4fd448df9affda65a5faa58f8b93087d415216ce" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4fd448df9affda65a5faa58f8b93087d415216ce", "reference": "4fd448df9affda65a5faa58f8b93087d415216ce", "shasum": "" }, "require": { "doctrine/instantiator": "^1.3.1", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", "myclabs/deep-copy": "^1.10.0", "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.2", "phpunit/php-code-coverage": "^7.0.12", "phpunit/php-file-iterator": "^2.0.4", "phpunit/php-text-template": "^1.2.1", "phpunit/php-timer": "^2.1.2", "sebastian/comparator": "^3.0.5", "sebastian/diff": "^3.0.2", "sebastian/environment": "^4.2.3", "sebastian/exporter": "^3.1.5", "sebastian/global-state": "^3.0.0", "sebastian/object-enumerator": "^3.0.3", "sebastian/resource-operations": "^2.0.1", "sebastian/type": "^1.1.3", "sebastian/version": "^2.0.1" }, "suggest": { "ext-soap": "*", "ext-xdebug": "*", "phpunit/php-invoker": "^2.0.0" }, "bin": [ "phpunit" ], "type": "library", "extra": { "branch-alias": { "dev-master": "8.5-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de", "role": "lead" } ], "description": "The PHP Unit Testing framework.", "homepage": "https://phpunit.de/", "keywords": [ "phpunit", "testing", "xunit" ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.30" }, "funding": [ { "url": "https://phpunit.de/sponsors.html", "type": "custom" }, { "url": "https://github.com/sebastianbergmann", "type": "github" }, { "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", "type": "tidelift" } ], "time": "2022-09-25T03:43:00+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619", "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619", "shasum": "" }, "require": { "php": ">=5.6" }, "require-dev": { "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { "branch-alias": { "dev-master": "1.0.x-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" } ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "support": { "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/1.0.2" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" } ], "time": "2020-11-30T08:15:22+00:00" }, { "name": "sebastian/comparator", "version": "3.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", "reference": "1dc7ceb4a24aede938c7af2a9ed1de09609ca770" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dc7ceb4a24aede938c7af2a9ed1de09609ca770", "reference": "1dc7ceb4a24aede938c7af2a9ed1de09609ca770", "shasum": "" }, "require": { "php": ">=7.1", "sebastian/diff": "^3.0", "sebastian/exporter": "^3.1" }, "require-dev": { "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { "branch-alias": { "dev-master": "3.0-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" }, { "name": "Volker Dusch", "email": "github@wallbash.com" }, { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" } ], "description": "Provides the functionality to compare PHP values for equality", "homepage": "https://github.com/sebastianbergmann/comparator", "keywords": [ "comparator", "compare", "equality" ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", "source": "https://github.com/sebastianbergmann/comparator/tree/3.0.5" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" } ], "time": "2022-09-14T12:31:48+00:00" }, { "name": "sebastian/diff", "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/14f72dd46eaf2f2293cbe79c93cc0bc43161a211", "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211", "shasum": "" }, "require": { "php": ">=7.1" }, "require-dev": { "phpunit/phpunit": "^7.5 || ^8.0", "symfony/process": "^2 || ^3.3 || ^4" }, "type": "library", "extra": { "branch-alias": { "dev-master": "3.0-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, { "name": "Kore Nordmann", "email": "mail@kore-nordmann.de" } ], "description": "Diff implementation", "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ "diff", "udiff", "unidiff", "unified diff" ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", "source": "https://github.com/sebastianbergmann/diff/tree/3.0.3" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" } ], "time": "2020-11-30T07:59:04+00:00" }, { "name": "sebastian/environment", "version": "4.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", "shasum": "" }, "require": { "php": ">=7.1" }, "require-dev": { "phpunit/phpunit": "^7.5" }, "suggest": { "ext-posix": "*" }, "type": "library", "extra": { "branch-alias": { "dev-master": "4.2-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" } ], "description": "Provides functionality to handle HHVM/PHP environments", "homepage": "http://www.github.com/sebastianbergmann/environment", "keywords": [ "Xdebug", "environment", "hhvm" ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", "source": "https://github.com/sebastianbergmann/environment/tree/4.2.4" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" } ], "time": "2020-11-30T07:53:42+00:00" }, { "name": "sebastian/exporter", "version": "3.1.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", "reference": "73a9676f2833b9a7c36968f9d882589cd75511e6" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/73a9676f2833b9a7c36968f9d882589cd75511e6", "reference": "73a9676f2833b9a7c36968f9d882589cd75511e6", "shasum": "" }, "require": { "php": ">=7.0", "sebastian/recursion-context": "^3.0" }, "require-dev": { "ext-mbstring": "*", "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { "branch-alias": { "dev-master": "3.1.x-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" }, { "name": "Volker Dusch", "email": "github@wallbash.com" }, { "name": "Adam Harvey", "email": "aharvey@php.net" }, { "name": "Bernhard Schussek", "email": "bschussek@gmail.com" } ], "description": "Provides the functionality to export PHP variables for visualization", "homepage": "http://www.github.com/sebastianbergmann/exporter", "keywords": [ "export", "exporter" ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", "source": "https://github.com/sebastianbergmann/exporter/tree/3.1.5" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" } ], "time": "2022-09-14T06:00:17+00:00" }, { "name": "sebastian/global-state", "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/de036ec91d55d2a9e0db2ba975b512cdb1c23921", "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921", "shasum": "" }, "require": { "php": ">=7.2", "sebastian/object-reflector": "^1.1.1", "sebastian/recursion-context": "^3.0" }, "require-dev": { "ext-dom": "*", "phpunit/phpunit": "^8.0" }, "suggest": { "ext-uopz": "*" }, "type": "library", "extra": { "branch-alias": { "dev-master": "3.0-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" } ], "description": "Snapshotting of global state", "homepage": "http://www.github.com/sebastianbergmann/global-state", "keywords": [ "global state" ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", "source": "https://github.com/sebastianbergmann/global-state/tree/3.0.2" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" } ], "time": "2022-02-10T06:55:38+00:00" }, { "name": "sebastian/object-enumerator", "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", "shasum": "" }, "require": { "php": ">=7.0", "sebastian/object-reflector": "^1.1.1", "sebastian/recursion-context": "^3.0" }, "require-dev": { "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { "dev-master": "3.0.x-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" } ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", "source": "https://github.com/sebastianbergmann/object-enumerator/tree/3.0.4" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" } ], "time": "2020-11-30T07:40:27+00:00" }, { "name": "sebastian/object-reflector", "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", "shasum": "" }, "require": { "php": ">=7.0" }, "require-dev": { "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { "dev-master": "1.1-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" } ], "description": "Allows reflection of object attributes, including inherited and non-public ones", "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", "source": "https://github.com/sebastianbergmann/object-reflector/tree/1.1.2" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" } ], "time": "2020-11-30T07:37:18+00:00" }, { "name": "sebastian/recursion-context", "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/367dcba38d6e1977be014dc4b22f47a484dac7fb", "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb", "shasum": "" }, "require": { "php": ">=7.0" }, "require-dev": { "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { "dev-master": "3.0.x-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" }, { "name": "Adam Harvey", "email": "aharvey@php.net" } ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", "source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.1" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" } ], "time": "2020-11-30T07:34:24+00:00" }, { "name": "sebastian/resource-operations", "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/31d35ca87926450c44eae7e2611d45a7a65ea8b3", "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3", "shasum": "" }, "require": { "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { "dev-master": "2.0-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" } ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", "support": { "issues": "https://github.com/sebastianbergmann/resource-operations/issues", "source": "https://github.com/sebastianbergmann/resource-operations/tree/2.0.2" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" } ], "time": "2020-11-30T07:30:19+00:00" }, { "name": "sebastian/type", "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/0150cfbc4495ed2df3872fb31b26781e4e077eb4", "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4", "shasum": "" }, "require": { "php": ">=7.2" }, "require-dev": { "phpunit/phpunit": "^8.2" }, "type": "library", "extra": { "branch-alias": { "dev-master": "1.1-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de", "role": "lead" } ], "description": "Collection of value objects that represent the types of the PHP type system", "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", "source": "https://github.com/sebastianbergmann/type/tree/1.1.4" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" } ], "time": "2020-11-30T07:25:11+00:00" }, { "name": "sebastian/version", "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", "shasum": "" }, "require": { "php": ">=5.6" }, "type": "library", "extra": { "branch-alias": { "dev-master": "2.0.x-dev" } }, "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de", "role": "lead" } ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", "support": { "issues": "https://github.com/sebastianbergmann/version/issues", "source": "https://github.com/sebastianbergmann/version/tree/master" }, "time": "2016-10-03T07:35:21+00:00" }, { "name": "squizlabs/php_codesniffer", "version": "3.7.1", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619", "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619", "shasum": "" }, "require": { "ext-simplexml": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", "php": ">=5.4.0" }, "require-dev": { "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" }, "bin": [ "bin/phpcs", "bin/phpcbf" ], "type": "library", "extra": { "branch-alias": { "dev-master": "3.x-dev" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Greg Sherwood", "role": "lead" } ], "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", "keywords": [ "phpcs", "standards" ], "support": { "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", "source": "https://github.com/squizlabs/PHP_CodeSniffer", "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, "time": "2022-06-18T07:21:10+00:00" }, { "name": "symfony/polyfill-ctype", "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", "shasum": "" }, "require": { "php": ">=7.1" }, "provide": { "ext-ctype": "*" }, "suggest": { "ext-ctype": "For best performance" }, "type": "library", "extra": { "branch-alias": { "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" } }, "autoload": { "files": [ "bootstrap.php" ], "psr-4": { "Symfony\\Polyfill\\Ctype\\": "" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Gert de Pagter", "email": "BackEndTea@gmail.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], "description": "Symfony polyfill for ctype functions", "homepage": "https://symfony.com", "keywords": [ "compatibility", "ctype", "polyfill", "portable" ], "support": { "source": "https://github.com/symfony/polyfill-ctype/tree/v1.26.0" }, "funding": [ { "url": "https://symfony.com/sponsor", "type": "custom" }, { "url": "https://github.com/fabpot", "type": "github" }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], "time": "2022-05-24T11:49:31+00:00" }, { "name": "theseer/tokenizer", "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", "shasum": "" }, "require": { "ext-dom": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", "php": "^7.2 || ^8.0" }, "type": "library", "autoload": { "classmap": [ "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Arne Blankerts", "email": "arne@blankerts.de", "role": "Developer" } ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", "source": "https://github.com/theseer/tokenizer/tree/1.2.1" }, "funding": [ { "url": "https://github.com/theseer", "type": "github" } ], "time": "2021-07-28T10:34:58+00:00" }, { "name": "vlucas/phpdotenv", "version": "v4.2.2", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", "reference": "77e974614d2ead521f18069dccc571696f52b8dc" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/77e974614d2ead521f18069dccc571696f52b8dc", "reference": "77e974614d2ead521f18069dccc571696f52b8dc", "shasum": "" }, "require": { "php": "^5.5.9 || ^7.0 || ^8.0", "phpoption/phpoption": "^1.7.3", "symfony/polyfill-ctype": "^1.17" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.4.1", "ext-filter": "*", "ext-pcre": "*", "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.21" }, "suggest": { "ext-filter": "Required to use the boolean validator.", "ext-pcre": "Required to use most of the library." }, "type": "library", "extra": { "branch-alias": { "dev-master": "4.2-dev" } }, "autoload": { "psr-4": { "Dotenv\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Graham Campbell", "email": "hello@gjcampbell.co.uk", "homepage": "https://github.com/GrahamCampbell" }, { "name": "Vance Lucas", "email": "vance@vancelucas.com", "homepage": "https://github.com/vlucas" } ], "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", "keywords": [ "dotenv", "env", "environment" ], "support": { "issues": "https://github.com/vlucas/phpdotenv/issues", "source": "https://github.com/vlucas/phpdotenv/tree/v4.2.2" }, "funding": [ { "url": "https://github.com/GrahamCampbell", "type": "github" }, { "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv", "type": "tidelift" } ], "time": "2021-12-12T23:07:53+00:00" } ], "aliases": [], "minimum-stability": "stable", "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { "php": ">=7.2.0", "ext-json": "*" }, "platform-dev": [], "plugin-api-version": "2.3.0" } PKZd;xendit-php/.editorconfignu[root = true [*] end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true indent_style = space indent_size = 4 [*.md] trim_trailing_whitespace = falsePKZw xendit-php/.env.examplenu[SECRET_API_KEY =PKZ,,xendit-php/LICENSEnu[MIT License Copyright (c) 2017-2022 Xendit Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PKZv xendit-php/.gitignorenu[# File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig # Created by https://www.gitignore.io/api/visualstudiocode # Edit at https://www.gitignore.io/?templates=visualstudiocode ### VisualStudioCode ### .vscode/* !.vscode/settings.json !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json ### VisualStudioCode Patch ### # Ignore all local history of files .history # End of https://www.gitignore.io/api/visualstudiocode # Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option) # For people using composer /vendor/ .idea/* .phpunit.result.cache clover.xml .env composer.phar composer-setup.php bin/ PKZk"xendit-php/.pre-commit-config.yamlnu[repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v2.4.0 hooks: - id: trailing-whitespace - repo: https://github.com/digitalpulp/pre-commit-php.git sha: 1.3.0 hooks: - id: php-lint - repo: local hooks: - id: phpcbf name: phpcbf entry: vendor/bin/phpcbf src language: script - id: phpcs name: phpcs entry: vendor/bin/phpcs src language: script PKZȵxendit-php/phpunit.xmlnu[ tests src PKZ 5zxendit-php/composer.jsonnu[PKZeLeL([xendit-php/tests/Xendit/EWalletsTest.phpnu[PKZ\\'Pxendit-php/tests/Xendit/InvoiceTest.phpnu[PKZey )`xendit-php/tests/Xendit/PromotionTest.phpnu[PKZeA.nxendit-php/tests/Xendit/CardlessCreditTest.phpnu[PKZ.&/xendit-php/tests/Xendit/QRCodeTest.phpnu[PKZ.ff)xendit-php/tests/Xendit/RecurringTest.phpnu[PKZ1'xendit-php/tests/Xendit/BalanceTest.phpnu[PKZƙ4 4 0xendit-php/tests/Xendit/DisbursementsPHPTest.phpnu[PKZxendit-php/tests/Xendit/DirectDebitTest.phpnu[PKZ=||/uxendit-php/tests/Xendit/PaymentChannelsTest.phpnu[PKZk%]]zxendit-php/tests/TestCase.phpnu[PKZmLL Jxendit-php/src/Disbursements.phpnu[PKZ"ww'xendit-php/src/ApiOperations/Update.phpnu[PKZ8>>'xendit-php/src/ApiOperations/Create.phpnu[PKZ6)##)Ixendit-php/src/ApiOperations/Retrieve.phpnu[PKZ8H,ťxendit-php/src/ApiOperations/RetrieveAll.phpnu[PKZ,6> > (!xendit-php/src/ApiOperations/Request.phpnu[PKZ#xendit-php/src/DisbursementsPHP.phpnu[PKZ3 0xendit-php/src/Exceptions/ExceptionInterface.phpnu[PKZԋee*xendit-php/src/Exceptions/ApiException.phpnu[PKZ {TRR6xendit-php/src/Exceptions/InvalidArgumentException.phpnu[PKZ12,Exendit-php/src/QRCode.phpnu[PKZnm  :xendit-php/src/Platform.phpnu[PKZrTTxendit-php/src/Balance.phpnu[PKZ~ZM '0xendit-php/src/DisbursementChannels.phpnu[PKZH&Kxendit-php/src/HttpClientInterface.phpnu[PKZZ^oxendit-php/src/Cards.phpnu[PKZ.q!%xendit-php/src/CardlessCredit.phpnu[PKZ`,xendit-php/src/DirectDebit.phpnu[PKZB7  "Ixendit-php/src/PaymentChannels.phpnu[PKZn/Nxendit-php/src/Payouts.phpnu[PKZSllTxendit-php/src/EWallets.phpnu[PKZNkxendit-php/src/Invoice.phpnu[PKZώzzrxendit-php/src/Retail.phpnu[PKZJwxendit-php/src/PayLater.phpnu[PKZ G5 5 xendit-php/src/ApiRequestor.phpnu[PKZT xendit-php/src/Promotion.phpnu[PKZK~xendit-php/src/Recurring.phpnu[PKZH  xendit-php/src/Transaction.phpnu[PKZz} =xendit-php/src/Customers.phpnu[PKZQn n 4xendit-php/src/Xendit.phpnu[PKZ,+ss*xendit-php/src/HttpClient/GuzzleClient.phpnu[PKZ_-xendit-php/src/HttpClient/ClientInterface.phpnu[PKZP9HH"xendit-php/src/VirtualAccounts.phpnu[PKZduJxendit-php/src/Report.phpnu[PKZQyvxendit-php/README.mdnu[PKZss$Nxendit-php/.github/workflows/php.ymlnu[PKZN8> > xendit-php/MIGRATE.mdnu[PKZOArr*xendit-php/examples/TransactionExample.phpnu[PKZC9*dxendit-php/examples/DirectDebitExample.phpnu[PKZDF F /ξxendit-php/examples/DisbursementsPHPExample.phpnu[PKZ{%sxendit-php/examples/RetailExample.phpnu[PKZ.xendit-php/examples/PaymentChannelsExample.phpnu[PKZs&xendit-php/examples/InvoiceExample.phpnu[PKZ)2??+xendit-php/examples/CardsReverseExample.phpnu[PKZ(uxendit-php/examples/CustomHttpClient.phpnu[PKZ:f(xendit-php/examples/PromotionExample.phpnu[PKZ/'xendit-php/examples/EWalletsExample.phpnu[PKZىNN38xendit-php/examples/DisbursementChannelsExample.phpnu[PKZܓ!//%xendit-php/examples/ReportExample.phpnu[PKZrW&mxendit-php/examples/PayoutsExample.phpnu[PKZlOP(pxendit-php/examples/CustomersExample.phpnu[PKZRNc'xendit-php/examples/PlatformExample.phpnu[PKZ̟X_44& xendit-php/examples/BalanceExample.phpnu[PKZ -vxendit-php/examples/CardlessCreditExample.phpnu[PKZ EE,Txendit-php/examples/DisbursementsExample.phpnu[PKZйՄ(xendit-php/examples/RecurringExample.phpnu[PKZEpp'$xendit-php/examples/PayLaterExample.phpnu[PKZn:ވ--xendit-php/examples/VirtualAccountExample.phpnu[PKZ7MDD$1xendit-php/examples/CardsExample.phpnu[PKZ 8'pp%[6xendit-php/examples/QRCodeExample.phpnu[PKZhJFF 9xendit-php/composer.locknu[PKZd;Jxendit-php/.editorconfignu[PKZw Mxendit-php/.env.examplenu[PKZ,,xendit-php/LICENSEnu[PKZv xendit-php/.gitignorenu[PKZk"%xendit-php/.pre-commit-config.yamlnu[PKZȵAxendit-php/phpunit.xmlnu[PKZZ:#>