From d1bd10a7ff1596cbe4a22f034bf1317cf8451738 Mon Sep 17 00:00:00 2001 From: Ashutosh Singh Date: Thu, 7 Jun 2018 23:35:42 +0530 Subject: [PATCH 01/50] Create composer.json.sdk-dev Composer file to be used to test local sdk changes. --- composer.json.sdk-dev | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 composer.json.sdk-dev diff --git a/composer.json.sdk-dev b/composer.json.sdk-dev new file mode 100644 index 0000000..12fdd53 --- /dev/null +++ b/composer.json.sdk-dev @@ -0,0 +1,11 @@ +{ + "require": { + "php": ">=5.6", + "ext-curl": "*", + "phpunit/phpunit": "~4.8||~6.0", + "authorizenet/authorizenet": ">=1.9.6 || <2.0" + }, + "autoload": { + "classmap": ["constants", "lib"] + } +} From 15983be0c1cf5cb3cb24e4f8621791761bc6b5c7 Mon Sep 17 00:00:00 2001 From: Ashutosh Singh Date: Thu, 14 Jun 2018 16:17:46 +0530 Subject: [PATCH 02/50] Update to SDK 1.9.7 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 34b5710..1ffb837 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "php": ">=5.6", "ext-curl": "*", "phpunit/phpunit": "~4.8||~6.0", - "authorizenet/authorizenet": ">=1.9.6 || <2.0" + "authorizenet/authorizenet": ">=1.9.7 || <2.0" }, "autoload": { "classmap": ["constants"] From 0ac94b1b798f54bfcf260ecc62c3b2331fcaca9d Mon Sep 17 00:00:00 2001 From: ashtru Date: Mon, 2 Jul 2018 14:57:56 +0530 Subject: [PATCH 03/50] Change routing number --- PaymentTransactions/credit-bank-account.php | 2 +- PaymentTransactions/debit-bank-account.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PaymentTransactions/credit-bank-account.php b/PaymentTransactions/credit-bank-account.php index cb04582..a7c861c 100644 --- a/PaymentTransactions/credit-bank-account.php +++ b/PaymentTransactions/credit-bank-account.php @@ -21,7 +21,7 @@ function creditBankAccount($amount) $bankAccount->setAccountType('checking'); // see eCheck documentation for proper echeck type to use for each situation //$bankAccount->setEcheckType('WEB'); - $bankAccount->setRoutingNumber('125008547'); //('122235821'); //('125008547'); + $bankAccount->setRoutingNumber('122000661'); //('122235821'); //('125008547'); $bankAccount->setAccountNumber('1234567890'); $bankAccount->setNameOnAccount('John Doe'); $bankAccount->setBankName('Wells Fargo Bank NA'); diff --git a/PaymentTransactions/debit-bank-account.php b/PaymentTransactions/debit-bank-account.php index 46580df..2b91678 100644 --- a/PaymentTransactions/debit-bank-account.php +++ b/PaymentTransactions/debit-bank-account.php @@ -21,7 +21,7 @@ function debitBankAccount($amount) $bankAccount->setAccountType('checking'); // see eCheck documentation for proper echeck type to use for each situation $bankAccount->setEcheckType('WEB'); - $bankAccount->setRoutingNumber('125008547'); + $bankAccount->setRoutingNumber('122000661'); $bankAccount->setAccountNumber('1234567890'); $bankAccount->setNameOnAccount('John Doe'); $bankAccount->setBankName('Wells Fargo Bank NA'); From 678ae9c140b988a39f94330eb5c1e67588ab0fb3 Mon Sep 17 00:00:00 2001 From: Kaushik Kumar Mahato Date: Mon, 16 Jul 2018 17:09:37 +0530 Subject: [PATCH 04/50] Null check for transactions --- RecurringBilling/get-subscription.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/RecurringBilling/get-subscription.php b/RecurringBilling/get-subscription.php index 93e30c6..fa9be72 100644 --- a/RecurringBilling/get-subscription.php +++ b/RecurringBilling/get-subscription.php @@ -43,9 +43,11 @@ function getSubscription($subscriptionId) echo "Customer Profile ID: " . $response->getSubscription()->getProfile()->getCustomerProfileId() . "\n"; echo "Customer payment Profile ID: ". $response->getSubscription()->getProfile()->getPaymentProfile()->getCustomerPaymentProfileId() . "\n"; $transactions = $response->getSubscription()->getArbTransactions(); - foreach ($transactions as $transaction) { - echo "Transaction ID : ".$transaction->getTransId()." -- ".$transaction->getResponse()." -- Pay Number : ".$transaction->getPayNum()."\n"; - } + if($transactions != null){ + foreach ($transactions as $transaction) { + echo "Transaction ID : ".$transaction->getTransId()." -- ".$transaction->getResponse()." -- Pay Number : ".$transaction->getPayNum()."\n"; + } + } } else { From 11fa72392b6aafd7eeed2a4681d3ff81aa490395 Mon Sep 17 00:00:00 2001 From: Basu Date: Fri, 20 Jul 2018 14:00:51 +0530 Subject: [PATCH 05/50] Fix_for_Class-SampleCode-Constants-not-found_issue --- .../create-customer-payment-profile.php | 6 +++--- ...eate-customer-profile-from-transaction.php | 5 +++-- ...ate-customer-profile-with-accept-nonce.php | 6 +++--- CustomerProfiles/create-customer-profile.php | 6 +++--- .../create-customer-shipping-address.php | 5 +++-- .../delete-customer-payment-profile.php | 5 +++-- CustomerProfiles/delete-customer-profile.php | 7 ++++--- .../delete-customer-shipping-address.php | 5 +++-- .../get-accept-customer-profile-page.php | 5 +++-- .../get-customer-payment-profile-list.php | 6 +++--- .../get-customer-payment-profile.php | 6 +++--- CustomerProfiles/get-customer-profile-ids.php | 5 +++-- CustomerProfiles/get-customer-profile.php | 5 +++-- .../get-customer-shipping-address.php | 5 +++-- .../update-customer-payment-profile.php | 5 +++-- CustomerProfiles/update-customer-profile.php | 5 +++-- .../update-customer-shipping-address.php | 5 +++-- .../validate-customer-payment-profile.php | 5 +++-- .../approve-or-decline-held-transaction.php | 7 ++++--- FraudManagement/get-held-transaction-list.php | 5 +++-- .../create-an-accept-transaction.php | 10 ++++----- .../create-an-android-pay-transaction.php | 8 +++---- .../create-an-apple-pay-transaction.php | 8 +++---- .../authorization-and-capture-continued.php | 7 ++++--- .../authorization-and-capture.php | 9 ++++---- .../authorization-only-continued.php | 8 +++---- PayPalExpressCheckout/authorization-only.php | 8 +++---- PayPalExpressCheckout/credit.php | 8 +++---- PayPalExpressCheckout/get-details.php | 8 +++---- .../prior-authorization-capture.php | 7 ++++--- PayPalExpressCheckout/void.php | 7 ++++--- PaymentTransactions/authorize-credit-card.php | 10 ++++----- ...nds-authorized-through-another-channel.php | 7 ++++--- .../capture-previously-authorized-amount.php | 7 ++++--- PaymentTransactions/charge-credit-card.php | 10 ++++----- .../charge-customer-profile.php | 7 ++++--- .../charge-tokenized-credit-card.php | 7 ++++--- .../create-an-accept-payment-transaction.php | 10 ++++----- PaymentTransactions/credit-bank-account.php | 7 ++++--- PaymentTransactions/debit-bank-account.php | 7 ++++--- .../get-an-accept-payment-page.php | 5 +++-- PaymentTransactions/refund-transaction.php | 9 ++++---- .../update-split-tender-group.php | 5 +++-- PaymentTransactions/void-transaction.php | 7 ++++--- RecurringBilling/cancel-subscription.php | 5 +++-- ...ate-subscription-from-customer-profile.php | 5 +++-- RecurringBilling/create-subscription.php | 5 +++-- .../get-list-of-subscriptions.php | 5 +++-- RecurringBilling/get-subscription-status.php | 5 +++-- RecurringBilling/get-subscription.php | 5 +++-- RecurringBilling/update-subscription.php | 5 +++-- .../get-account-updater-job-details.php | 5 +++-- .../get-account-updater-job-summary.php | 5 +++-- TransactionReporting/get-batch-statistics.php | 5 +++-- .../get-customer-profile-transaction-list.php | 5 +++-- TransactionReporting/get-merchant-details.php | 5 +++-- .../get-settled-batch-list.php | 5 +++-- .../get-transaction-details.php | 5 +++-- TransactionReporting/get-transaction-list.php | 5 +++-- .../get-unsettled-transaction-list.php | 5 +++-- .../create-visa-checkout-transaction.php | 8 +++---- VisaCheckout/decrypt-visa-checkout-data.php | 6 +++--- constants/Constants.php | 21 ------------------- constants/SampleCodeConstants.php | 9 ++++++++ test-runner.php | 2 +- 65 files changed, 227 insertions(+), 194 deletions(-) delete mode 100644 constants/Constants.php create mode 100644 constants/SampleCodeConstants.php diff --git a/CustomerProfiles/create-customer-payment-profile.php b/CustomerProfiles/create-customer-payment-profile.php index 451a641..1acb10c 100644 --- a/CustomerProfiles/create-customer-payment-profile.php +++ b/CustomerProfiles/create-customer-payment-profile.php @@ -1,6 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/CustomerProfiles/create-customer-profile-from-transaction.php b/CustomerProfiles/create-customer-profile-from-transaction.php index 6b4ae51..fa9c002 100644 --- a/CustomerProfiles/create-customer-profile-from-transaction.php +++ b/CustomerProfiles/create-customer-profile-from-transaction.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/CustomerProfiles/create-customer-profile-with-accept-nonce.php b/CustomerProfiles/create-customer-profile-with-accept-nonce.php index 9a72398..d9d0375 100644 --- a/CustomerProfiles/create-customer-profile-with-accept-nonce.php +++ b/CustomerProfiles/create-customer-profile-with-accept-nonce.php @@ -1,6 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/CustomerProfiles/create-customer-profile.php b/CustomerProfiles/create-customer-profile.php index c58c197..91390da 100644 --- a/CustomerProfiles/create-customer-profile.php +++ b/CustomerProfiles/create-customer-profile.php @@ -1,6 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/CustomerProfiles/create-customer-shipping-address.php b/CustomerProfiles/create-customer-shipping-address.php index d1f9579..22ce6fb 100644 --- a/CustomerProfiles/create-customer-shipping-address.php +++ b/CustomerProfiles/create-customer-shipping-address.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/CustomerProfiles/delete-customer-payment-profile.php b/CustomerProfiles/delete-customer-payment-profile.php index a763e38..2ddf876 100644 --- a/CustomerProfiles/delete-customer-payment-profile.php +++ b/CustomerProfiles/delete-customer-payment-profile.php @@ -1,5 +1,6 @@ ]setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/CustomerProfiles/delete-customer-profile.php b/CustomerProfiles/delete-customer-profile.php index bf6c6e6..9044d0c 100644 --- a/CustomerProfiles/delete-customer-profile.php +++ b/CustomerProfiles/delete-customer-profile.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/CustomerProfiles/delete-customer-shipping-address.php b/CustomerProfiles/delete-customer-shipping-address.php index 48a03c4..9d3cb2f 100644 --- a/CustomerProfiles/delete-customer-shipping-address.php +++ b/CustomerProfiles/delete-customer-shipping-address.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/CustomerProfiles/get-accept-customer-profile-page.php b/CustomerProfiles/get-accept-customer-profile-page.php index 35e7293..e784f06 100644 --- a/CustomerProfiles/get-accept-customer-profile-page.php +++ b/CustomerProfiles/get-accept-customer-profile-page.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/CustomerProfiles/get-customer-payment-profile-list.php b/CustomerProfiles/get-customer-payment-profile-list.php index 71aa92b..51da3b3 100644 --- a/CustomerProfiles/get-customer-payment-profile-list.php +++ b/CustomerProfiles/get-customer-payment-profile-list.php @@ -1,7 +1,7 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/CustomerProfiles/get-customer-payment-profile.php b/CustomerProfiles/get-customer-payment-profile.php index 1def906..c059bc5 100644 --- a/CustomerProfiles/get-customer-payment-profile.php +++ b/CustomerProfiles/get-customer-payment-profile.php @@ -1,7 +1,7 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/CustomerProfiles/get-customer-profile-ids.php b/CustomerProfiles/get-customer-profile-ids.php index 6480821..20b68a0 100644 --- a/CustomerProfiles/get-customer-profile-ids.php +++ b/CustomerProfiles/get-customer-profile-ids.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/CustomerProfiles/get-customer-profile.php b/CustomerProfiles/get-customer-profile.php index 2ecab4d..c69efc6 100644 --- a/CustomerProfiles/get-customer-profile.php +++ b/CustomerProfiles/get-customer-profile.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/CustomerProfiles/get-customer-shipping-address.php b/CustomerProfiles/get-customer-shipping-address.php index 2ec8601..1e1b541 100644 --- a/CustomerProfiles/get-customer-shipping-address.php +++ b/CustomerProfiles/get-customer-shipping-address.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/CustomerProfiles/update-customer-payment-profile.php b/CustomerProfiles/update-customer-payment-profile.php index ab2c2ec..38b504c 100644 --- a/CustomerProfiles/update-customer-payment-profile.php +++ b/CustomerProfiles/update-customer-payment-profile.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/CustomerProfiles/update-customer-profile.php b/CustomerProfiles/update-customer-profile.php index 9c0e814..4a2c708 100644 --- a/CustomerProfiles/update-customer-profile.php +++ b/CustomerProfiles/update-customer-profile.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/CustomerProfiles/update-customer-shipping-address.php b/CustomerProfiles/update-customer-shipping-address.php index 67b18e5..3c7cb7f 100644 --- a/CustomerProfiles/update-customer-shipping-address.php +++ b/CustomerProfiles/update-customer-shipping-address.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/CustomerProfiles/validate-customer-payment-profile.php b/CustomerProfiles/validate-customer-payment-profile.php index 63215fc..b262186 100644 --- a/CustomerProfiles/validate-customer-payment-profile.php +++ b/CustomerProfiles/validate-customer-payment-profile.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/FraudManagement/approve-or-decline-held-transaction.php b/FraudManagement/approve-or-decline-held-transaction.php index abe8ec9..c3e6df5 100644 --- a/FraudManagement/approve-or-decline-held-transaction.php +++ b/FraudManagement/approve-or-decline-held-transaction.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); @@ -31,7 +32,7 @@ function approveOrDeclineHeldTransaction() if ($response != null) { - if($response->getMessages()->getResultCode() == 'Ok') + if($response->getMessages()->getResultCode() == "Ok") { $tresponse = $response->getTransactionResponse(); diff --git a/FraudManagement/get-held-transaction-list.php b/FraudManagement/get-held-transaction-list.php index 872056b..9405614 100644 --- a/FraudManagement/get-held-transaction-list.php +++ b/FraudManagement/get-held-transaction-list.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/MobileInAppTransactions/create-an-accept-transaction.php b/MobileInAppTransactions/create-an-accept-transaction.php index 926614b..ea7650e 100644 --- a/MobileInAppTransactions/create-an-accept-transaction.php +++ b/MobileInAppTransactions/create-an-accept-transaction.php @@ -1,6 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); @@ -76,7 +76,7 @@ function createAnAcceptTransaction($amount) if ($response != null) { // Check to see if the API request was successfully received and acted upon - if ($response->getMessages()->getResultCode() == \SampleCode\Constants::RESPONSE_OK) { + if ($response->getMessages()->getResultCode() == "Ok") { // Since the API request was successful, look for a transaction response // and parse it to display the results of authorizing the card $tresponse = $response->getTransactionResponse(); @@ -115,6 +115,6 @@ function createAnAcceptTransaction($amount) } if (!defined('DONT_RUN_SAMPLES')) { - CreateAnAcceptTransaction(\SampleCode\Constants::SAMPLE_AMOUNT); + CreateAnAcceptTransaction("2.23"); } ?> diff --git a/MobileInAppTransactions/create-an-android-pay-transaction.php b/MobileInAppTransactions/create-an-android-pay-transaction.php index 52a2fe6..175a0a4 100644 --- a/MobileInAppTransactions/create-an-android-pay-transaction.php +++ b/MobileInAppTransactions/create-an-android-pay-transaction.php @@ -1,6 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); @@ -39,7 +39,7 @@ function createAnAndroidPayTransaction() if ($response != null) { - if($response->getMessages()->getResultCode() == \SampleCode\Constants::RESPONSE_OK) + if($response->getMessages()->getResultCode() == "Ok") { $tresponse = $response->getTransactionResponse(); diff --git a/MobileInAppTransactions/create-an-apple-pay-transaction.php b/MobileInAppTransactions/create-an-apple-pay-transaction.php index 1325942..4a8006a 100644 --- a/MobileInAppTransactions/create-an-apple-pay-transaction.php +++ b/MobileInAppTransactions/create-an-apple-pay-transaction.php @@ -1,6 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); @@ -40,7 +40,7 @@ function createAnApplePayTransaction() if ($response != null) { - if($response->getMessages()->getResultCode() == \SampleCode\Constants::RESPONSE_OK) + if($response->getMessages()->getResultCode() == "Ok") { $tresponse = $response->getTransactionResponse(); diff --git a/PayPalExpressCheckout/authorization-and-capture-continued.php b/PayPalExpressCheckout/authorization-and-capture-continued.php index 9318235..6ef77cd 100644 --- a/PayPalExpressCheckout/authorization-and-capture-continued.php +++ b/PayPalExpressCheckout/authorization-and-capture-continued.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); @@ -36,7 +37,7 @@ function payPalAuthorizeCaptureContinued($refTransId, $payerID) $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX); if ($response != null) { - if ($response->getMessages()->getResultCode() == \SampleCode\Constants::RESPONSE_OK) { + if ($response->getMessages()->getResultCode() == "Ok") { $tresponse = $response->getTransactionResponse(); if ($tresponse != null && $tresponse->getMessages() != null) { diff --git a/PayPalExpressCheckout/authorization-and-capture.php b/PayPalExpressCheckout/authorization-and-capture.php index f064942..5252c27 100644 --- a/PayPalExpressCheckout/authorization-and-capture.php +++ b/PayPalExpressCheckout/authorization-and-capture.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); @@ -37,7 +38,7 @@ function payPalAuthorizeCapture($amount) if ($response != null) { - if($response->getMessages()->getResultCode() == \SampleCode\Constants::RESPONSE_OK) + if($response->getMessages()->getResultCode() == "Ok") { $tresponse = $response->getTransactionResponse(); diff --git a/PayPalExpressCheckout/authorization-only-continued.php b/PayPalExpressCheckout/authorization-only-continued.php index d276772..20422d7 100644 --- a/PayPalExpressCheckout/authorization-only-continued.php +++ b/PayPalExpressCheckout/authorization-only-continued.php @@ -1,6 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); @@ -47,7 +47,7 @@ function payPalAuthorizeOnlyContinued($transactionId, $payerId) $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX); if ($response != null) { - if ($response->getMessages()->getResultCode() == \SampleCode\Constants::RESPONSE_OK) { + if ($response->getMessages()->getResultCode() == "Ok") { $tresponse = $response->getTransactionResponse(); if ($tresponse != null && $tresponse->getMessages() != null) { diff --git a/PayPalExpressCheckout/authorization-only.php b/PayPalExpressCheckout/authorization-only.php index 7436cd1..32fd18e 100644 --- a/PayPalExpressCheckout/authorization-only.php +++ b/PayPalExpressCheckout/authorization-only.php @@ -1,6 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); @@ -40,7 +40,7 @@ function payPalAuthorizeOnly($amount) if ($response != null) { - if($response->getMessages()->getResultCode() == \SampleCode\Constants::RESPONSE_OK) + if($response->getMessages()->getResultCode() == "Ok") { $tresponse = $response->getTransactionResponse(); diff --git a/PayPalExpressCheckout/credit.php b/PayPalExpressCheckout/credit.php index 1277807..498eba8 100644 --- a/PayPalExpressCheckout/credit.php +++ b/PayPalExpressCheckout/credit.php @@ -1,6 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); @@ -45,7 +45,7 @@ function payPalCredit($transactionId) if ($response != null) { - if($response->getMessages()->getResultCode() == \SampleCode\Constants::RESPONSE_OK) + if($response->getMessages()->getResultCode() == "Ok") { $tresponse = $response->getTransactionResponse(); diff --git a/PayPalExpressCheckout/get-details.php b/PayPalExpressCheckout/get-details.php index 98fefab..4a81b70 100644 --- a/PayPalExpressCheckout/get-details.php +++ b/PayPalExpressCheckout/get-details.php @@ -1,6 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); @@ -49,7 +49,7 @@ function payPalGetDetails($transactionId) if ($response != null) { - if($response->getMessages()->getResultCode() == \SampleCode\Constants::RESPONSE_OK) + if($response->getMessages()->getResultCode() == "Ok") { $tresponse = $response->getTransactionResponse(); diff --git a/PayPalExpressCheckout/prior-authorization-capture.php b/PayPalExpressCheckout/prior-authorization-capture.php index be4dc43..432d0fe 100644 --- a/PayPalExpressCheckout/prior-authorization-capture.php +++ b/PayPalExpressCheckout/prior-authorization-capture.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); @@ -40,7 +41,7 @@ function payPalPriorAuthorizationCapture($transactionId) if ($response != null) { - if($response->getMessages()->getResultCode() == \SampleCode\Constants::RESPONSE_OK) + if($response->getMessages()->getResultCode() == "Ok") { $tresponse = $response->getTransactionResponse(); diff --git a/PayPalExpressCheckout/void.php b/PayPalExpressCheckout/void.php index c6d7e3f..bb6e242 100644 --- a/PayPalExpressCheckout/void.php +++ b/PayPalExpressCheckout/void.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); @@ -39,7 +40,7 @@ function payPalVoid($transactionId) if ($response != null) { - if($response->getMessages()->getResultCode() == \SampleCode\Constants::RESPONSE_OK) + if($response->getMessages()->getResultCode() == "Ok") { $tresponse = $response->getTransactionResponse(); diff --git a/PaymentTransactions/authorize-credit-card.php b/PaymentTransactions/authorize-credit-card.php index d7cc566..10c8198 100644 --- a/PaymentTransactions/authorize-credit-card.php +++ b/PaymentTransactions/authorize-credit-card.php @@ -1,6 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); @@ -89,7 +89,7 @@ function authorizeCreditCard($amount) if ($response != null) { // Check to see if the API request was successfully received and acted upon - if ($response->getMessages()->getResultCode() == \SampleCode\Constants::RESPONSE_OK) { + if ($response->getMessages()->getResultCode() == "Ok") { // Since the API request was successful, look for a transaction response // and parse it to display the results of authorizing the card $tresponse = $response->getTransactionResponse(); @@ -128,6 +128,6 @@ function authorizeCreditCard($amount) } if (!defined('DONT_RUN_SAMPLES')) { - authorizeCreditCard(\SampleCode\Constants::SAMPLE_AMOUNT); + authorizeCreditCard("2.23"); } ?> \ No newline at end of file diff --git a/PaymentTransactions/capture-funds-authorized-through-another-channel.php b/PaymentTransactions/capture-funds-authorized-through-another-channel.php index 607cc3e..8879a05 100644 --- a/PaymentTransactions/capture-funds-authorized-through-another-channel.php +++ b/PaymentTransactions/capture-funds-authorized-through-another-channel.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); @@ -40,7 +41,7 @@ function captureFundsAuthorizedThroughAnotherChannel($amount) if ($response != null) { - if($response->getMessages()->getResultCode() == \SampleCode\Constants::RESPONSE_OK) + if($response->getMessages()->getResultCode() == "Ok") { $tresponse = $response->getTransactionResponse(); diff --git a/PaymentTransactions/capture-previously-authorized-amount.php b/PaymentTransactions/capture-previously-authorized-amount.php index bb311dd..de19ffd 100644 --- a/PaymentTransactions/capture-previously-authorized-amount.php +++ b/PaymentTransactions/capture-previously-authorized-amount.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); @@ -32,7 +33,7 @@ function capturePreviouslyAuthorizedAmount($transactionid) if ($response != null) { - if($response->getMessages()->getResultCode() == \SampleCode\Constants::RESPONSE_OK) + if($response->getMessages()->getResultCode() == "Ok") { $tresponse = $response->getTransactionResponse(); diff --git a/PaymentTransactions/charge-credit-card.php b/PaymentTransactions/charge-credit-card.php index c401d81..c05df53 100644 --- a/PaymentTransactions/charge-credit-card.php +++ b/PaymentTransactions/charge-credit-card.php @@ -1,6 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); @@ -89,7 +89,7 @@ function chargeCreditCard($amount) if ($response != null) { // Check to see if the API request was successfully received and acted upon - if ($response->getMessages()->getResultCode() == \SampleCode\Constants::RESPONSE_OK) { + if ($response->getMessages()->getResultCode() == "Ok") { // Since the API request was successful, look for a transaction response // and parse it to display the results of authorizing the card $tresponse = $response->getTransactionResponse(); @@ -128,5 +128,5 @@ function chargeCreditCard($amount) } if (!defined('DONT_RUN_SAMPLES')) { - chargeCreditCard(\SampleCode\Constants::SAMPLE_AMOUNT); + chargeCreditCard("2.23"); } diff --git a/PaymentTransactions/charge-customer-profile.php b/PaymentTransactions/charge-customer-profile.php index 12a91ef..7482001 100644 --- a/PaymentTransactions/charge-customer-profile.php +++ b/PaymentTransactions/charge-customer-profile.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); @@ -36,7 +37,7 @@ function chargeCustomerProfile($profileid, $paymentprofileid, $amount) if ($response != null) { - if($response->getMessages()->getResultCode() == \SampleCode\Constants::RESPONSE_OK) + if($response->getMessages()->getResultCode() == "Ok") { $tresponse = $response->getTransactionResponse(); diff --git a/PaymentTransactions/charge-tokenized-credit-card.php b/PaymentTransactions/charge-tokenized-credit-card.php index fd6dafd..7b11b1d 100644 --- a/PaymentTransactions/charge-tokenized-credit-card.php +++ b/PaymentTransactions/charge-tokenized-credit-card.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); @@ -43,7 +44,7 @@ function chargeTokenizedCreditCard($amount) if ($response != null) { - if($response->getMessages()->getResultCode() == \SampleCode\Constants::RESPONSE_OK) + if($response->getMessages()->getResultCode() == "Ok") { $tresponse = $response->getTransactionResponse(); diff --git a/PaymentTransactions/create-an-accept-payment-transaction.php b/PaymentTransactions/create-an-accept-payment-transaction.php index caa2fb2..c38cc1c 100644 --- a/PaymentTransactions/create-an-accept-payment-transaction.php +++ b/PaymentTransactions/create-an-accept-payment-transaction.php @@ -1,6 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); @@ -89,7 +89,7 @@ function createAnAcceptPaymentTransaction($amount) if ($response != null) { // Check to see if the API request was successfully received and acted upon - if ($response->getMessages()->getResultCode() == \SampleCode\Constants::RESPONSE_OK) { + if ($response->getMessages()->getResultCode() == "Ok") { // Since the API request was successful, look for a transaction response // and parse it to display the results of authorizing the card $tresponse = $response->getTransactionResponse(); @@ -128,6 +128,6 @@ function createAnAcceptPaymentTransaction($amount) } if (!defined('DONT_RUN_SAMPLES')) { - CreateAnAcceptTransaction(\SampleCode\Constants::SAMPLE_AMOUNT); + CreateAnAcceptTransaction("2.23"); } ?> \ No newline at end of file diff --git a/PaymentTransactions/credit-bank-account.php b/PaymentTransactions/credit-bank-account.php index a7c861c..bab21f6 100644 --- a/PaymentTransactions/credit-bank-account.php +++ b/PaymentTransactions/credit-bank-account.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); @@ -49,7 +50,7 @@ function creditBankAccount($amount) $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX); if ($response != null) { - if ($response->getMessages()->getResultCode() == \SampleCode\Constants::RESPONSE_OK) { + if ($response->getMessages()->getResultCode() == "Ok") { $tresponse = $response->getTransactionResponse(); if ($tresponse != null && $tresponse->getMessages() != null) { diff --git a/PaymentTransactions/debit-bank-account.php b/PaymentTransactions/debit-bank-account.php index 2b91678..c3da2b2 100644 --- a/PaymentTransactions/debit-bank-account.php +++ b/PaymentTransactions/debit-bank-account.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); @@ -49,7 +50,7 @@ function debitBankAccount($amount) $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX); if ($response != null) { - if ($response->getMessages()->getResultCode() == \SampleCode\Constants::RESPONSE_OK) { + if ($response->getMessages()->getResultCode() == "Ok") { $tresponse = $response->getTransactionResponse(); if ($tresponse != null && $tresponse->getMessages() != null) { diff --git a/PaymentTransactions/get-an-accept-payment-page.php b/PaymentTransactions/get-an-accept-payment-page.php index 6d600be..30fe57e 100644 --- a/PaymentTransactions/get-an-accept-payment-page.php +++ b/PaymentTransactions/get-an-accept-payment-page.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/PaymentTransactions/refund-transaction.php b/PaymentTransactions/refund-transaction.php index 5ea21d0..7171066 100644 --- a/PaymentTransactions/refund-transaction.php +++ b/PaymentTransactions/refund-transaction.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); @@ -39,7 +40,7 @@ function refundTransaction($refTransId, $amount) if ($response != null) { - if($response->getMessages()->getResultCode() == \SampleCode\Constants::RESPONSE_OK) + if($response->getMessages()->getResultCode() == "Ok") { $tresponse = $response->getTransactionResponse(); @@ -84,5 +85,5 @@ function refundTransaction($refTransId, $amount) return $response; } if(!defined('DONT_RUN_SAMPLES')) - refundTransaction( \SampleCode\Constants::SAMPLE_AMOUNT_REFUND); + refundTransaction( "2.23"); ?> diff --git a/PaymentTransactions/update-split-tender-group.php b/PaymentTransactions/update-split-tender-group.php index 1e1b1fd..c09310b 100644 --- a/PaymentTransactions/update-split-tender-group.php +++ b/PaymentTransactions/update-split-tender-group.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/PaymentTransactions/void-transaction.php b/PaymentTransactions/void-transaction.php index 29ea2e4..c2a4d3b 100644 --- a/PaymentTransactions/void-transaction.php +++ b/PaymentTransactions/void-transaction.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); @@ -30,7 +31,7 @@ function voidTransaction($transactionid) if ($response != null) { - if($response->getMessages()->getResultCode() == \SampleCode\Constants::RESPONSE_OK) + if($response->getMessages()->getResultCode() == "Ok") { $tresponse = $response->getTransactionResponse(); diff --git a/RecurringBilling/cancel-subscription.php b/RecurringBilling/cancel-subscription.php index 378345b..e4cbe9e 100644 --- a/RecurringBilling/cancel-subscription.php +++ b/RecurringBilling/cancel-subscription.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/RecurringBilling/create-subscription-from-customer-profile.php b/RecurringBilling/create-subscription-from-customer-profile.php index 9a53131..ce69254 100644 --- a/RecurringBilling/create-subscription-from-customer-profile.php +++ b/RecurringBilling/create-subscription-from-customer-profile.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/RecurringBilling/create-subscription.php b/RecurringBilling/create-subscription.php index fa6b675..66f539a 100644 --- a/RecurringBilling/create-subscription.php +++ b/RecurringBilling/create-subscription.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/RecurringBilling/get-list-of-subscriptions.php b/RecurringBilling/get-list-of-subscriptions.php index 444c9f5..44049d7 100644 --- a/RecurringBilling/get-list-of-subscriptions.php +++ b/RecurringBilling/get-list-of-subscriptions.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/RecurringBilling/get-subscription-status.php b/RecurringBilling/get-subscription-status.php index fd5af2f..52796b0 100644 --- a/RecurringBilling/get-subscription-status.php +++ b/RecurringBilling/get-subscription-status.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/RecurringBilling/get-subscription.php b/RecurringBilling/get-subscription.php index fa9be72..23b0409 100644 --- a/RecurringBilling/get-subscription.php +++ b/RecurringBilling/get-subscription.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/RecurringBilling/update-subscription.php b/RecurringBilling/update-subscription.php index e8e05d9..6729445 100644 --- a/RecurringBilling/update-subscription.php +++ b/RecurringBilling/update-subscription.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/TransactionReporting/get-account-updater-job-details.php b/TransactionReporting/get-account-updater-job-details.php index 12f9d81..0d26eb5 100644 --- a/TransactionReporting/get-account-updater-job-details.php +++ b/TransactionReporting/get-account-updater-job-details.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the request's refId $refId = 'ref' . time(); diff --git a/TransactionReporting/get-account-updater-job-summary.php b/TransactionReporting/get-account-updater-job-summary.php index cca6160..444e894 100644 --- a/TransactionReporting/get-account-updater-job-summary.php +++ b/TransactionReporting/get-account-updater-job-summary.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the request's refId $refId = 'ref' . time(); diff --git a/TransactionReporting/get-batch-statistics.php b/TransactionReporting/get-batch-statistics.php index 4038762..9a161c6 100644 --- a/TransactionReporting/get-batch-statistics.php +++ b/TransactionReporting/get-batch-statistics.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/TransactionReporting/get-customer-profile-transaction-list.php b/TransactionReporting/get-customer-profile-transaction-list.php index 1f209a6..69eb20c 100644 --- a/TransactionReporting/get-customer-profile-transaction-list.php +++ b/TransactionReporting/get-customer-profile-transaction-list.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/TransactionReporting/get-merchant-details.php b/TransactionReporting/get-merchant-details.php index 542ae6c..1b20655 100644 --- a/TransactionReporting/get-merchant-details.php +++ b/TransactionReporting/get-merchant-details.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/TransactionReporting/get-settled-batch-list.php b/TransactionReporting/get-settled-batch-list.php index 3fe7902..89292af 100644 --- a/TransactionReporting/get-settled-batch-list.php +++ b/TransactionReporting/get-settled-batch-list.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/TransactionReporting/get-transaction-details.php b/TransactionReporting/get-transaction-details.php index 25cdcb1..d54def5 100644 --- a/TransactionReporting/get-transaction-details.php +++ b/TransactionReporting/get-transaction-details.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/TransactionReporting/get-transaction-list.php b/TransactionReporting/get-transaction-list.php index 3ca299d..bfad6f0 100644 --- a/TransactionReporting/get-transaction-list.php +++ b/TransactionReporting/get-transaction-list.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the request's refId $refId = 'ref' . time(); diff --git a/TransactionReporting/get-unsettled-transaction-list.php b/TransactionReporting/get-unsettled-transaction-list.php index e472349..45e9db8 100644 --- a/TransactionReporting/get-unsettled-transaction-list.php +++ b/TransactionReporting/get-unsettled-transaction-list.php @@ -1,5 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/VisaCheckout/create-visa-checkout-transaction.php b/VisaCheckout/create-visa-checkout-transaction.php index e39795f..8ec941c 100644 --- a/VisaCheckout/create-visa-checkout-transaction.php +++ b/VisaCheckout/create-visa-checkout-transaction.php @@ -1,6 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); @@ -42,7 +42,7 @@ function createVisaCheckoutTransaction() if ($response != null) { - if($response->getMessages()->getResultCode() == \SampleCode\Constants::RESPONSE_OK) + if($response->getMessages()->getResultCode() == "Ok") { $tresponse = $response->getTransactionResponse(); if ($tresponse != null && $tresponse->getMessages() != null) diff --git a/VisaCheckout/decrypt-visa-checkout-data.php b/VisaCheckout/decrypt-visa-checkout-data.php index 21f8e94..48c8de4 100644 --- a/VisaCheckout/decrypt-visa-checkout-data.php +++ b/VisaCheckout/decrypt-visa-checkout-data.php @@ -1,6 +1,6 @@ setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); - $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); + $merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId $refId = 'ref' . time(); diff --git a/constants/Constants.php b/constants/Constants.php deleted file mode 100644 index d1ce2da..0000000 --- a/constants/Constants.php +++ /dev/null @@ -1,21 +0,0 @@ - - diff --git a/constants/SampleCodeConstants.php b/constants/SampleCodeConstants.php new file mode 100644 index 0000000..0cd03fd --- /dev/null +++ b/constants/SampleCodeConstants.php @@ -0,0 +1,9 @@ + + diff --git a/test-runner.php b/test-runner.php index e381c5b..ab4363a 100644 --- a/test-runner.php +++ b/test-runner.php @@ -2,7 +2,7 @@ define("DONT_RUN_SAMPLES", "true"); define("SAMPLE_CODE_NAME_HEADING", "SampleCodeName"); require 'vendor/autoload.php'; -require_once 'constants/Constants.php'; +require_once 'constants/SampleCodeConstants.php'; if ($_SERVER['argc'] != 3) { die('\n Usage: phpunit test-runner.php '); From 1e60d38f56ebe065f2f378ba35acf36e1169fb08 Mon Sep 17 00:00:00 2001 From: Basu Date: Fri, 20 Jul 2018 15:11:13 +0530 Subject: [PATCH 06/50] Removed_constants_folder_from_composer.json --- composer.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 1ffb837..0008661 100644 --- a/composer.json +++ b/composer.json @@ -3,9 +3,6 @@ "php": ">=5.6", "ext-curl": "*", "phpunit/phpunit": "~4.8||~6.0", - "authorizenet/authorizenet": ">=1.9.7 || <2.0" - }, - "autoload": { - "classmap": ["constants"] + "authorizenet/authorizenet": ">=1.9.7 || <2.0" } } From 0fddad0207d6fd5ef4334ec9bb1ad068aa192d5d Mon Sep 17 00:00:00 2001 From: Kaushik Date: Fri, 20 Jul 2018 17:55:36 +0530 Subject: [PATCH 07/50] Enhance Testrunner --- test-runner.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test-runner.php b/test-runner.php index e381c5b..6c43654 100644 --- a/test-runner.php +++ b/test-runner.php @@ -42,7 +42,7 @@ class TestRunner extends PHPUnit\Framework\TestCase //random amount for transactions/subscriptions public static function getAmount() { - return 12 + (rand(1, 900000)/12); + return 12 + (rand(1, 9000)/10); } //random email for a new customer profile public static function getEmail() @@ -70,12 +70,14 @@ public function testAllSampleCodes() list($apiName, $isDependent, $shouldRun)=explode(",", $line); $apiName = trim($apiName); echo "\nApi name: " . $apiName."\n"; + fwrite(STDOUT, print_r("\nStarting Test: " . $apiName."\n", TRUE)); } if ($apiName && (false === strpos($apiName, SAMPLE_CODE_NAME_HEADING))) { echo "should run:".$shouldRun."\n"; if ("0" === $shouldRun) { - echo ":Skipping " . $sampleMethodName . "\n"; + echo ":Skipping " . $apiName . "\n"; } else { + //Try the request twice for ($i=0; $i<=1; $i++) { if ("0" === $isDependent) { echo "not dependent\n"; @@ -89,7 +91,9 @@ public function testAllSampleCodes() //request the api echo "Running sample: " . $sampleMethodName . "\n"; + fwrite(STDOUT, print_r($apiName . "Start Time: " . date("H:i:s."). gettimeofday()['usec'] . "\n", TRUE)); $response = call_user_func($sampleMethodName); + fwrite(STDOUT, print_r($apiName . "Finish Time: " . date("H:i:s."). gettimeofday()['usec'] . "\n", TRUE)); if (($response != null) && ($response->getMessages()->getResultCode() == "Ok")) { break; @@ -99,6 +103,7 @@ public function testAllSampleCodes() //response must be successful $this->assertNotNull($response); $this->assertEquals($response->getMessages()->getResultCode(), "Ok"); + echo $sampleMethodName . " - OK \n"; $runTests++; } } From c15c27b798ba6107b1fbd8b6ead4b099dd5268c6 Mon Sep 17 00:00:00 2001 From: Kaushik Date: Thu, 2 Aug 2018 17:29:09 +0530 Subject: [PATCH 08/50] Randomize Bank account numbers --- PaymentTransactions/credit-bank-account.php | 5 ++++- PaymentTransactions/debit-bank-account.php | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/PaymentTransactions/credit-bank-account.php b/PaymentTransactions/credit-bank-account.php index bab21f6..b68f771 100644 --- a/PaymentTransactions/credit-bank-account.php +++ b/PaymentTransactions/credit-bank-account.php @@ -17,13 +17,16 @@ function creditBankAccount($amount) // Set the transaction's refId $refId = 'ref' . time(); + //Generate random bank account number + $randomAccountNumber= rand(100000000,9999999999); + // Create the payment data for a Bank Account $bankAccount = new AnetAPI\BankAccountType(); $bankAccount->setAccountType('checking'); // see eCheck documentation for proper echeck type to use for each situation //$bankAccount->setEcheckType('WEB'); $bankAccount->setRoutingNumber('122000661'); //('122235821'); //('125008547'); - $bankAccount->setAccountNumber('1234567890'); + $bankAccount->setAccountNumber($randomAccountNumber); $bankAccount->setNameOnAccount('John Doe'); $bankAccount->setBankName('Wells Fargo Bank NA'); diff --git a/PaymentTransactions/debit-bank-account.php b/PaymentTransactions/debit-bank-account.php index c3da2b2..26d6b93 100644 --- a/PaymentTransactions/debit-bank-account.php +++ b/PaymentTransactions/debit-bank-account.php @@ -17,13 +17,16 @@ function debitBankAccount($amount) // Set the transaction's refId $refId = 'ref' . time(); + //Generate random bank account number + $randomAccountNumber= rand(100000000,9999999999); + // Create the payment data for a Bank Account $bankAccount = new AnetAPI\BankAccountType(); $bankAccount->setAccountType('checking'); // see eCheck documentation for proper echeck type to use for each situation $bankAccount->setEcheckType('WEB'); $bankAccount->setRoutingNumber('122000661'); - $bankAccount->setAccountNumber('1234567890'); + $bankAccount->setAccountNumber($randomAccountNumber); $bankAccount->setNameOnAccount('John Doe'); $bankAccount->setBankName('Wells Fargo Bank NA'); From 79aa06acfb6f5760f68c05d1990d59f30c78a634 Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Fri, 10 Aug 2018 16:54:15 +0530 Subject: [PATCH 09/50] + Adding files to Accept Suite --- .../create-an-accept-payment-transaction.php | 0 .../create-an-accept-transaction.php | 0 .../get-accept-customer-profile-page.php | 0 .../get-an-accept-payment-page.php | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename {PaymentTransactions => AcceptSuite}/create-an-accept-payment-transaction.php (100%) rename {MobileInAppTransactions => AcceptSuite}/create-an-accept-transaction.php (100%) rename {CustomerProfiles => AcceptSuite}/get-accept-customer-profile-page.php (100%) rename {PaymentTransactions => AcceptSuite}/get-an-accept-payment-page.php (100%) diff --git a/PaymentTransactions/create-an-accept-payment-transaction.php b/AcceptSuite/create-an-accept-payment-transaction.php similarity index 100% rename from PaymentTransactions/create-an-accept-payment-transaction.php rename to AcceptSuite/create-an-accept-payment-transaction.php diff --git a/MobileInAppTransactions/create-an-accept-transaction.php b/AcceptSuite/create-an-accept-transaction.php similarity index 100% rename from MobileInAppTransactions/create-an-accept-transaction.php rename to AcceptSuite/create-an-accept-transaction.php diff --git a/CustomerProfiles/get-accept-customer-profile-page.php b/AcceptSuite/get-accept-customer-profile-page.php similarity index 100% rename from CustomerProfiles/get-accept-customer-profile-page.php rename to AcceptSuite/get-accept-customer-profile-page.php diff --git a/PaymentTransactions/get-an-accept-payment-page.php b/AcceptSuite/get-an-accept-payment-page.php similarity index 100% rename from PaymentTransactions/get-an-accept-payment-page.php rename to AcceptSuite/get-an-accept-payment-page.php From 8dd58e3cde60b3630945b2da415a021b8ca049f2 Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Fri, 10 Aug 2018 17:04:15 +0530 Subject: [PATCH 10/50] + Fixing test-runner.php --- test-runner.php | 1 + 1 file changed, 1 insertion(+) diff --git a/test-runner.php b/test-runner.php index d974414..e4ac837 100644 --- a/test-runner.php +++ b/test-runner.php @@ -14,6 +14,7 @@ } $directories = array( + 'AcceptSuite/', 'CustomerProfiles/', 'RecurringBilling/', 'PayPalExpressCheckout/', From d1604b77d8f9c6d4c0f5086e6fff3715cc3f17a6 Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Fri, 10 Aug 2018 23:51:28 +0530 Subject: [PATCH 11/50] Revert "+ Fixing test-runner.php" This reverts commit 8dd58e3cde60b3630945b2da415a021b8ca049f2. Reverting changes --- test-runner.php | 1 - 1 file changed, 1 deletion(-) diff --git a/test-runner.php b/test-runner.php index e4ac837..d974414 100644 --- a/test-runner.php +++ b/test-runner.php @@ -14,7 +14,6 @@ } $directories = array( - 'AcceptSuite/', 'CustomerProfiles/', 'RecurringBilling/', 'PayPalExpressCheckout/', From d155e1f73451f2d629f1f061ea7f38e58a9cd9af Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Fri, 10 Aug 2018 23:52:07 +0530 Subject: [PATCH 12/50] Revert "+ Adding files to Accept Suite" This reverts commit 79aa06acfb6f5760f68c05d1990d59f30c78a634. Reverting changes --- .../get-accept-customer-profile-page.php | 0 .../create-an-accept-transaction.php | 0 .../create-an-accept-payment-transaction.php | 0 .../get-an-accept-payment-page.php | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename {AcceptSuite => CustomerProfiles}/get-accept-customer-profile-page.php (100%) rename {AcceptSuite => MobileInAppTransactions}/create-an-accept-transaction.php (100%) rename {AcceptSuite => PaymentTransactions}/create-an-accept-payment-transaction.php (100%) rename {AcceptSuite => PaymentTransactions}/get-an-accept-payment-page.php (100%) diff --git a/AcceptSuite/get-accept-customer-profile-page.php b/CustomerProfiles/get-accept-customer-profile-page.php similarity index 100% rename from AcceptSuite/get-accept-customer-profile-page.php rename to CustomerProfiles/get-accept-customer-profile-page.php diff --git a/AcceptSuite/create-an-accept-transaction.php b/MobileInAppTransactions/create-an-accept-transaction.php similarity index 100% rename from AcceptSuite/create-an-accept-transaction.php rename to MobileInAppTransactions/create-an-accept-transaction.php diff --git a/AcceptSuite/create-an-accept-payment-transaction.php b/PaymentTransactions/create-an-accept-payment-transaction.php similarity index 100% rename from AcceptSuite/create-an-accept-payment-transaction.php rename to PaymentTransactions/create-an-accept-payment-transaction.php diff --git a/AcceptSuite/get-an-accept-payment-page.php b/PaymentTransactions/get-an-accept-payment-page.php similarity index 100% rename from AcceptSuite/get-an-accept-payment-page.php rename to PaymentTransactions/get-an-accept-payment-page.php From e0514f3cce814423d183014cc945e30a7d68a7b3 Mon Sep 17 00:00:00 2001 From: saikatbasu01 Date: Mon, 13 Aug 2018 17:22:55 +0530 Subject: [PATCH 13/50] Added randomization for account number in debit-bank-account sample code --- PaymentTransactions/debit-bank-account.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PaymentTransactions/debit-bank-account.php b/PaymentTransactions/debit-bank-account.php index c3da2b2..18d762e 100644 --- a/PaymentTransactions/debit-bank-account.php +++ b/PaymentTransactions/debit-bank-account.php @@ -22,8 +22,8 @@ function debitBankAccount($amount) $bankAccount->setAccountType('checking'); // see eCheck documentation for proper echeck type to use for each situation $bankAccount->setEcheckType('WEB'); - $bankAccount->setRoutingNumber('122000661'); - $bankAccount->setAccountNumber('1234567890'); + $bankAccount->setRoutingNumber('125008547'); + $bankAccount->setAccountNumber(rand(10000,999999999999)); $bankAccount->setNameOnAccount('John Doe'); $bankAccount->setBankName('Wells Fargo Bank NA'); From b06e8e0241fb8baa268e13732d6f123abb0ec102 Mon Sep 17 00:00:00 2001 From: saikatbasu01 Date: Mon, 13 Aug 2018 17:30:24 +0530 Subject: [PATCH 14/50] Added randomization for account number in debit-bank-account sample code --- PaymentTransactions/debit-bank-account.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PaymentTransactions/debit-bank-account.php b/PaymentTransactions/debit-bank-account.php index 18d762e..ad9ba20 100644 --- a/PaymentTransactions/debit-bank-account.php +++ b/PaymentTransactions/debit-bank-account.php @@ -22,7 +22,7 @@ function debitBankAccount($amount) $bankAccount->setAccountType('checking'); // see eCheck documentation for proper echeck type to use for each situation $bankAccount->setEcheckType('WEB'); - $bankAccount->setRoutingNumber('125008547'); + $bankAccount->setRoutingNumber('122000661'); $bankAccount->setAccountNumber(rand(10000,999999999999)); $bankAccount->setNameOnAccount('John Doe'); $bankAccount->setBankName('Wells Fargo Bank NA'); From e99a9ad536fc902f74e41a77b22862947d7e7432 Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Thu, 11 Oct 2018 15:25:51 +0530 Subject: [PATCH 15/50] Update for SDK v1.9.8 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0008661..34fe3c3 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.7 || <2.0" + "authorizenet/authorizenet": ">=1.9.8 || <2.0" } } From 7bea3435f127fc6a2ea8b5392df2f5eac7ba7e29 Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Tue, 16 Oct 2018 10:35:11 +0530 Subject: [PATCH 16/50] October 18 Release of API Reference --- .../create-an-accept-payment-transaction.php | 0 .../get-accept-customer-profile-page.php | 0 .../get-an-accept-payment-page.php | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename {PaymentTransactions => AcceptSuite}/create-an-accept-payment-transaction.php (100%) rename {CustomerProfiles => AcceptSuite}/get-accept-customer-profile-page.php (100%) rename {PaymentTransactions => AcceptSuite}/get-an-accept-payment-page.php (100%) diff --git a/PaymentTransactions/create-an-accept-payment-transaction.php b/AcceptSuite/create-an-accept-payment-transaction.php similarity index 100% rename from PaymentTransactions/create-an-accept-payment-transaction.php rename to AcceptSuite/create-an-accept-payment-transaction.php diff --git a/CustomerProfiles/get-accept-customer-profile-page.php b/AcceptSuite/get-accept-customer-profile-page.php similarity index 100% rename from CustomerProfiles/get-accept-customer-profile-page.php rename to AcceptSuite/get-accept-customer-profile-page.php diff --git a/PaymentTransactions/get-an-accept-payment-page.php b/AcceptSuite/get-an-accept-payment-page.php similarity index 100% rename from PaymentTransactions/get-an-accept-payment-page.php rename to AcceptSuite/get-an-accept-payment-page.php From 4432ac4fad62e9aa5796dec4b2a9c70677c4a861 Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Wed, 24 Oct 2018 12:51:35 +0530 Subject: [PATCH 17/50] Fixing AcceptSuite changes --- test-runner.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test-runner.php b/test-runner.php index d974414..61c981c 100644 --- a/test-runner.php +++ b/test-runner.php @@ -20,7 +20,8 @@ 'PaymentTransactions/', 'TransactionReporting/', 'MobileInappTransactions/', - 'VisaCheckout/' + 'VisaCheckout/', + 'AcceptSuite/' ); $errorlevel=error_reporting(); From c7e3401277db1bd763518af8001438dd2a169f18 Mon Sep 17 00:00:00 2001 From: Sharath Date: Thu, 25 Oct 2018 14:22:28 +0530 Subject: [PATCH 18/50] Changes made to call createAnAcceptPaymentTransaction method --- AcceptSuite/create-an-accept-payment-transaction.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AcceptSuite/create-an-accept-payment-transaction.php b/AcceptSuite/create-an-accept-payment-transaction.php index c38cc1c..562d514 100644 --- a/AcceptSuite/create-an-accept-payment-transaction.php +++ b/AcceptSuite/create-an-accept-payment-transaction.php @@ -128,6 +128,6 @@ function createAnAcceptPaymentTransaction($amount) } if (!defined('DONT_RUN_SAMPLES')) { - CreateAnAcceptTransaction("2.23"); + createAnAcceptPaymentTransaction("2.23"); } ?> \ No newline at end of file From 40ff2e59c86e1369af49f4b420dd39d8b5bca5e5 Mon Sep 17 00:00:00 2001 From: Anjali Nauhwar Date: Fri, 16 Nov 2018 10:54:16 +0530 Subject: [PATCH 19/50] + Correcting UpdateCustomerPaymentProfile --- .../update-customer-payment-profile.php | 150 ++++++++---------- 1 file changed, 70 insertions(+), 80 deletions(-) diff --git a/CustomerProfiles/update-customer-payment-profile.php b/CustomerProfiles/update-customer-payment-profile.php index 38b504c..6093087 100644 --- a/CustomerProfiles/update-customer-payment-profile.php +++ b/CustomerProfiles/update-customer-payment-profile.php @@ -6,9 +6,9 @@ define("AUTHORIZENET_LOG_FILE", "phplog"); -function updateCustomerPaymentProfile($customerProfileId = "36731856", - $customerPaymentProfileId = "33211899" -) { +function updateCustomerPaymentProfile($customerProfileId = "1916322670", + $customerPaymentProfileId = "1829639667") +{ /* Create a merchantAuthenticationType object with authentication details retrieved from the constants file */ $merchantAuthentication = new AnetAPI\MerchantAuthenticationType(); @@ -18,87 +18,77 @@ function updateCustomerPaymentProfile($customerProfileId = "36731856", // Set the transaction's refId $refId = 'ref' . time(); - //Set profile ids of profile to be updated - $request = new AnetAPI\UpdateCustomerPaymentProfileRequest(); - $request->setMerchantAuthentication($merchantAuthentication); - $request->setCustomerProfileId($customerProfileId); - $controller = new AnetController\GetCustomerProfileController($request); - - - // We're updating the billing address but everything has to be passed in an update - // For card information you can pass exactly what comes back from an GetCustomerPaymentProfile - // if you don't need to update that info - $creditCard = new AnetAPI\CreditCardType(); - $creditCard->setCardNumber( "4111111111111111" ); - $creditCard->setExpirationDate("2038-12"); - $paymentCreditCard = new AnetAPI\PaymentType(); - $paymentCreditCard->setCreditCard($creditCard); - - // Create the Bill To info for new payment type - $billto = new AnetAPI\CustomerAddressType(); - $billto->setFirstName("Mrs Mary"); - $billto->setLastName("Doe"); - $billto->setAddress("1 New St."); - $billto->setCity("Brand New City"); - $billto->setState("WA"); - $billto->setZip("98004"); - $billto->setPhoneNumber("000-000-0000"); - $billto->setfaxNumber("999-999-9999"); - $billto->setCountry("USA"); + $request = new AnetAPI\GetCustomerPaymentProfileRequest(); + $request->setMerchantAuthentication($merchantAuthentication); + $request->setRefId( $refId); + $request->setCustomerProfileId($customerProfileId); + $request->setCustomerPaymentProfileId($customerPaymentProfileId); + $controller = new AnetController\GetCustomerPaymentProfileController($request); + $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX); + if (($response != null) && ($response->getMessages()->getResultCode() == "Ok")) + { + $billto = new AnetAPI\CustomerAddressType(); + $billto = $response->getPaymentProfile()->getbillTo(); + + $creditCard = new AnetAPI\CreditCardType(); + $creditCard->setCardNumber( "4111111111111111" ); + $creditCard->setExpirationDate("2038-12"); + + $paymentCreditCard = new AnetAPI\PaymentType(); + $paymentCreditCard->setCreditCard($creditCard); + $paymentprofile = new AnetAPI\CustomerPaymentProfileExType(); + $paymentprofile->setBillTo($billto); + $paymentprofile->setCustomerPaymentProfileId($customerPaymentProfileId); + $paymentprofile->setPayment($paymentCreditCard); - // Create the Customer Payment Profile object - $paymentprofile = new AnetAPI\CustomerPaymentProfileExType(); - $paymentprofile->setCustomerPaymentProfileId($customerPaymentProfileId); - $paymentprofile->setBillTo($billto); - $paymentprofile->setPayment($paymentCreditCard); + // We're updating the billing address but everything has to be passed in an update + // For card information you can pass exactly what comes back from an GetCustomerPaymentProfile + // if you don't need to update that info + + // Update the Bill To info for new payment type + $billto->setFirstName("Mrs Mary"); + $billto->setLastName("Doe"); + $billto->setAddress("9 New St."); + $billto->setCity("Brand New City"); + $billto->setState("WA"); + $billto->setZip("98004"); + $billto->setPhoneNumber("000-000-0000"); + $billto->setfaxNumber("999-999-9999"); + $billto->setCountry("USA"); + + // Update the Customer Payment Profile object + $paymentprofile->setBillTo($billto); - // Submit a UpdatePaymentProfileRequest - $request->setPaymentProfile( $paymentprofile ); + // Submit a UpdatePaymentProfileRequest + $request = new AnetAPI\UpdateCustomerPaymentProfileRequest(); + $request->setMerchantAuthentication($merchantAuthentication); + $request->setCustomerProfileId($customerProfileId); + $request->setPaymentProfile( $paymentprofile ); - $controller = new AnetController\UpdateCustomerPaymentProfileController($request); - $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX); - if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") ) - { - echo "Update Customer Payment Profile SUCCESS: " . "\n"; - - // Update only returns success or fail, if success - // confirm the update by doing a GetCustomerPaymentProfile - $getRequest = new AnetAPI\GetCustomerPaymentProfileRequest(); - $getRequest->setMerchantAuthentication($merchantAuthentication); - $getRequest->setRefId( $refId); - $getRequest->setCustomerProfileId($customerProfileId); - $getRequest->setCustomerPaymentProfileId($customerPaymentProfileId); + $controller = new AnetController\UpdateCustomerPaymentProfileController($request); + $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX); + if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") ) + { + $Message = $response->getMessages()->getMessage(); + print_r($response); + echo "Update Customer Payment Profile SUCCESS: " . $Message[0]->getCode() . " " .$Message[0]->getText() . "\n"; + } + else + { + echo "Failed to Update Customer Payment Profile : " . $errorMessages[0]->getCode() . " " .$errorMessages[0]->getText() . "\n"; + } + + return $response; + } + else + { + echo "Failed to Get Customer Payment Profile : " . $errorMessages[0]->getCode() . " " .$errorMessages[0]->getText() . "\n"; + } - $controller = new AnetController\GetCustomerPaymentProfileController($getRequest); - $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX); - if(($response != null)){ - if ($response->getMessages()->getResultCode() == "Ok") - { - echo "GetCustomerPaymentProfile SUCCESS: " . "\n"; - echo "Customer Payment Profile Id: " . $response->getPaymentProfile()->getCustomerPaymentProfileId() . "\n"; - echo "Customer Payment Profile Billing Address: " . $response->getPaymentProfile()->getbillTo()->getAddress(). "\n"; - } - else - { - echo "GetCustomerPaymentProfile ERROR : Invalid response\n"; - $errorMessages = $response->getMessages()->getMessage(); - echo "Response : " . $errorMessages[0]->getCode() . " " .$errorMessages[0]->getText() . "\n"; - } - } - else{ - echo "NULL Response Error"; - } + return $response; +} - } - else - { - echo "Update Customer Payment Profile: ERROR Invalid response\n"; - $errorMessages = $response->getMessages()->getMessage(); - echo "Response : " . $errorMessages[0]->getCode() . " " .$errorMessages[0]->getText() . "\n"; - } - return $response; - } - if(!defined('DONT_RUN_SAMPLES')) - updateCustomerPaymentProfile(); +if(!defined('DONT_RUN_SAMPLES')) + updateCustomerPaymentProfile(); ?> From ebab0ec91f5ee4be52ad66db67a8d544dcfbd63c Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Thu, 29 Nov 2018 18:19:34 +0530 Subject: [PATCH 20/50] Changed version to v.1.9.9 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 34fe3c3..bd7d261 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.8 || <2.0" + "authorizenet/authorizenet": ">=1.9.9 || <2.0" } } From e0a86ed7ebb007c35c3c3a8a7a5080681cbef3f7 Mon Sep 17 00:00:00 2001 From: Sharath Date: Mon, 10 Dec 2018 17:58:57 +0530 Subject: [PATCH 21/50] Sample-Code for Chase Pay --- .../create-chasepay-transaction.php | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 PaymentTransactions/create-chasepay-transaction.php diff --git a/PaymentTransactions/create-chasepay-transaction.php b/PaymentTransactions/create-chasepay-transaction.php new file mode 100644 index 0000000..c5634e4 --- /dev/null +++ b/PaymentTransactions/create-chasepay-transaction.php @@ -0,0 +1,98 @@ +setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); + $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); + + // Set the transaction's refId + $refId = 'ref' . time(); + + // Create the payment data for a credit card + $creditCard = new AnetAPI\CreditCardType(); + $creditCard->setCardNumber("4111111111111111"); + $creditCard->setExpirationDate("2038-12"); + $creditCard->setCardCode("999"); + // Set the token specific info + $creditCard->setIsPaymentToken(true); + $creditCard->setCryptogram("EjRWeJASNFZ4kBI0VniQEjRWeJA="); + $creditCard->setTokenRequestorName("CHASE_PAY"); + $creditCard->setTokenRequestorId("12345678901"); + $creditCard->setTokenRequestorEci("07"); + + $paymentOne = new AnetAPI\PaymentType(); + $paymentOne->setCreditCard($creditCard); + + //create a transaction + $transactionRequestType = new AnetAPI\TransactionRequestType(); + $transactionRequestType->setTransactionType("authCaptureTransaction"); + $transactionRequestType->setAmount($amount); + $transactionRequestType->setPayment($paymentOne); + + + $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 "Charge Tokenized Credit Card AUTH CODE : " . $tresponse->getAuthCode() . "\n"; + echo "Charge Tokenized Credit Card 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')) + createChasepayTransaction(12.23); +?> From 44fc49348f0d143c620ee76e984c93d74e97645a Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Thu, 13 Dec 2018 13:50:22 +0530 Subject: [PATCH 22/50] + Fixing the name of the file --- ...sepay-transaction.php => create-chase-pay-transaction.php} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename PaymentTransactions/{create-chasepay-transaction.php => create-chase-pay-transaction.php} (97%) diff --git a/PaymentTransactions/create-chasepay-transaction.php b/PaymentTransactions/create-chase-pay-transaction.php similarity index 97% rename from PaymentTransactions/create-chasepay-transaction.php rename to PaymentTransactions/create-chase-pay-transaction.php index c5634e4..ccf1b02 100644 --- a/PaymentTransactions/create-chasepay-transaction.php +++ b/PaymentTransactions/create-chase-pay-transaction.php @@ -6,7 +6,7 @@ define("AUTHORIZENET_LOG_FILE", "phplog"); -function createChasepayTransaction($amount) +function createChasePayTransaction($amount) { /* Create a merchantAuthenticationType object with authentication details retrieved from the constants file */ @@ -94,5 +94,5 @@ function createChasepayTransaction($amount) return $response; } if(!defined('DONT_RUN_SAMPLES')) - createChasepayTransaction(12.23); + createChasePayTransaction(12.23); ?> From 039ccc95e3c74c8e58abede4fd28f5c69b61d1cf Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Wed, 19 Dec 2018 19:43:18 +0530 Subject: [PATCH 23/50] Adding comment on refId field --- TransactionReporting/get-transaction-details.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/TransactionReporting/get-transaction-details.php b/TransactionReporting/get-transaction-details.php index d54def5..1822d78 100644 --- a/TransactionReporting/get-transaction-details.php +++ b/TransactionReporting/get-transaction-details.php @@ -15,6 +15,9 @@ function getTransactionDetails($transactionId) $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); // Set the transaction's refId + // The refId is a Merchant-assigned reference ID for the request. + // If included in the request, this value is included in the response. + // This feature might be especially useful for multi-threaded applications. $refId = 'ref' . time(); $request = new AnetAPI\GetTransactionDetailsRequest(); @@ -43,4 +46,4 @@ function getTransactionDetails($transactionId) if(!defined('DONT_RUN_SAMPLES')) getTransactionDetails("2238968786"); -?> \ No newline at end of file +?> From 4d914c4ac2ea354101ec189367a22a959d11f301 Mon Sep 17 00:00:00 2001 From: Kaushik Mahato Date: Mon, 7 Jan 2019 15:45:25 +0530 Subject: [PATCH 24/50] Removed unwanted ] --- CustomerProfiles/delete-customer-payment-profile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CustomerProfiles/delete-customer-payment-profile.php b/CustomerProfiles/delete-customer-payment-profile.php index 2ddf876..64383d9 100644 --- a/CustomerProfiles/delete-customer-payment-profile.php +++ b/CustomerProfiles/delete-customer-payment-profile.php @@ -1,4 +1,4 @@ -] Date: Mon, 7 Jan 2019 15:56:54 +0530 Subject: [PATCH 25/50] Update create-customer-profile-with-accept-nonce.php --- CustomerProfiles/create-customer-profile-with-accept-nonce.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CustomerProfiles/create-customer-profile-with-accept-nonce.php b/CustomerProfiles/create-customer-profile-with-accept-nonce.php index d9d0375..abce577 100644 --- a/CustomerProfiles/create-customer-profile-with-accept-nonce.php +++ b/CustomerProfiles/create-customer-profile-with-accept-nonce.php @@ -42,7 +42,7 @@ function createCustomerProfileWithAcceptNonce($email) $billto->setState("TX"); $billto->setZip("44628"); $billto->setCountry("USA"); - $billto->setPhoneNumber($phoneNumber); + $billto->setPhoneNumber(123-123-1234); $billto->setfaxNumber("999-999-9999"); // Create a new Customer Payment Profile object From 87314cda6dd3867e44625f2a71b79d6c888ace33 Mon Sep 17 00:00:00 2001 From: KarthikeyanKumar Date: Thu, 14 Feb 2019 10:36:02 +0530 Subject: [PATCH 26/50] Create compute_trans_hashSHA2.php This is the code to verify anet payments integrity using sha hmac512 algorithm --- Sha512/compute_trans_hashSHA2.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Sha512/compute_trans_hashSHA2.php diff --git a/Sha512/compute_trans_hashSHA2.php b/Sha512/compute_trans_hashSHA2.php new file mode 100644 index 0000000..fbf6e75 --- /dev/null +++ b/Sha512/compute_trans_hashSHA2.php @@ -0,0 +1,20 @@ + From 3d4ef81948f86820bf3f1237204e812262b6db36 Mon Sep 17 00:00:00 2001 From: Gabriel Broadwin Nongsiej Date: Mon, 18 Mar 2019 11:37:22 +0530 Subject: [PATCH 27/50] 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 28/50] 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 29/50] 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 30/50] 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 31/50] 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 32/50] 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 33/50] + 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 34/50] 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 35/50] 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 36/50] 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 37/50] 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 38/50] 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 39/50] 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 40/50] 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 41/50] 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 42/50] 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 43/50] 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 44/50] 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 45/50] 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 46/50] 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 47/50] 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 48/50] 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 49/50] 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 50/50] 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