-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
64 changed files
with
4,426 additions
and
50 deletions.
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
Samples/Payments/Capture/CaptureOfAuthorizationThatUsedSwipedTrackData.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
require_once __DIR__ . DIRECTORY_SEPARATOR . '../../../vendor/autoload.php'; | ||
require_once __DIR__ . DIRECTORY_SEPARATOR . '../../../Resources/ExternalConfiguration.php'; | ||
|
||
function CaptureOfAuthorizationThatUsedSwipedTrackData() | ||
{ | ||
require_once __DIR__. DIRECTORY_SEPARATOR .'AuthorizationUsingSwipedTrackData.php'; | ||
$id = AuthorizationUsingSwipedTrackData()[0]['id']; | ||
|
||
$clientReferenceInformationPartnerArr = [ | ||
"thirdPartyCertificationNumber" => "123456789012" | ||
]; | ||
$clientReferenceInformationPartner = new CyberSource\Model\Ptsv2paymentsClientReferenceInformationPartner($clientReferenceInformationPartnerArr); | ||
|
||
$clientReferenceInformationArr = [ | ||
"code" => "1234567890", | ||
"partner" => $clientReferenceInformationPartner | ||
]; | ||
$clientReferenceInformation = new CyberSource\Model\Ptsv2paymentsClientReferenceInformation($clientReferenceInformationArr); | ||
|
||
$orderInformationAmountDetailsArr = [ | ||
"totalAmount" => "100", | ||
"currency" => "USD" | ||
]; | ||
$orderInformationAmountDetails = new CyberSource\Model\Ptsv2paymentsidcapturesOrderInformationAmountDetails($orderInformationAmountDetailsArr); | ||
|
||
$orderInformationArr = [ | ||
"amountDetails" => $orderInformationAmountDetails | ||
]; | ||
$orderInformation = new CyberSource\Model\Ptsv2paymentsidcapturesOrderInformation($orderInformationArr); | ||
|
||
$requestObjArr = [ | ||
"clientReferenceInformation" => $clientReferenceInformation, | ||
"orderInformation" => $orderInformation | ||
]; | ||
$requestObj = new CyberSource\Model\CapturePaymentRequest($requestObjArr); | ||
|
||
|
||
$commonElement = new CyberSource\ExternalConfiguration(); | ||
$config = $commonElement->ConnectionHost(); | ||
$merchantConfig = $commonElement->merchantConfigObject(); | ||
|
||
$api_client = new CyberSource\ApiClient($config, $merchantConfig); | ||
$api_instance = new CyberSource\Api\CaptureApi($api_client); | ||
|
||
try { | ||
$apiResponse = $api_instance->capturePayment($requestObj, $id); | ||
print_r(PHP_EOL); | ||
print_r($apiResponse); | ||
|
||
return $apiResponse; | ||
} catch (Cybersource\ApiException $e) { | ||
print_r($e->getResponseBody()); | ||
print_r($e->getMessage()); | ||
} | ||
} | ||
|
||
if(!defined('DO_NOT_RUN_SAMPLES')){ | ||
echo "\nCaptureOfAuthorizationThatUsedSwipedTrackData Sample Code is Running..." . PHP_EOL; | ||
CaptureOfAuthorizationThatUsedSwipedTrackData(); | ||
} | ||
?> |
69 changes: 69 additions & 0 deletions
69
Samples/Payments/Capture/RestaurantCaptureWithGratuity.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
require_once __DIR__ . DIRECTORY_SEPARATOR . '../../../vendor/autoload.php'; | ||
require_once __DIR__ . DIRECTORY_SEPARATOR . '../../../Resources/ExternalConfiguration.php'; | ||
|
||
function RestaurantCaptureWithGratuity() | ||
{ | ||
require_once __DIR__. DIRECTORY_SEPARATOR .'RestaurantAuthorization.php'; | ||
$id = RestaurantAuthorization()[0]['id']; | ||
|
||
$clientReferenceInformationPartnerArr = [ | ||
"thirdPartyCertificationNumber" => "123456789012" | ||
]; | ||
$clientReferenceInformationPartner = new CyberSource\Model\Ptsv2paymentsClientReferenceInformationPartner($clientReferenceInformationPartnerArr); | ||
|
||
$clientReferenceInformationArr = [ | ||
"code" => "1234567890", | ||
"partner" => $clientReferenceInformationPartner | ||
]; | ||
$clientReferenceInformation = new CyberSource\Model\Ptsv2paymentsClientReferenceInformation($clientReferenceInformationArr); | ||
|
||
$processingInformationArr = [ | ||
"industryDataType" => "restaurant" | ||
]; | ||
$processingInformation = new CyberSource\Model\Ptsv2paymentsidcapturesProcessingInformation($processingInformationArr); | ||
|
||
$orderInformationAmountDetailsArr = [ | ||
"totalAmount" => "100", | ||
"currency" => "USD", | ||
"gratuityAmount" => "11.50" | ||
]; | ||
$orderInformationAmountDetails = new CyberSource\Model\Ptsv2paymentsidcapturesOrderInformationAmountDetails($orderInformationAmountDetailsArr); | ||
|
||
$orderInformationArr = [ | ||
"amountDetails" => $orderInformationAmountDetails | ||
]; | ||
$orderInformation = new CyberSource\Model\Ptsv2paymentsidcapturesOrderInformation($orderInformationArr); | ||
|
||
$requestObjArr = [ | ||
"clientReferenceInformation" => $clientReferenceInformation, | ||
"processingInformation" => $processingInformation, | ||
"orderInformation" => $orderInformation | ||
]; | ||
$requestObj = new CyberSource\Model\CapturePaymentRequest($requestObjArr); | ||
|
||
|
||
$commonElement = new CyberSource\ExternalConfiguration(); | ||
$config = $commonElement->ConnectionHost(); | ||
$merchantConfig = $commonElement->merchantConfigObject(); | ||
|
||
$api_client = new CyberSource\ApiClient($config, $merchantConfig); | ||
$api_instance = new CyberSource\Api\CaptureApi($api_client); | ||
|
||
try { | ||
$apiResponse = $api_instance->capturePayment($requestObj, $id); | ||
print_r(PHP_EOL); | ||
print_r($apiResponse); | ||
|
||
return $apiResponse; | ||
} catch (Cybersource\ApiException $e) { | ||
print_r($e->getResponseBody()); | ||
print_r($e->getMessage()); | ||
} | ||
} | ||
|
||
if(!defined('DO_NOT_RUN_SAMPLES')){ | ||
echo "\nRestaurantCaptureWithGratuity Sample Code is Running..." . PHP_EOL; | ||
RestaurantCaptureWithGratuity(); | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?php | ||
require_once __DIR__ . DIRECTORY_SEPARATOR . '../../../vendor/autoload.php'; | ||
require_once __DIR__ . DIRECTORY_SEPARATOR . '../../../Resources/ExternalConfiguration.php'; | ||
|
||
function CreditUsingBluefinPCIP2PE() | ||
{ | ||
$clientReferenceInformationArr = [ | ||
"code" => "demomerchant" | ||
]; | ||
$clientReferenceInformation = new CyberSource\Model\Ptsv2paymentsClientReferenceInformation($clientReferenceInformationArr); | ||
|
||
$processingInformationArr = [ | ||
"commerceIndicator" => "retail" | ||
]; | ||
$processingInformation = new CyberSource\Model\Ptsv2creditsProcessingInformation($processingInformationArr); | ||
|
||
$paymentInformationCardArr = [ | ||
"expirationMonth" => "12", | ||
"expirationYear" => "2050" | ||
]; | ||
$paymentInformationCard = new CyberSource\Model\Ptsv2paymentsidrefundsPaymentInformationCard($paymentInformationCardArr); | ||
|
||
$paymentInformationFluidDataArr = [ | ||
"descriptor" => "Ymx1ZWZpbg==", | ||
"value" => "02d700801f3c20008383252a363031312a2a2a2a2a2a2a2a303030395e46444d53202020202020202020202020202020202020202020205e323231322a2a2a2a2a2a2a2a3f2a3b363031312a2a2a2a2a2a2a2a303030393d323231322a2a2a2a2a2a2a2a3f2a7a75ad15d25217290c54b3d9d1c3868602136c68d339d52d98423391f3e631511d548fff08b414feac9ff6c6dede8fb09bae870e4e32f6f462d6a75fa0a178c3bd18d0d3ade21bc7a0ea687a2eef64551751e502d97cb98dc53ea55162cdfa395431323439323830303762994901000001a000731a8003" | ||
]; | ||
$paymentInformationFluidData = new CyberSource\Model\Ptsv2paymentsPaymentInformationFluidData($paymentInformationFluidDataArr); | ||
|
||
$paymentInformationArr = [ | ||
"card" => $paymentInformationCard, | ||
"fluidData" => $paymentInformationFluidData | ||
]; | ||
$paymentInformation = new CyberSource\Model\Ptsv2paymentsidrefundsPaymentInformation($paymentInformationArr); | ||
|
||
$orderInformationAmountDetailsArr = [ | ||
"totalAmount" => "100.00", | ||
"currency" => "USD" | ||
]; | ||
$orderInformationAmountDetails = new CyberSource\Model\Ptsv2paymentsidcapturesOrderInformationAmountDetails($orderInformationAmountDetailsArr); | ||
|
||
$orderInformationBillToArr = [ | ||
"firstName" => "John", | ||
"lastName" => "Deo", | ||
"address1" => "201 S. Division St.", | ||
"locality" => "Ann Arbor", | ||
"administrativeArea" => "MI", | ||
"postalCode" => "48104-2201", | ||
"country" => "US", | ||
"email" => "[email protected]", | ||
"phoneNumber" => "999999999" | ||
]; | ||
$orderInformationBillTo = new CyberSource\Model\Ptsv2paymentsidcapturesOrderInformationBillTo($orderInformationBillToArr); | ||
|
||
$orderInformationArr = [ | ||
"amountDetails" => $orderInformationAmountDetails, | ||
"billTo" => $orderInformationBillTo | ||
]; | ||
$orderInformation = new CyberSource\Model\Ptsv2paymentsidrefundsOrderInformation($orderInformationArr); | ||
|
||
$pointOfSaleInformationArr = [ | ||
"catLevel" => 1, | ||
"entryMode" => "keyed", | ||
"terminalCapability" => 2 | ||
]; | ||
$pointOfSaleInformation = new CyberSource\Model\Ptsv2paymentsPointOfSaleInformation($pointOfSaleInformationArr); | ||
|
||
$requestObjArr = [ | ||
"clientReferenceInformation" => $clientReferenceInformation, | ||
"processingInformation" => $processingInformation, | ||
"paymentInformation" => $paymentInformation, | ||
"orderInformation" => $orderInformation, | ||
"pointOfSaleInformation" => $pointOfSaleInformation | ||
]; | ||
$requestObj = new CyberSource\Model\CreateCreditRequest($requestObjArr); | ||
|
||
|
||
$commonElement = new CyberSource\ExternalConfiguration(); | ||
$config = $commonElement->ConnectionHost(); | ||
$merchantConfig = $commonElement->merchantConfigObject(); | ||
|
||
$api_client = new CyberSource\ApiClient($config, $merchantConfig); | ||
$api_instance = new CyberSource\Api\CreditApi($api_client); | ||
|
||
try { | ||
$apiResponse = $api_instance->createCredit($requestObj); | ||
print_r(PHP_EOL); | ||
print_r($apiResponse); | ||
|
||
return $apiResponse; | ||
} catch (Cybersource\ApiException $e) { | ||
print_r($e->getResponseBody()); | ||
print_r($e->getMessage()); | ||
} | ||
} | ||
|
||
if(!defined('DO_NOT_RUN_SAMPLES')){ | ||
echo "\nCreditUsingBluefinPCIP2PE Sample Code is Running..." . PHP_EOL; | ||
CreditUsingBluefinPCIP2PE(); | ||
} | ||
?> |
76 changes: 76 additions & 0 deletions
76
Samples/Payments/Credit/CreditWithCustomerPaymentInstrumentAndShippingAddressTokenId.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?php | ||
require_once __DIR__ . DIRECTORY_SEPARATOR . '../../../vendor/autoload.php'; | ||
require_once __DIR__ . DIRECTORY_SEPARATOR . '../../../Resources/ExternalConfiguration.php'; | ||
|
||
function CreditWithCustomerPaymentInstrumentAndShippingAddressTokenId() | ||
{ | ||
$clientReferenceInformationArr = [ | ||
"code" => "12345678" | ||
]; | ||
$clientReferenceInformation = new CyberSource\Model\Ptsv2paymentsClientReferenceInformation($clientReferenceInformationArr); | ||
|
||
$paymentInformationCustomerArr = [ | ||
"id" => "7500BB199B4270EFE05340588D0AFCAD" | ||
]; | ||
$paymentInformationCustomer = new CyberSource\Model\Ptsv2paymentsPaymentInformationCustomer($paymentInformationCustomerArr); | ||
|
||
$paymentInformationPaymentInstrumentArr = [ | ||
"id" => "7500BB199B4270EFE05340588D0AFCPI" | ||
]; | ||
$paymentInformationPaymentInstrument = new CyberSource\Model\Ptsv2paymentsPaymentInformationPaymentInstrument($paymentInformationPaymentInstrumentArr); | ||
|
||
$paymentInformationShippingAddressArr = [ | ||
"id" => "7500BB199B4270EFE05340588D0AFCSA" | ||
]; | ||
$paymentInformationShippingAddress = new CyberSource\Model\Ptsv2paymentsPaymentInformationShippingAddress($paymentInformationShippingAddressArr); | ||
|
||
$paymentInformationArr = [ | ||
"customer" => $paymentInformationCustomer, | ||
"paymentInstrument" => $paymentInformationPaymentInstrument, | ||
"shippingAddress" => $paymentInformationShippingAddress | ||
]; | ||
$paymentInformation = new CyberSource\Model\Ptsv2paymentsidrefundsPaymentInformation($paymentInformationArr); | ||
|
||
$orderInformationAmountDetailsArr = [ | ||
"totalAmount" => "200", | ||
"currency" => "usd" | ||
]; | ||
$orderInformationAmountDetails = new CyberSource\Model\Ptsv2paymentsidcapturesOrderInformationAmountDetails($orderInformationAmountDetailsArr); | ||
|
||
$orderInformationArr = [ | ||
"amountDetails" => $orderInformationAmountDetails | ||
]; | ||
$orderInformation = new CyberSource\Model\Ptsv2paymentsidrefundsOrderInformation($orderInformationArr); | ||
|
||
$requestObjArr = [ | ||
"clientReferenceInformation" => $clientReferenceInformation, | ||
"paymentInformation" => $paymentInformation, | ||
"orderInformation" => $orderInformation | ||
]; | ||
$requestObj = new CyberSource\Model\CreateCreditRequest($requestObjArr); | ||
|
||
|
||
$commonElement = new CyberSource\ExternalConfiguration(); | ||
$config = $commonElement->ConnectionHost(); | ||
$merchantConfig = $commonElement->merchantConfigObject(); | ||
|
||
$api_client = new CyberSource\ApiClient($config, $merchantConfig); | ||
$api_instance = new CyberSource\Api\CreditApi($api_client); | ||
|
||
try { | ||
$apiResponse = $api_instance->createCredit($requestObj); | ||
print_r(PHP_EOL); | ||
print_r($apiResponse); | ||
|
||
return $apiResponse; | ||
} catch (Cybersource\ApiException $e) { | ||
print_r($e->getResponseBody()); | ||
print_r($e->getMessage()); | ||
} | ||
} | ||
|
||
if(!defined('DO_NOT_RUN_SAMPLES')){ | ||
echo "\nCreditWithCustomerPaymentInstrumentAndShippingAddressTokenId Sample Code is Running..." . PHP_EOL; | ||
CreditWithCustomerPaymentInstrumentAndShippingAddressTokenId(); | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
require_once __DIR__ . DIRECTORY_SEPARATOR . '../../../vendor/autoload.php'; | ||
require_once __DIR__ . DIRECTORY_SEPARATOR . '../../../Resources/ExternalConfiguration.php'; | ||
|
||
function CreditWithCustomerTokenId() | ||
{ | ||
$clientReferenceInformationArr = [ | ||
"code" => "12345678" | ||
]; | ||
$clientReferenceInformation = new CyberSource\Model\Ptsv2paymentsClientReferenceInformation($clientReferenceInformationArr); | ||
|
||
$paymentInformationCustomerArr = [ | ||
"id" => "7500BB199B4270EFE05340588D0AFCAD" | ||
]; | ||
$paymentInformationCustomer = new CyberSource\Model\Ptsv2paymentsPaymentInformationCustomer($paymentInformationCustomerArr); | ||
|
||
$paymentInformationArr = [ | ||
"customer" => $paymentInformationCustomer | ||
]; | ||
$paymentInformation = new CyberSource\Model\Ptsv2paymentsidrefundsPaymentInformation($paymentInformationArr); | ||
|
||
$orderInformationAmountDetailsArr = [ | ||
"totalAmount" => "200", | ||
"currency" => "usd" | ||
]; | ||
$orderInformationAmountDetails = new CyberSource\Model\Ptsv2paymentsidcapturesOrderInformationAmountDetails($orderInformationAmountDetailsArr); | ||
|
||
$orderInformationArr = [ | ||
"amountDetails" => $orderInformationAmountDetails | ||
]; | ||
$orderInformation = new CyberSource\Model\Ptsv2paymentsidrefundsOrderInformation($orderInformationArr); | ||
|
||
$requestObjArr = [ | ||
"clientReferenceInformation" => $clientReferenceInformation, | ||
"paymentInformation" => $paymentInformation, | ||
"orderInformation" => $orderInformation | ||
]; | ||
$requestObj = new CyberSource\Model\CreateCreditRequest($requestObjArr); | ||
|
||
|
||
$commonElement = new CyberSource\ExternalConfiguration(); | ||
$config = $commonElement->ConnectionHost(); | ||
$merchantConfig = $commonElement->merchantConfigObject(); | ||
|
||
$api_client = new CyberSource\ApiClient($config, $merchantConfig); | ||
$api_instance = new CyberSource\Api\CreditApi($api_client); | ||
|
||
try { | ||
$apiResponse = $api_instance->createCredit($requestObj); | ||
print_r(PHP_EOL); | ||
print_r($apiResponse); | ||
|
||
return $apiResponse; | ||
} catch (Cybersource\ApiException $e) { | ||
print_r($e->getResponseBody()); | ||
print_r($e->getMessage()); | ||
} | ||
} | ||
|
||
if(!defined('DO_NOT_RUN_SAMPLES')){ | ||
echo "\nCreditWithCustomerTokenId Sample Code is Running..." . PHP_EOL; | ||
CreditWithCustomerTokenId(); | ||
} | ||
?> |
Oops, something went wrong.