From 3d4ef81948f86820bf3f1237204e812262b6db36 Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Mon, 18 Mar 2019 11:37:22 +0530 Subject: [PATCH 01/24] Transaction Hash Upgrade Guide --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 99bb4ff..16df4c1 100644 --- a/README.md +++ b/README.md @@ -48,3 +48,7 @@ We provide a custom `SPL` autoloader. Just [download the SDK](https://github.com ```php require 'path/to/anet_php_sdk/autoload.php'; ``` + + +### Transaction Hash Upgrade +Authorize.Net is phasing out the MD5 based `transHash` element in favor of the SHA-512 based `transHashSHA2`. The setting in the Merchant Interface which controlled the MD5 Hash option is no longer available, and the `transHash` element will stop returning values at a later date to be determined. For information on how to use `transHashSHA2`, see the [Transaction Hash Upgrade Guide] (https://developer.authorize.net/support/hash_upgrade/). From 3b8fc7c1462e240c4b4c497984c45e680f6a94de Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Mon, 18 Mar 2019 11:38:34 +0530 Subject: [PATCH 02/24] Reverting change --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 16df4c1..99bb4ff 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,3 @@ We provide a custom `SPL` autoloader. Just [download the SDK](https://github.com ```php require 'path/to/anet_php_sdk/autoload.php'; ``` - - -### Transaction Hash Upgrade -Authorize.Net is phasing out the MD5 based `transHash` element in favor of the SHA-512 based `transHashSHA2`. The setting in the Merchant Interface which controlled the MD5 Hash option is no longer available, and the `transHash` element will stop returning values at a later date to be determined. For information on how to use `transHashSHA2`, see the [Transaction Hash Upgrade Guide] (https://developer.authorize.net/support/hash_upgrade/). From 6e1dcf6d2d86950b5973946b2507c70d8ec83381 Mon Sep 17 00:00:00 2001 From: Kaushik Mahato Date: Fri, 21 Jun 2019 13:53:17 +0530 Subject: [PATCH 03/24] Update create-customer-profile.php removing $paymentProfile->setDefaultpaymentProfile(true); as its not valid for this sample code --- CustomerProfiles/create-customer-profile.php | 1 - 1 file changed, 1 deletion(-) diff --git a/CustomerProfiles/create-customer-profile.php b/CustomerProfiles/create-customer-profile.php index 91390da..49fb43f 100644 --- a/CustomerProfiles/create-customer-profile.php +++ b/CustomerProfiles/create-customer-profile.php @@ -67,7 +67,6 @@ function createCustomerProfile($email) $paymentProfile->setCustomerType('individual'); $paymentProfile->setBillTo($billTo); $paymentProfile->setPayment($paymentCreditCard); - $paymentProfile->setDefaultpaymentProfile(true); $paymentProfiles[] = $paymentProfile; From a642526ff20068d05685303f8e42b7bbefd79dd4 Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Wed, 31 Jul 2019 22:10:50 +0530 Subject: [PATCH 04/24] Update update-customer-payment-profile.php --- CustomerProfiles/update-customer-payment-profile.php | 1 + 1 file changed, 1 insertion(+) diff --git a/CustomerProfiles/update-customer-payment-profile.php b/CustomerProfiles/update-customer-payment-profile.php index 6093087..834c18f 100644 --- a/CustomerProfiles/update-customer-payment-profile.php +++ b/CustomerProfiles/update-customer-payment-profile.php @@ -76,6 +76,7 @@ function updateCustomerPaymentProfile($customerProfileId = "1916322670", } else { + $errorMessages = $response->getMessages()->getMessage(); echo "Failed to Update Customer Payment Profile : " . $errorMessages[0]->getCode() . " " .$errorMessages[0]->getText() . "\n"; } From 5de62af3679d3e0e6a69177ff6ff938d77f5d46f Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Wed, 31 Jul 2019 22:12:41 +0530 Subject: [PATCH 05/24] Update update-customer-payment-profile.php --- CustomerProfiles/update-customer-payment-profile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CustomerProfiles/update-customer-payment-profile.php b/CustomerProfiles/update-customer-payment-profile.php index 834c18f..484d5e5 100644 --- a/CustomerProfiles/update-customer-payment-profile.php +++ b/CustomerProfiles/update-customer-payment-profile.php @@ -74,7 +74,7 @@ function updateCustomerPaymentProfile($customerProfileId = "1916322670", print_r($response); echo "Update Customer Payment Profile SUCCESS: " . $Message[0]->getCode() . " " .$Message[0]->getText() . "\n"; } - else + else if ($response != null) { $errorMessages = $response->getMessages()->getMessage(); echo "Failed to Update Customer Payment Profile : " . $errorMessages[0]->getCode() . " " .$errorMessages[0]->getText() . "\n"; From b66cc4033af0730a58827dfe5808549e3e19e42e Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Wed, 31 Jul 2019 22:13:27 +0530 Subject: [PATCH 06/24] Update .travis.yml --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 0d096c4..efd338d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,7 @@ language: php +dist: trusty + php: - 5.6 - 7.0 From c68826ea454f83b02afcd1598a4e73a2f00687d6 Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Wed, 4 Mar 2020 13:56:51 +0530 Subject: [PATCH 07/24] + Renamed Visa Checkout to Visa SRC + Blocking GetCustomerProfileIds call as response exceeds log limit --- SampleCodeList.txt | 6 +++--- ...kout-transaction.php => create-visa-src-transaction.php} | 4 ++-- ...ypt-visa-checkout-data.php => decrypt-visa-src-data.php} | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) rename VisaCheckout/{create-visa-checkout-transaction.php => create-visa-src-transaction.php} (98%) rename VisaCheckout/{decrypt-visa-checkout-data.php => decrypt-visa-src-data.php} (98%) diff --git a/SampleCodeList.txt b/SampleCodeList.txt index 621aa28..a41fd6f 100644 --- a/SampleCodeList.txt +++ b/SampleCodeList.txt @@ -7,8 +7,8 @@ GetTransactionList,0,1 CreateAnApplePayTransaction,0,0 CreateAnAcceptTransaction,0,0 CreateAnAndroidPayTransaction,0,0 -DecryptVisaCheckoutData,0,1 -CreateVisaCheckoutTransaction,0,0 +decryptVisaSrcData,0,1 +createVisaSrcTransaction,0,0 CaptureFundsAuthorizedThroughAnotherChannel,1,1 AuthorizeCreditCard,1,1 DebitBankAccount,1,1 @@ -23,7 +23,7 @@ UpdateCustomerShippingAddress,1,1 UpdateCustomerProfile,0,1 UpdateCustomerPaymentProfile,1,1 GetCustomerShippingAddress,1,1 -GetCustomerProfileIds,0,1 +GetCustomerProfileIds,0,0 GetCustomerProfile,1,1 GetAcceptCustomerProfilePage,1,1 GetCustomerPaymentProfile,1,1 diff --git a/VisaCheckout/create-visa-checkout-transaction.php b/VisaCheckout/create-visa-src-transaction.php similarity index 98% rename from VisaCheckout/create-visa-checkout-transaction.php rename to VisaCheckout/create-visa-src-transaction.php index 8ec941c..1edcf11 100644 --- a/VisaCheckout/create-visa-checkout-transaction.php +++ b/VisaCheckout/create-visa-src-transaction.php @@ -6,7 +6,7 @@ define("AUTHORIZENET_LOG_FILE", "phplog"); -function createVisaCheckoutTransaction() +function createVisaSrcTransaction() { /* Create a merchantAuthenticationType object with authentication details retrieved from the constants file */ @@ -88,6 +88,6 @@ function createVisaCheckoutTransaction() } if(!defined('DONT_RUN_SAMPLES')) - createVisaCheckoutTransaction(); + createVisaSrcTransaction(); ?> diff --git a/VisaCheckout/decrypt-visa-checkout-data.php b/VisaCheckout/decrypt-visa-src-data.php similarity index 98% rename from VisaCheckout/decrypt-visa-checkout-data.php rename to VisaCheckout/decrypt-visa-src-data.php index 48c8de4..2b2b791 100644 --- a/VisaCheckout/decrypt-visa-checkout-data.php +++ b/VisaCheckout/decrypt-visa-src-data.php @@ -6,7 +6,7 @@ define("AUTHORIZENET_LOG_FILE", "phplog"); -function decryptVisaCheckoutData() +function decryptVisaSrcData() { /* Create a merchantAuthenticationType object with authentication details retrieved from the constants file */ @@ -46,6 +46,6 @@ function decryptVisaCheckoutData() } if(!defined('DONT_RUN_SAMPLES')) - decryptVisaCheckoutData(); + decryptVisaSrcData(); ?> From 064ae813384b352d80f8281f13b566ba0b5e281c Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Thu, 4 Feb 2021 23:35:56 +0530 Subject: [PATCH 08/24] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index bd7d261..7d41385 100644 --- a/composer.json +++ b/composer.json @@ -3,6 +3,6 @@ "php": ">=5.6", "ext-curl": "*", "phpunit/phpunit": "~4.8||~6.0", - "authorizenet/authorizenet": ">=1.9.9 || <2.0" + "authorizenet/authorizenet": ">=1.9.9 || <2.1" } } From a9415419647e05e35aa226b328f469383c337119 Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Mon, 8 Mar 2021 15:29:54 +0530 Subject: [PATCH 09/24] Testing on PHP v8.0 --- .travis.yml | 5 +++- .../create-customer-payment-profile.php | 2 +- .../create-customer-shipping-address.php | 2 +- .../delete-customer-payment-profile.php | 4 +-- CustomerProfiles/delete-customer-profile.php | 2 +- .../delete-customer-shipping-address.php | 2 +- .../get-customer-payment-profile.php | 4 +-- .../update-customer-shipping-address.php | 2 +- .../validate-customer-payment-profile.php | 4 +-- RecurringBilling/cancel-subscription.php | 2 +- RecurringBilling/create-subscription.php | 2 +- test-runner.php => TestRunner.php | 0 TransactionReporting/get-transaction-list.php | 26 +++++++++---------- 13 files changed, 30 insertions(+), 27 deletions(-) rename test-runner.php => TestRunner.php (100%) diff --git a/.travis.yml b/.travis.yml index efd338d..8c7ae89 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,9 @@ php: - 5.6 - 7.0 - 7.1 + - 7.3 + - 7.4 + - 8.0 sudo: false @@ -13,5 +16,5 @@ before_script: - composer install --prefer-dist script: - - phpunit test-runner.php . + - phpunit TestRunner.php . diff --git a/CustomerProfiles/create-customer-payment-profile.php b/CustomerProfiles/create-customer-payment-profile.php index 1acb10c..3c3812f 100644 --- a/CustomerProfiles/create-customer-payment-profile.php +++ b/CustomerProfiles/create-customer-payment-profile.php @@ -79,6 +79,6 @@ function createCustomerPaymentProfile($existingcustomerprofileid, $phoneNumber) } if (!defined('DONT_RUN_SAMPLES')) { - createCustomerPaymentProfile("1807545561", "000-000-0009"); + createCustomerPaymentProfile("1929905607", "000-000-0009"); } ?> diff --git a/CustomerProfiles/create-customer-shipping-address.php b/CustomerProfiles/create-customer-shipping-address.php index 22ce6fb..3044353 100644 --- a/CustomerProfiles/create-customer-shipping-address.php +++ b/CustomerProfiles/create-customer-shipping-address.php @@ -6,7 +6,7 @@ define("AUTHORIZENET_LOG_FILE", "phplog"); -function createCustomerShippingAddress($existingcustomerprofileid = "36152127", +function createCustomerShippingAddress($existingcustomerprofileid = "1929905607", $phoneNumber="000-000-0000" ) { /* Create a merchantAuthenticationType object with authentication details diff --git a/CustomerProfiles/delete-customer-payment-profile.php b/CustomerProfiles/delete-customer-payment-profile.php index 64383d9..ce3e6ca 100644 --- a/CustomerProfiles/delete-customer-payment-profile.php +++ b/CustomerProfiles/delete-customer-payment-profile.php @@ -6,8 +6,8 @@ define("AUTHORIZENET_LOG_FILE", "phplog"); -function deleteCustomerPaymentProfile($customerProfileId= "36152127", - $customerpaymentprofileid = "32689274" +function deleteCustomerPaymentProfile($customerProfileId= "1929905607", + $customerpaymentprofileid = "1842074814" ) { /* Create a merchantAuthenticationType object with authentication details retrieved from the constants file */ diff --git a/CustomerProfiles/delete-customer-profile.php b/CustomerProfiles/delete-customer-profile.php index 9044d0c..ee918cc 100644 --- a/CustomerProfiles/delete-customer-profile.php +++ b/CustomerProfiles/delete-customer-profile.php @@ -39,5 +39,5 @@ function deleteCustomerProfile($customerProfileId) } if(!defined('DONT_RUN_SAMPLES')) - deleteCustomerProfile("38958129"); + deleteCustomerProfile("1929905651"); ?> diff --git a/CustomerProfiles/delete-customer-shipping-address.php b/CustomerProfiles/delete-customer-shipping-address.php index 9d3cb2f..d3f2ccc 100644 --- a/CustomerProfiles/delete-customer-shipping-address.php +++ b/CustomerProfiles/delete-customer-shipping-address.php @@ -6,7 +6,7 @@ define("AUTHORIZENET_LOG_FILE", "phplog"); -function deleteCustomerShippingAddress($customerprofileid = "36731856", $customeraddressid = "36976434") +function deleteCustomerShippingAddress($customerprofileid = "1929905607", $customeraddressid = "901116911") { /* Create a merchantAuthenticationType object with authentication details retrieved from the constants file */ diff --git a/CustomerProfiles/get-customer-payment-profile.php b/CustomerProfiles/get-customer-payment-profile.php index c059bc5..6e056a5 100644 --- a/CustomerProfiles/get-customer-payment-profile.php +++ b/CustomerProfiles/get-customer-payment-profile.php @@ -7,8 +7,8 @@ define("AUTHORIZENET_LOG_FILE", "phplog"); -function getCustomerPaymentProfile($customerProfileId="36731856", - $customerPaymentProfileId= "33211899" +function getCustomerPaymentProfile($customerProfileId="1929905607", + $customerPaymentProfileId= "1842074814" ) { /* Create a merchantAuthenticationType object with authentication details retrieved from the constants file */ diff --git a/CustomerProfiles/update-customer-shipping-address.php b/CustomerProfiles/update-customer-shipping-address.php index 3c7cb7f..36ad6ad 100644 --- a/CustomerProfiles/update-customer-shipping-address.php +++ b/CustomerProfiles/update-customer-shipping-address.php @@ -54,5 +54,5 @@ function updateCustomerShippingAddress($customerprofileid, $customeraddressid) return $response; } if(!defined('DONT_RUN_SAMPLES')) - updateCustomerShippingAddress( "36152127","36976566"); + updateCustomerShippingAddress( "1929905607","901116911"); ?> diff --git a/CustomerProfiles/validate-customer-payment-profile.php b/CustomerProfiles/validate-customer-payment-profile.php index b262186..ca57209 100644 --- a/CustomerProfiles/validate-customer-payment-profile.php +++ b/CustomerProfiles/validate-customer-payment-profile.php @@ -6,8 +6,8 @@ define("AUTHORIZENET_LOG_FILE", "phplog"); -function validateCustomerPaymentProfile($customerProfileId= "36731856", - $customerPaymentProfileId= "33211899" +function validateCustomerPaymentProfile($customerProfileId= "1929905607", + $customerPaymentProfileId= "1842074814" ) { /* Create a merchantAuthenticationType object with authentication details retrieved from the constants file */ diff --git a/RecurringBilling/cancel-subscription.php b/RecurringBilling/cancel-subscription.php index e4cbe9e..59f8553 100644 --- a/RecurringBilling/cancel-subscription.php +++ b/RecurringBilling/cancel-subscription.php @@ -45,6 +45,6 @@ function cancelSubscription($subscriptionId) } if(!defined('DONT_RUN_SAMPLES')) - cancelSubscription("3056945"); + cancelSubscription("7087965"); ?> diff --git a/RecurringBilling/create-subscription.php b/RecurringBilling/create-subscription.php index 66f539a..1bf6fba 100644 --- a/RecurringBilling/create-subscription.php +++ b/RecurringBilling/create-subscription.php @@ -28,7 +28,7 @@ function createSubscription($intervalLength) $paymentSchedule = new AnetAPI\PaymentScheduleType(); $paymentSchedule->setInterval($interval); - $paymentSchedule->setStartDate(new DateTime('2020-08-30')); + $paymentSchedule->setStartDate(new DateTime('2035-12-30')); $paymentSchedule->setTotalOccurrences("12"); $paymentSchedule->setTrialOccurrences("1"); diff --git a/test-runner.php b/TestRunner.php similarity index 100% rename from test-runner.php rename to TestRunner.php diff --git a/TransactionReporting/get-transaction-list.php b/TransactionReporting/get-transaction-list.php index bfad6f0..ccf86c1 100644 --- a/TransactionReporting/get-transaction-list.php +++ b/TransactionReporting/get-transaction-list.php @@ -30,19 +30,19 @@ function getTransactionList() if (($response != null) && ($response->getMessages()->getResultCode() == "Ok")) { - echo "SUCCESS: Get Transaction List for BatchID : " . $batchId . "\n\n"; - if ($response->getTransactions() == null) { - echo "No Transaction to display in this Batch."; - return ; - } - //Displaying the details of each transaction in the list - foreach ($response->getTransactions() as $transaction) { - echo " ->Transaction Id : " . $transaction->getTransId() . "\n"; - echo " Submitted on (Local) : " . date_format($transaction->getSubmitTimeLocal(), 'Y-m-d H:i:s') . "\n"; - echo " Status : " . $transaction->getTransactionStatus() . "\n"; - echo " Settle amount : " . number_format($transaction->getSettleAmount(), 2, '.', '') . "\n"; - } - } + echo "SUCCESS: Get Transaction List for BatchID : " . $batchId . "\n\n"; + if ($response->getTransactions() == null) { + echo "No Transaction to display in this Batch."; + return $response; + } + //Displaying the details of each transaction in the list + foreach ($response->getTransactions() as $transaction) { + echo " ->Transaction Id : " . $transaction->getTransId() . "\n"; + echo " Submitted on (Local) : " . date_format($transaction->getSubmitTimeLocal(), 'Y-m-d H:i:s') . "\n"; + echo " Status : " . $transaction->getTransactionStatus() . "\n"; + echo " Settle amount : " . number_format($transaction->getSettleAmount(), 2, '.', '') . "\n"; + } + } else { echo "ERROR : Invalid response\n"; From fc1b992e618c453edfc7fb8c8369f6421e5a421a Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Mon, 8 Mar 2021 15:31:19 +0530 Subject: [PATCH 10/24] Updating to latest version --- composer.json | 4 ++-- composer.json.sdk-dev | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index bd7d261..a33436e 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "require": { "php": ">=5.6", "ext-curl": "*", - "phpunit/phpunit": "~4.8||~6.0", - "authorizenet/authorizenet": ">=1.9.9 || <2.0" + "phpunit/phpunit": "~9.0||~9.5", + "authorizenet/authorizenet": ">=2.0 || <2.1" } } diff --git a/composer.json.sdk-dev b/composer.json.sdk-dev index 12fdd53..9caf00c 100644 --- a/composer.json.sdk-dev +++ b/composer.json.sdk-dev @@ -2,8 +2,8 @@ "require": { "php": ">=5.6", "ext-curl": "*", - "phpunit/phpunit": "~4.8||~6.0", - "authorizenet/authorizenet": ">=1.9.6 || <2.0" + "phpunit/phpunit": "~9.0||~9.5", + "authorizenet/authorizenet": ">=2.0 || <2.1" }, "autoload": { "classmap": ["constants", "lib"] From 45e4119274568006b12d77861219e105a83566d4 Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Mon, 8 Mar 2021 15:38:08 +0530 Subject: [PATCH 11/24] Changed composer to update --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8c7ae89..26a04b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ php: sudo: false before_script: - - composer install --prefer-dist + - composer update --prefer-dist script: - phpunit TestRunner.php . From 33a17976bbfdbd9f40e6d1e9aa4211f862407936 Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Mon, 8 Mar 2021 15:45:05 +0530 Subject: [PATCH 12/24] Downgraded version of phpunit --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a33436e..b4a3a6b 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "require": { "php": ">=5.6", "ext-curl": "*", - "phpunit/phpunit": "~9.0||~9.5", + "phpunit/phpunit": "~4.8||~6.0", "authorizenet/authorizenet": ">=2.0 || <2.1" } } From 51a436d0b882bb0daf150ed095fbc7db7b2ab48f Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Mon, 8 Mar 2021 15:52:38 +0530 Subject: [PATCH 13/24] Testing without trusty image --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 26a04b3..af82246 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: php -dist: trusty +# dist: trusty php: - 5.6 From cb43517fe605cebe1193970196251c0b6518af74 Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Mon, 8 Mar 2021 16:37:06 +0530 Subject: [PATCH 14/24] Testing multiple versions of PhpUnit --- .travis.yml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index af82246..896ef42 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,13 +6,35 @@ php: - 5.6 - 7.0 - 7.1 + - 7.2 - 7.3 - 7.4 - 8.0 - + +env: + - PHPUNIT_VERSION=5.6.* + +matrix: + include: + - php: 5.6 + env: PHPUNIT_VERSION=5.6.* + - php: 7.0 + env: PHPUNIT_VERSION=6.5.* + - php: 7.1 + env: PHPUNIT_VERSION=7.5.* + - php: 7.2 + env: PHPUNIT_VERSION=8.5.* + - php: 7.3 + env: PHPUNIT_VERSION=9.5.* + - php: 7.4 + env: PHPUNIT_VERSION=9.5.* + - php: 8.0 + env: PHPUNIT_VERSION=9.5.* + sudo: false before_script: + - composer require "phpunit/phpunit:${PHPUNIT_VERSION}" --no-update - composer update --prefer-dist script: From 13d437891bfd90668fef1d06a5b7bd67ae4b7e9e Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Mon, 8 Mar 2021 16:39:28 +0530 Subject: [PATCH 15/24] Removed base version of PhpUnit --- .travis.yml | 4 ++-- composer.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 896ef42..4263ae5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,8 +11,8 @@ php: - 7.4 - 8.0 -env: - - PHPUNIT_VERSION=5.6.* +# env: +# - PHPUNIT_VERSION=5.6.* matrix: include: diff --git a/composer.json b/composer.json index b4a3a6b..c9bf403 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "require": { "php": ">=5.6", "ext-curl": "*", - "phpunit/phpunit": "~4.8||~6.0", + "phpunit/phpunit": "9.3.5", "authorizenet/authorizenet": ">=2.0 || <2.1" } } From e2ac0c16a4fdd06d3a557494b3b08183af5a80de Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Mon, 8 Mar 2021 16:41:06 +0530 Subject: [PATCH 16/24] Removed dependency to phpunit from composer --- composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/composer.json b/composer.json index c9bf403..08f03a6 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,6 @@ "require": { "php": ">=5.6", "ext-curl": "*", - "phpunit/phpunit": "9.3.5", "authorizenet/authorizenet": ">=2.0 || <2.1" } } From 8a9d912c92015fea5127de47b9a3b9b2ca405ee0 Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Mon, 8 Mar 2021 16:42:31 +0530 Subject: [PATCH 17/24] Comment out php versions without env variables --- .travis.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4263ae5..d0845ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,14 +2,14 @@ language: php # dist: trusty -php: - - 5.6 - - 7.0 - - 7.1 - - 7.2 - - 7.3 - - 7.4 - - 8.0 +# php: +# - 5.6 +# - 7.0 +# - 7.1 +# - 7.2 +# - 7.3 +# - 7.4 +# - 8.0 # env: # - PHPUNIT_VERSION=5.6.* From 13f9e73de7ed04e62937cadfbdc42625b43c5a40 Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Mon, 8 Mar 2021 16:55:27 +0530 Subject: [PATCH 18/24] Corrected version of phpunit --- .travis.yml | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index d0845ee..3992743 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,27 +1,13 @@ language: php -# dist: trusty - -# php: -# - 5.6 -# - 7.0 -# - 7.1 -# - 7.2 -# - 7.3 -# - 7.4 -# - 8.0 - -# env: -# - PHPUNIT_VERSION=5.6.* - matrix: include: - php: 5.6 env: PHPUNIT_VERSION=5.6.* - php: 7.0 - env: PHPUNIT_VERSION=6.5.* + env: PHPUNIT_VERSION=5.7.* - php: 7.1 - env: PHPUNIT_VERSION=7.5.* + env: PHPUNIT_VERSION=6.5.* - php: 7.2 env: PHPUNIT_VERSION=8.5.* - php: 7.3 From fd0177ba90ba2d156c3cd6ca3193e0a2cf11ef78 Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Mon, 8 Mar 2021 17:01:01 +0530 Subject: [PATCH 19/24] Corrected version of phpunit --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3992743..363cc6b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,9 +5,9 @@ matrix: - php: 5.6 env: PHPUNIT_VERSION=5.6.* - php: 7.0 - env: PHPUNIT_VERSION=5.7.* + env: PHPUNIT_VERSION=5.6.* - php: 7.1 - env: PHPUNIT_VERSION=6.5.* + env: PHPUNIT_VERSION=5.7.* - php: 7.2 env: PHPUNIT_VERSION=8.5.* - php: 7.3 From a1450dcf94a22f3be1ab9f3281bd387f5bcda7ef Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Mon, 8 Mar 2021 17:06:56 +0530 Subject: [PATCH 20/24] Specify dist per PHP version --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index 363cc6b..45de70f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,18 +4,25 @@ matrix: include: - php: 5.6 env: PHPUNIT_VERSION=5.6.* + dist: trusty - php: 7.0 env: PHPUNIT_VERSION=5.6.* + dist: trusty - php: 7.1 env: PHPUNIT_VERSION=5.7.* + dist: trusty - php: 7.2 env: PHPUNIT_VERSION=8.5.* + dist: bionic - php: 7.3 env: PHPUNIT_VERSION=9.5.* + dist: bionic - php: 7.4 env: PHPUNIT_VERSION=9.5.* + dist: bionic - php: 8.0 env: PHPUNIT_VERSION=9.5.* + dist: bionic sudo: false From 76879828d7a985064504f04a0af334d482257f62 Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Date: Wed, 19 Jul 2023 21:15:12 +0530 Subject: [PATCH 21/24] Added CreateGooglePayTransaction --- .../create-google-pay-transaction.php | 113 ++++++++++++++++++ .../update-split-tender-group.php | 2 +- 2 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 MobileInAppTransactions/create-google-pay-transaction.php diff --git a/MobileInAppTransactions/create-google-pay-transaction.php b/MobileInAppTransactions/create-google-pay-transaction.php new file mode 100644 index 0000000..75ecc36 --- /dev/null +++ b/MobileInAppTransactions/create-google-pay-transaction.php @@ -0,0 +1,113 @@ +setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); + + $refId = 'ref' . time(); + + $opaqueData = new AnetAPI\OpaqueDataType(); + $opaqueData->setDataDescriptor("COMMON.GOOGLE.INAPP.PAYMENT"); + $opaqueData->setDataValue("1234567890ABCDEF1111AAAA2222BBBB3333CCCC4444DDDD5555EEEE6666FFFF7777888899990000"); + $paymentType = new AnetAPI\PaymentType(); + $paymentType->setOpaqueData($opaqueData); + + $lineItem = new AnetAPI\LineItemType(); + $lineItem->setItemId("1"); + $lineItem->setName("vase"); + $lineItem->setDescription("Cannes logo"); + $lineItem->setQuantity(18); + $lineItem->setUnitPrice(45.00); + + $lineItemsArray = array(); + $lineItemsArray[0] = $lineItem; + + $tax = new AnetAPI\ExtendedAmountType(); + $tax->setAmount(5.00); + $tax->setName("level2 tax name"); + $tax->setDescription("level2 tax"); + + $userField = new AnetAPI\UserFieldType(); + $userFields = array(); + + $userField->setName("UserDefinedFieldName1"); + $userField->setValue("UserDefinedFieldValue1"); + $userFields[0] = $userField; + + $userField->setName("UserDefinedFieldName2"); + $userField->setValue("UserDefinedFieldValue2"); + $userFields[1] = $userField; + + $transactionRequestType = new AnetAPI\TransactionRequestType(); + $transactionRequestType->setTransactionType("authCaptureTransaction"); + $transactionRequestType->setAmount(151); + $transactionRequestType->setPayment($paymentType); + + $request = new AnetAPI\CreateTransactionRequest(); + $request->setMerchantAuthentication($merchantAuthentication); + $request->setRefId($refId); + $request->setTransactionRequest( $transactionRequestType); + + $controller = new AnetController\CreateTransactionController($request); + $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX); + + + if ($response != null) + { + if($response->getMessages()->getResultCode() == "Ok") + { + $tresponse = $response->getTransactionResponse(); + + if ($tresponse != null && $tresponse->getMessages() != null) + { + echo " Transaction Response code : " . $tresponse->getResponseCode() . "\n"; + echo " AUTH CODE : " . $tresponse->getAuthCode() . "\n"; + echo " TRANS ID : " . $tresponse->getTransId() . "\n"; + echo " Code : " . $tresponse->getMessages()[0]->getCode() . "\n"; + echo " Description : " . $tresponse->getMessages()[0]->getDescription() . "\n"; + } + else + { + echo "Transaction Failed \n"; + if($tresponse->getErrors() != null) + { + echo " Error code : " . $tresponse->getErrors()[0]->getErrorCode() . "\n"; + echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n"; + } + } + } + else + { + echo "Transaction Failed \n"; + $tresponse = $response->getTransactionResponse(); + if($tresponse != null && $tresponse->getErrors() != null) + { + echo " Error code : " . $tresponse->getErrors()[0]->getErrorCode() . "\n"; + echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n"; + } + else + { + echo " Error code : " . $response->getMessages()->getMessage()[0]->getCode() . "\n"; + echo " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n"; + } + } + } + else + { + echo "No response returned \n"; + } + + return $response; +} + +if(!defined('DONT_RUN_SAMPLES')) + createGooglePayTransaction(); +?> diff --git a/PaymentTransactions/update-split-tender-group.php b/PaymentTransactions/update-split-tender-group.php index c09310b..e386750 100644 --- a/PaymentTransactions/update-split-tender-group.php +++ b/PaymentTransactions/update-split-tender-group.php @@ -19,7 +19,7 @@ function updateSplitTenderGroup() $request = new AnetAPI\UpdateSplitTenderGroupRequest(); $request->setMerchantAuthentication($merchantAuthentication); - $request->setRefId($refId); + $request->setRefId($refId); $request->setSplitTenderId("115901"); $request->setSplitTenderStatus("voided"); From 1760330886e7945a9f21b1ecdf97123980ab8530 Mon Sep 17 00:00:00 2001 From: Gaidin Daishan Date: Thu, 22 Feb 2024 18:32:12 +0530 Subject: [PATCH 22/24] Updated dates used in requests --- RecurringBilling/create-subscription-from-customer-profile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecurringBilling/create-subscription-from-customer-profile.php b/RecurringBilling/create-subscription-from-customer-profile.php index ce69254..8681182 100644 --- a/RecurringBilling/create-subscription-from-customer-profile.php +++ b/RecurringBilling/create-subscription-from-customer-profile.php @@ -29,7 +29,7 @@ function createSubscriptionFromCustomerProfile($intervalLength, $customerProfile $paymentSchedule = new AnetAPI\PaymentScheduleType(); $paymentSchedule->setInterval($interval); - $paymentSchedule->setStartDate(new DateTime('2020-08-30')); + $paymentSchedule->setStartDate(new DateTime('2035-08-30')); $paymentSchedule->setTotalOccurrences("12"); $paymentSchedule->setTrialOccurrences("1"); From 97a99c42c1eda1d887b0bd54ec6d0945dbfa1a35 Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Thu, 22 Feb 2024 19:40:00 +0530 Subject: [PATCH 23/24] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 99bb4ff..e929b5c 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ You can also run each sample directly from the command line. ``` e.g. ``` - $ php PaymentTransactions/charge-credit-card.php + $ php PaymentTransactions/authorize-credit-card.php ``` ### Installation Notes From 1c3610e348e410cc36dd56a0a7418080ef037a16 Mon Sep 17 00:00:00 2001 From: gnongsie Date: Thu, 25 Jul 2024 12:24:05 +0530 Subject: [PATCH 24/24] Modifications to keep up to date --- .gitignore | 3 +++ RecurringBilling/get-list-of-subscriptions.php | 10 ++++++---- SampleCodeList.txt | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 1ed26d5..5e1ed6a 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,6 @@ # Operating system files .DS_Store +/lib +/*.cache +/testslog diff --git a/RecurringBilling/get-list-of-subscriptions.php b/RecurringBilling/get-list-of-subscriptions.php index 44049d7..72330e8 100644 --- a/RecurringBilling/get-list-of-subscriptions.php +++ b/RecurringBilling/get-list-of-subscriptions.php @@ -22,7 +22,7 @@ function getListOfSubscriptions() $sorting->setOrderDescending(false); $paging = new AnetAPI\PagingType(); - $paging->setLimit("1000"); + $paging->setLimit("10"); $paging->setOffset("1"); $request = new AnetAPI\ARBGetSubscriptionListRequest(); @@ -39,10 +39,12 @@ function getListOfSubscriptions() if (($response != null) && ($response->getMessages()->getResultCode() == "Ok")) { echo "SUCCESS: Subscription Details:" . "\n"; - foreach ($response->getSubscriptionDetails() as $subscriptionDetails) { - echo "Subscription ID: " . $subscriptionDetails->getId() . "\n"; - } echo "Total Number In Results:" . $response->getTotalNumInResultSet() . "\n"; + if ($response->getTotalNumInResultSet() > 0) { + foreach ($response->getSubscriptionDetails() as $subscriptionDetails) { + echo "Subscription ID: " . $subscriptionDetails->getId() . "\n"; + } + } } else { echo "ERROR : Invalid response\n"; $errorMessages = $response->getMessages()->getMessage(); diff --git a/SampleCodeList.txt b/SampleCodeList.txt index a41fd6f..5119f91 100644 --- a/SampleCodeList.txt +++ b/SampleCodeList.txt @@ -7,7 +7,7 @@ GetTransactionList,0,1 CreateAnApplePayTransaction,0,0 CreateAnAcceptTransaction,0,0 CreateAnAndroidPayTransaction,0,0 -decryptVisaSrcData,0,1 +decryptVisaSrcData,0,0 createVisaSrcTransaction,0,0 CaptureFundsAuthorizedThroughAnotherChannel,1,1 AuthorizeCreditCard,1,1