Skip to content

Commit 3f65c1b

Browse files
authored
standardize merchant authentication block (AuthorizeNet#88)
* formatting and comments * formatting and comments * formatting and comments * formatting and comments * formatting and comments * standardized merchant authentication block * standardize merchant authentication block * standardize merchant authentication block * standardize merchant authentication block * standardize merchant authentication block * standardize merchant authentication block
1 parent 2fd4492 commit 3f65c1b

File tree

53 files changed

+400
-213
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+400
-213
lines changed

CustomerProfiles/delete-customer-payment-profile.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@
55

66
define("AUTHORIZENET_LOG_FILE", "phplog");
77

8-
function deleteCustomerPaymentProfile($customerProfileId= "36152127",
9-
$customerpaymentprofileid = "32689274")
10-
{
11-
// Common setup for API credentials
12-
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
13-
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
14-
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
8+
function deleteCustomerPaymentProfile($customerProfileId= "36152127",
9+
$customerpaymentprofileid = "32689274"
10+
) {
11+
/* Create a merchantAuthenticationType object with authentication details
12+
retrieved from the constants file */
13+
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
14+
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
15+
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
16+
17+
// Set the transaction's refId
18+
$refId = 'ref' . time();
1519

1620
// Use an existing payment profile ID for this Merchant name and Transaction key
1721

CustomerProfiles/delete-customer-profile.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55

66
define("AUTHORIZENET_LOG_FILE", "phplog");
77

8-
function deleteCustomerProfile($customerProfileId)
9-
{
10-
// Common setup for API credentials
11-
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
12-
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
13-
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
14-
$refId = 'ref' . time();
8+
function deleteCustomerProfile($customerProfileId)
9+
{
10+
/* Create a merchantAuthenticationType object with authentication details
11+
retrieved from the constants file */
12+
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
13+
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
14+
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
15+
16+
// Set the transaction's refId
17+
$refId = 'ref' . time();
1518

1619
// Delete an existing customer profile
1720
$request = new AnetAPI\DeleteCustomerProfileRequest();

CustomerProfiles/delete-customer-shipping-address.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@
55

66
define("AUTHORIZENET_LOG_FILE", "phplog");
77

8-
function deleteCustomerShippingAddress($customerprofileid = "36731856", $customeraddressid = "36976434")
9-
{
10-
// Common setup for API credentials
11-
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
12-
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
13-
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
8+
function deleteCustomerShippingAddress($customerprofileid = "36731856", $customeraddressid = "36976434")
9+
{
10+
/* Create a merchantAuthenticationType object with authentication details
11+
retrieved from the constants file */
12+
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
13+
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
14+
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
15+
16+
// Set the transaction's refId
17+
$refId = 'ref' . time();
1418

1519
// Use an existing customer profile and address id for this merchant name and transaction key
1620
// Delete an existing customer shipping address for an existing customer profile

CustomerProfiles/get-accept-customer-profile-page.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@
55

66
define("AUTHORIZENET_LOG_FILE", "phplog");
77

8-
function getAcceptCustomerProfilePage($customerprofileid = "123212")
9-
{
10-
// Common setup for API credentials
11-
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
12-
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
13-
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
8+
function getAcceptCustomerProfilePage($customerprofileid = "123212")
9+
{
10+
/* Create a merchantAuthenticationType object with authentication details
11+
retrieved from the constants file */
12+
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
13+
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
14+
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
15+
16+
// Set the transaction's refId
17+
$refId = 'ref' . time();
1418

1519
// Use an existing payment profile ID for this Merchant name and Transaction key
1620

CustomerProfiles/get-customer-payment-profile-list.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66

77
define("AUTHORIZENET_LOG_FILE", "phplog");
88

9-
function getCustomerPaymentProfileList()
10-
{
11-
// Common setup for API credentials (merchant)
12-
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
13-
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
14-
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
15-
$refId = 'ref' . time();
9+
function getCustomerPaymentProfileList()
10+
{
11+
/* Create a merchantAuthenticationType object with authentication details
12+
retrieved from the constants file */
13+
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
14+
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
15+
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
16+
17+
// Set the transaction's refId
18+
$refId = 'ref' . time();
1619

1720
//Setting the paging
1821
$paging = new AnetAPI\PagingType();

CustomerProfiles/get-customer-payment-profile.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@
88
define("AUTHORIZENET_LOG_FILE", "phplog");
99

1010
function getCustomerPaymentProfile($customerProfileId="36731856",
11-
$customerPaymentProfileId= "33211899")
12-
{
13-
// Common setup for API credentials (merchant)
14-
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
15-
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
16-
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
17-
$refId = 'ref' . time();
11+
$customerPaymentProfileId= "33211899"
12+
) {
13+
/* Create a merchantAuthenticationType object with authentication details
14+
retrieved from the constants file */
15+
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
16+
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
17+
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
18+
19+
// Set the transaction's refId
20+
$refId = 'ref' . time();
1821

1922
//request requires customerProfileId and customerPaymentProfileId
2023
$request = new AnetAPI\GetCustomerPaymentProfileRequest();

CustomerProfiles/get-customer-profile-ids.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@
55

66
define("AUTHORIZENET_LOG_FILE", "phplog");
77

8-
function getCustomerProfileIds()
9-
{
10-
// Common setup for API credentials
8+
function getCustomerProfileIds()
9+
{
10+
/* Create a merchantAuthenticationType object with authentication details
11+
retrieved from the constants file */
1112
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
1213
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
1314
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
15+
16+
// Set the transaction's refId
1417
$refId = 'ref' . time();
1518

1619
// Get all existing customer profile ID's

CustomerProfiles/get-customer-profile.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55

66
define("AUTHORIZENET_LOG_FILE", "phplog");
77

8-
function getCustomerProfile(){
9-
// Common setup for API credentials
8+
function getCustomerProfile()
9+
{
10+
/* Create a merchantAuthenticationType object with authentication details
11+
retrieved from the constants file */
12+
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
13+
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
14+
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
1015

11-
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
12-
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
13-
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
14-
$refId = 'ref' . time();
16+
// Set the transaction's refId
17+
$refId = 'ref' . time();
1518

1619
// Create the payment data for a credit card
1720
$creditCard = new AnetAPI\CreditCardType();

CustomerProfiles/get-customer-shipping-address.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@
55

66
define("AUTHORIZENET_LOG_FILE", "phplog");
77

8-
function getCustomerShippingAddress($customerprofileid, $customeraddressid)
9-
{
10-
// Common setup for API credentials
11-
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
12-
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
13-
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
8+
function getCustomerShippingAddress($customerprofileid, $customeraddressid)
9+
{
10+
/* Create a merchantAuthenticationType object with authentication details
11+
retrieved from the constants file */
12+
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
13+
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
14+
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
15+
16+
// Set the transaction's refId
17+
$refId = 'ref' . time();
1418

1519
// An existing customer profile id and shipping address id for this merchant name and transaction key
1620
$customerProfileId = $customerprofileid;

CustomerProfiles/update-customer-payment-profile.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55

66
define("AUTHORIZENET_LOG_FILE", "phplog");
77

8-
function updateCustomerPaymentProfile($customerProfileId = "36731856",
9-
$customerPaymentProfileId = "33211899")
10-
{
11-
// Common setup for API credentials
12-
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
13-
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
14-
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
15-
$refId = 'ref' . time();
8+
function updateCustomerPaymentProfile($customerProfileId = "36731856",
9+
$customerPaymentProfileId = "33211899"
10+
) {
11+
/* Create a merchantAuthenticationType object with authentication details
12+
retrieved from the constants file */
13+
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
14+
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
15+
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
16+
17+
// Set the transaction's refId
18+
$refId = 'ref' . time();
1619

1720
//Set profile ids of profile to be updated
1821
$request = new AnetAPI\UpdateCustomerPaymentProfileRequest();

0 commit comments

Comments
 (0)