From b1c956b2667604b092a057fbd23988354eac1400 Mon Sep 17 00:00:00 2001 From: Zaki Ibrahim Date: Mon, 20 Jul 2020 09:58:18 +0700 Subject: [PATCH 1/4] Replace deprecated array_key_exists php 7.4 to isset --- Midtrans/Snap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Midtrans/Snap.php b/Midtrans/Snap.php index d3c4651..998dbfc 100644 --- a/Midtrans/Snap.php +++ b/Midtrans/Snap.php @@ -62,7 +62,7 @@ public static function createTransaction($params) ) ); - if (array_key_exists('item_details', $params)) { + if (isset($params['item_details'])) { $gross_amount = 0; foreach ($params['item_details'] as $item) { $gross_amount += $item['quantity'] * $item['price']; From dd411ffaac954d966f549613df0a91f3268638e7 Mon Sep 17 00:00:00 2001 From: Zaki Ibrahim Date: Mon, 20 Jul 2020 09:58:36 +0700 Subject: [PATCH 2/4] add .idea for intellij --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8104711..6020c6e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ composer.lock composer.phar -vendor/ \ No newline at end of file +vendor/ +.idea \ No newline at end of file From 50d4bd8f13262ff228b2d5482aae4d58d75e20be Mon Sep 17 00:00:00 2001 From: Zaki Ibrahim Date: Mon, 20 Jul 2020 10:02:15 +0700 Subject: [PATCH 3/4] Increasing version for patch update --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a01510d..c4951da 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "midtrans/midtrans-php", "description": "PHP Wrapper for Midtrans Payment API.", "homepage": "https://midtrans.com", - "version": "2.3.0", + "version": "2.3.1", "type": "library", "license":"GPL-3.0", "authors": [ From 22d31742c4f9cf0136323d13bf49952b66b93bf3 Mon Sep 17 00:00:00 2001 From: Rizda Dwi Prasetya Date: Mon, 20 Jul 2020 05:38:17 +0000 Subject: [PATCH 4/4] fix testRealConnect issue caused by unexpected API response if key empty --- tests/MidtransCoreApiTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/MidtransCoreApiTest.php b/tests/MidtransCoreApiTest.php index b3c94f9..7417ca9 100644 --- a/tests/MidtransCoreApiTest.php +++ b/tests/MidtransCoreApiTest.php @@ -41,8 +41,9 @@ public function testCharge() $this->assertTrue(in_array('X-Override-Notification: https://example.com', $fields["HTTPHEADER"])); } - public function testRealConnect() + public function testRealConnectWithInvalidKey() { + Config::$serverKey = 'invalid-server-key'; $params = array( 'transaction_details' => array( 'order_id' => rand(),