Skip to content

Commit c1fcfbd

Browse files
committed
Added constants like merchant login id, transaction key.
Fixed output logic of PaypalExpressCheckout\get-details.php
1 parent 44f06e6 commit c1fcfbd

51 files changed

Lines changed: 271 additions & 183 deletions

File tree

Some content is hidden

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

ApplePayTransactions/create-an-apple-pay-transaction.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
function createAnApplePayTransaction(){
88
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
9-
$merchantAuthentication->setName("5KP3u95bQpv");
10-
$merchantAuthentication->setTransactionKey("4Ktq966gC55GAX7S");
9+
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
10+
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
1111
$refId = 'ref' . time();
1212

1313
$op = new AnetAPI\OpaqueDataType();

CustomerProfiles/create-customer-payment-profile.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
function createCustomerPaymentProfile($existingcustomerprofileid, $phoneNumber){
77
// Common setup for API credentials
88
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
9-
$merchantAuthentication->setName("5KP3u95bQpv");
10-
$merchantAuthentication->setTransactionKey("4Ktq966gC55GAX7S");
9+
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
10+
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
1111
$refId = 'ref' . time();
1212

1313
$creditCard = new AnetAPI\CreditCardType();
14-
$creditCard->setCardNumber( "4242424242424242" );
15-
$creditCard->setExpirationDate( "2038-11");
16-
$creditCard->setCardCode( "142");
14+
$creditCard->setCardNumber( \SampleCode\Constants::CREDIT_CARD_NUMBER_2);
15+
$creditCard->setExpirationDate( \SampleCode\Constants::EXPIRY_DATE);
16+
$creditCard->setCardCode( \SampleCode\Constants::CVV);
1717
$paymentCreditCard = new AnetAPI\PaymentType();
1818
$paymentCreditCard->setCreditCard($creditCard);
1919

@@ -60,5 +60,5 @@ function createCustomerPaymentProfile($existingcustomerprofileid, $phoneNumber){
6060
return $response;
6161
}
6262
if(!defined('DONT_RUN_SAMPLES'))
63-
createCustomerPaymentProfile("36152127","000-000-0009");
63+
createCustomerPaymentProfile(\SampleCode\Constants::CUSTOMER_PROFILE_ID,"000-000-0009");
6464
?>

CustomerProfiles/create-customer-profile-from-transaction.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
use net\authorize\api\contract\v1 as AnetAPI;
44
use net\authorize\api\controller as AnetController;
55

6-
function createCustomerProfileFromTransaction($transId="2238251168")
6+
function createCustomerProfileFromTransaction($transId= \SampleCode\Constants::TRANS_ID_TO_CREATE_CUSTOMER_PROFILE)
77
{
88
// Common setup for API credentials
99
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
10-
$merchantAuthentication->setName("5KP3u95bQpv");
11-
$merchantAuthentication->setTransactionKey("4Ktq966gC55GAX7S");
12-
10+
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
11+
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
12+
1313
$request = new AnetAPI\CreateCustomerProfileFromTransactionRequest();
1414
$request->setMerchantAuthentication($merchantAuthentication);
1515
$request->setTransId($transId);
@@ -31,5 +31,5 @@ function createCustomerProfileFromTransaction($transId="2238251168")
3131
}
3232
//provide a transaction that has customer information
3333
if(!defined('DONT_RUN_SAMPLES'))
34-
createCustomerProfileFromTransaction("2249066517");
34+
createCustomerProfileFromTransaction(\SampleCode\Constants::TRANS_ID_TO_CREATE_CUSTOMER_PROFILE);
3535
?>

CustomerProfiles/create-customer-profile.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ function createCustomerProfile($email){
77

88
// Common setup for API credentials
99
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
10-
$merchantAuthentication->setName("5KP3u95bQpv");
11-
$merchantAuthentication->setTransactionKey("4Ktq966gC55GAX7S");
12-
$refId = 'ref' . time();
10+
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
11+
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
12+
$refId = 'ref' . time();
1313

1414
// Create the payment data for a credit card
1515
$creditCard = new AnetAPI\CreditCardType();
16-
$creditCard->setCardNumber( "4111111111111111" );
17-
$creditCard->setExpirationDate( "2038-12");
16+
$creditCard->setCardNumber( \SampleCode\Constants::CREDIT_CARD_NUMBER);
17+
$creditCard->setExpirationDate( \SampleCode\Constants::EXPIRY_DATE);
1818
$paymentCreditCard = new AnetAPI\PaymentType();
1919
$paymentCreditCard->setCreditCard($creditCard);
2020

@@ -68,5 +68,5 @@ function createCustomerProfile($email){
6868
return $response;
6969
}
7070
if(!defined('DONT_RUN_SAMPLES'))
71-
createCustomerProfile("test567@test.com");
71+
createCustomerProfile( \SampleCode\Constants::TEST_CUSTOMER_EMAIL);
7272
?>

CustomerProfiles/create-customer-shipping-address.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
require 'vendor/autoload.php';
33
use net\authorize\api\contract\v1 as AnetAPI;
44
use net\authorize\api\controller as AnetController;
5-
function createCustomerShippingAddress($existingcustomerprofileid = "36152127", $phoneNumber="000-000-0000")
5+
function createCustomerShippingAddress($existingcustomerprofileid = \SampleCode\Constants::CUSTOMER_PROFILE_ID,
6+
$phoneNumber= \SampleCode\Constants::PHONE_NUMBER)
67
{
78
// Common setup for API credentials
89
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
9-
$merchantAuthentication->setName("5KP3u95bQpv");
10-
$merchantAuthentication->setTransactionKey("4Ktq966gC55GAX7S");
11-
10+
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
11+
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
12+
1213
// Use An existing customer profile id for this merchant name and transaction key
1314

1415
// Create the customer shipping address

CustomerProfiles/delete-customer-payment-profile.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
use net\authorize\api\contract\v1 as AnetAPI;
44
use net\authorize\api\controller as AnetController;
55

6-
function deleteCustomerPaymentProfile($customerProfileId="36152127", $customerpaymentprofileid = "32689274")
6+
function deleteCustomerPaymentProfile($customerProfileId= \SampleCode\Constants::CUSTOMER_PROFILE_ID,
7+
$customerpaymentprofileid = \SampleCode\Constants::CUSTOMER_PAYMENT_PROFILE_ID)
78
{
89
// Common setup for API credentials
910
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
10-
$merchantAuthentication->setName("5KP3u95bQpv");
11-
$merchantAuthentication->setTransactionKey("4Ktq966gC55GAX7S");
12-
11+
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
12+
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
13+
1314
// Use an existing payment profile ID for this Merchant name and Transaction key
1415

1516
$request = new AnetAPI\DeleteCustomerPaymentProfileRequest();

CustomerProfiles/delete-customer-profile.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ function deleteCustomerProfile($customerProfileId)
77
{
88
// Common setup for API credentials
99
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
10-
$merchantAuthentication->setName("5KP3u95bQpv");
11-
$merchantAuthentication->setTransactionKey("4Ktq966gC55GAX7S");
12-
$refId = 'ref' . time();
10+
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
11+
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
12+
$refId = 'ref' . time();
1313

1414
// Delete an existing customer profile
1515
$request = new AnetAPI\DeleteCustomerProfileRequest();
@@ -33,5 +33,5 @@ function deleteCustomerProfile($customerProfileId)
3333
}
3434

3535
if(!defined('DONT_RUN_SAMPLES'))
36-
deleteCustomerProfile("38958129");
36+
deleteCustomerProfile( \SampleCode\Constants::CUSTOMER_PAYMENT_PROFILE_ID_DELETE);
3737
?>

CustomerProfiles/delete-customer-shipping-address.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
use net\authorize\api\contract\v1 as AnetAPI;
44
use net\authorize\api\controller as AnetController;
55

6-
function deleteCustomerShippingAddress($customerprofileid = "36152127", $customeraddressid = "36976434")
6+
function deleteCustomerShippingAddress($customerprofileid = \SampleCode\Constants::CUSTOMER_PROFILE_ID_2,
7+
$customeraddressid = "36976434")
78
{
89
// Common setup for API credentials
910
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
10-
$merchantAuthentication->setName("5KP3u95bQpv");
11-
$merchantAuthentication->setTransactionKey("4Ktq966gC55GAX7S");
12-
11+
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
12+
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
13+
1314
// Use an existing customer profile and address id for this merchant name and transaction key
1415
// Delete an existing customer shipping address for an existing customer profile
1516
$request = new AnetAPI\DeleteCustomerShippingAddressRequest();

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ function getCustomerPaymentProfileList()
99
{
1010
// Common setup for API credentials (merchant)
1111
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
12-
$merchantAuthentication->setName("5KP3u95bQpv");
13-
$merchantAuthentication->setTransactionKey("4Ktq966gC55GAX7S");
14-
$refId = 'ref' . time();
12+
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
13+
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
14+
$refId = 'ref' . time();
1515

1616
//Setting the paging
1717
$paging = new AnetAPI\PagingType();

CustomerProfiles/get-customer-payment-profile.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
use net\authorize\api\contract\v1 as AnetAPI;
77
use net\authorize\api\controller as AnetController;
88

9-
function getCustomerPaymentProfile($customerProfileId="36731856", $customerPaymentProfileId="33211899")
9+
function getCustomerPaymentProfile($customerProfileId=\SampleCode\Constants::CUSTOMER_PROFILE_ID_2,
10+
$customerPaymentProfileId= \SampleCode\Constants::CUSTOMER_PAYMENT_PROFILE_ID_GET)
1011
{
1112
// Common setup for API credentials (merchant)
1213
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
13-
$merchantAuthentication->setName("5KP3u95bQpv");
14-
$merchantAuthentication->setTransactionKey("4Ktq966gC55GAX7S");
14+
$merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
15+
$merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);
1516
$refId = 'ref' . time();
1617

1718
//request requires customerProfileId and customerPaymentProfileId

0 commit comments

Comments
 (0)