2020-06-09 13:17:26 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\Integration\PaymentDrivers;
|
|
|
|
|
2020-06-24 03:15:51 +02:00
|
|
|
use App\Factory\PaymentFactory;
|
|
|
|
use App\Models\CompanyGateway;
|
|
|
|
use App\PaymentDrivers\AuthorizePaymentDriver;
|
2020-06-09 13:17:26 +02:00
|
|
|
use net\authorize\api\constants\ANetEnvironment;
|
|
|
|
use net\authorize\api\contract\v1 as AnetAPI;
|
2020-06-10 03:06:37 +02:00
|
|
|
use net\authorize\api\contract\v1\CreateCustomerPaymentProfileRequest;
|
2020-06-09 13:17:26 +02:00
|
|
|
use net\authorize\api\contract\v1\CreateTransactionRequest;
|
2020-06-10 03:06:37 +02:00
|
|
|
use net\authorize\api\contract\v1\CreditCardType;
|
|
|
|
use net\authorize\api\contract\v1\CustomerAddressType;
|
|
|
|
use net\authorize\api\contract\v1\CustomerPaymentProfileType;
|
|
|
|
use net\authorize\api\contract\v1\CustomerProfilePaymentType;
|
|
|
|
use net\authorize\api\contract\v1\CustomerProfileType;
|
|
|
|
use net\authorize\api\contract\v1\GetCustomerProfileIdsRequest;
|
|
|
|
use net\authorize\api\contract\v1\GetCustomerProfileRequest;
|
2020-06-09 13:17:26 +02:00
|
|
|
use net\authorize\api\contract\v1\GetMerchantDetailsRequest;
|
|
|
|
use net\authorize\api\contract\v1\MerchantAuthenticationType;
|
2020-06-10 03:06:37 +02:00
|
|
|
use net\authorize\api\contract\v1\PaymentProfileType;
|
|
|
|
use net\authorize\api\contract\v1\PaymentType;
|
|
|
|
use net\authorize\api\contract\v1\TransactionRequestType;
|
|
|
|
use net\authorize\api\controller\CreateCustomerPaymentProfileController;
|
|
|
|
use net\authorize\api\controller\CreateCustomerProfileController;
|
2020-06-09 13:17:26 +02:00
|
|
|
use net\authorize\api\controller\CreateTransactionController;
|
2020-06-10 03:06:37 +02:00
|
|
|
use net\authorize\api\controller\GetCustomerProfileController;
|
|
|
|
use net\authorize\api\controller\GetCustomerProfileIdsController;
|
2020-06-09 13:17:26 +02:00
|
|
|
use net\authorize\api\controller\GetMerchantDetailsController;
|
2020-09-06 11:38:10 +02:00
|
|
|
use Tests\MockAccountData;
|
|
|
|
use Tests\TestCase;
|
2020-06-09 13:17:26 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @test
|
|
|
|
*/
|
|
|
|
class AuthorizeTest extends TestCase
|
|
|
|
{
|
2020-06-24 03:15:51 +02:00
|
|
|
use MockAccountData;
|
2020-06-09 13:17:26 +02:00
|
|
|
|
2020-06-24 07:20:33 +02:00
|
|
|
public $customer_profile_id = 1512373273;
|
2020-06-10 03:06:37 +02:00
|
|
|
|
2020-06-24 07:20:33 +02:00
|
|
|
public $customer_payment_profile = 1512424103;
|
2020-06-10 03:06:37 +02:00
|
|
|
|
2020-06-09 13:17:26 +02:00
|
|
|
public function setUp() :void
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
if (! config('ninja.testvars.authorize')) {
|
|
|
|
$this->markTestSkipped('authorize.net not configured');
|
|
|
|
}
|
2020-09-06 11:38:10 +02:00
|
|
|
|
|
|
|
$this->makeTestData();
|
2020-06-09 13:17:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testUnpackingVars()
|
|
|
|
{
|
|
|
|
$vars = json_decode(config('ninja.testvars.authorize'));
|
|
|
|
|
|
|
|
$this->assertTrue(property_exists($vars, 'apiLoginId'));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testCreatePublicClientKey()
|
|
|
|
{
|
2020-09-06 11:38:10 +02:00
|
|
|
error_reporting(E_ALL & ~E_DEPRECATED);
|
2020-06-09 13:17:26 +02:00
|
|
|
|
|
|
|
$vars = json_decode(config('ninja.testvars.authorize'));
|
|
|
|
|
|
|
|
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
|
|
|
|
$merchantAuthentication->setName($vars->apiLoginId);
|
|
|
|
$merchantAuthentication->setTransactionKey($vars->transactionKey);
|
|
|
|
|
|
|
|
$request = new AnetAPI\GetMerchantDetailsRequest();
|
|
|
|
$request->setMerchantAuthentication($merchantAuthentication);
|
|
|
|
|
|
|
|
$controller = new GetMerchantDetailsController($request);
|
|
|
|
|
2020-09-06 11:38:10 +02:00
|
|
|
$response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);
|
2020-06-09 13:17:26 +02:00
|
|
|
|
|
|
|
$this->assertNotNull($response->getPublicClientKey());
|
|
|
|
}
|
|
|
|
|
2020-06-10 03:06:37 +02:00
|
|
|
public function testProfileIdList()
|
|
|
|
{
|
2020-09-06 11:38:10 +02:00
|
|
|
error_reporting(E_ALL & ~E_DEPRECATED);
|
2020-06-10 03:06:37 +02:00
|
|
|
|
|
|
|
$vars = json_decode(config('ninja.testvars.authorize'));
|
|
|
|
|
|
|
|
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
|
|
|
|
$merchantAuthentication->setName($vars->apiLoginId);
|
|
|
|
$merchantAuthentication->setTransactionKey($vars->transactionKey);
|
|
|
|
|
|
|
|
// Set the transaction's refId
|
2020-09-06 11:38:10 +02:00
|
|
|
$refId = 'ref'.time();
|
2020-06-10 03:06:37 +02:00
|
|
|
|
|
|
|
// Get all existing customer profile ID's
|
|
|
|
$request = new GetCustomerProfileIdsRequest();
|
|
|
|
$request->setMerchantAuthentication($merchantAuthentication);
|
|
|
|
$controller = new GetCustomerProfileIdsController($request);
|
2020-09-06 11:38:10 +02:00
|
|
|
$response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);
|
|
|
|
if (($response != null) && ($response->getMessages()->getResultCode() == 'Ok')) {
|
|
|
|
info("GetCustomerProfileId's SUCCESS: "."\n");
|
|
|
|
info(print_r($response->getIds(), 1));
|
|
|
|
} else {
|
2020-06-10 03:06:37 +02:00
|
|
|
info("GetCustomerProfileId's ERROR : Invalid response\n");
|
|
|
|
$errorMessages = $response->getMessages()->getMessage();
|
2020-09-06 11:38:10 +02:00
|
|
|
info('Response : '.$errorMessages[0]->getCode().' '.$errorMessages[0]->getText()."\n");
|
2020-06-10 03:06:37 +02:00
|
|
|
}
|
2020-09-06 11:38:10 +02:00
|
|
|
|
2020-06-10 03:06:37 +02:00
|
|
|
$this->assertNotNull($response);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testCreateProfile()
|
|
|
|
{
|
2020-09-06 11:38:10 +02:00
|
|
|
error_reporting(E_ALL & ~E_DEPRECATED);
|
2020-06-10 03:06:37 +02:00
|
|
|
|
|
|
|
$vars = json_decode(config('ninja.testvars.authorize'));
|
|
|
|
|
|
|
|
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
|
|
|
|
$merchantAuthentication->setName($vars->apiLoginId);
|
|
|
|
$merchantAuthentication->setTransactionKey($vars->transactionKey);
|
|
|
|
|
|
|
|
// Create the Bill To info for new payment type
|
|
|
|
$billTo = new CustomerAddressType();
|
2020-09-06 11:38:10 +02:00
|
|
|
$billTo->setFirstName('Ellen');
|
|
|
|
$billTo->setLastName('Johnson');
|
|
|
|
$billTo->setCompany('Souveniropolis');
|
|
|
|
$billTo->setAddress('14 Main Street');
|
|
|
|
$billTo->setCity('Pecan Springs');
|
|
|
|
$billTo->setState('TX');
|
|
|
|
$billTo->setZip('44628');
|
|
|
|
$billTo->setCountry('USA');
|
|
|
|
$billTo->setPhoneNumber('888-888-8888');
|
|
|
|
$billTo->setfaxNumber('999-999-9999');
|
2020-06-10 03:06:37 +02:00
|
|
|
|
|
|
|
// Create a customer shipping address
|
|
|
|
$customerShippingAddress = new CustomerAddressType();
|
2020-09-06 11:38:10 +02:00
|
|
|
$customerShippingAddress->setFirstName('James');
|
|
|
|
$customerShippingAddress->setLastName('White');
|
|
|
|
$customerShippingAddress->setCompany('Addresses R Us');
|
|
|
|
$customerShippingAddress->setAddress(rand().' North Spring Street');
|
|
|
|
$customerShippingAddress->setCity('Toms River');
|
|
|
|
$customerShippingAddress->setState('NJ');
|
|
|
|
$customerShippingAddress->setZip('08753');
|
|
|
|
$customerShippingAddress->setCountry('USA');
|
|
|
|
$customerShippingAddress->setPhoneNumber('888-888-8888');
|
|
|
|
$customerShippingAddress->setFaxNumber('999-999-9999');
|
2020-06-10 03:06:37 +02:00
|
|
|
|
|
|
|
// Create an array of any shipping addresses
|
|
|
|
$shippingProfiles[] = $customerShippingAddress;
|
2020-09-06 11:38:10 +02:00
|
|
|
$refId = 'ref'.time();
|
|
|
|
$email = 'test12@gmail.com';
|
2020-06-10 03:06:37 +02:00
|
|
|
|
|
|
|
// Create a new CustomerProfileType and add the payment profile object
|
|
|
|
$customerProfile = new CustomerProfileType();
|
2020-09-06 11:38:10 +02:00
|
|
|
$customerProfile->setDescription('Customer 2 Test PHP');
|
|
|
|
$customerProfile->setMerchantCustomerId('M_'.time());
|
2020-06-10 03:06:37 +02:00
|
|
|
$customerProfile->setEmail($email);
|
|
|
|
//$customerProfile->setpaymentProfiles($paymentProfiles);
|
|
|
|
$customerProfile->setShipToList($shippingProfiles);
|
|
|
|
|
|
|
|
// Assemble the complete transaction request
|
|
|
|
$request = new AnetAPI\CreateCustomerProfileRequest();
|
|
|
|
$request->setMerchantAuthentication($merchantAuthentication);
|
|
|
|
$request->setRefId($refId);
|
|
|
|
$request->setProfile($customerProfile);
|
|
|
|
|
|
|
|
// Create the controller and get the response
|
|
|
|
$controller = new CreateCustomerProfileController($request);
|
|
|
|
$response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);
|
|
|
|
|
2020-09-06 11:38:10 +02:00
|
|
|
if (($response != null) && ($response->getMessages()->getResultCode() == 'Ok')) {
|
|
|
|
info('Succesfully created customer profile : '.$response->getCustomerProfileId()."\n");
|
|
|
|
$paymentProfiles = $response->getCustomerPaymentProfileIdList();
|
|
|
|
info(print_r($paymentProfiles, 1));
|
2020-06-10 03:06:37 +02:00
|
|
|
} else {
|
|
|
|
info("ERROR : Invalid response\n");
|
|
|
|
$errorMessages = $response->getMessages()->getMessage();
|
2020-09-06 11:38:10 +02:00
|
|
|
info('Response : '.$errorMessages[0]->getCode().' '.$errorMessages[0]->getText()."\n");
|
2020-06-10 03:06:37 +02:00
|
|
|
}
|
2020-06-24 07:20:33 +02:00
|
|
|
|
2020-09-06 11:38:10 +02:00
|
|
|
info('the new customer profile id = '.$response->getCustomerProfileId());
|
2020-06-10 03:06:37 +02:00
|
|
|
|
2020-09-06 11:38:10 +02:00
|
|
|
$this->assertNotNull($response);
|
2020-06-10 03:06:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetCustomerProfileId()
|
|
|
|
{
|
2020-09-06 11:38:10 +02:00
|
|
|
error_reporting(E_ALL & ~E_DEPRECATED);
|
2020-06-10 03:06:37 +02:00
|
|
|
|
|
|
|
$vars = json_decode(config('ninja.testvars.authorize'));
|
|
|
|
|
|
|
|
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
|
|
|
|
$merchantAuthentication->setName($vars->apiLoginId);
|
|
|
|
$merchantAuthentication->setTransactionKey($vars->transactionKey);
|
|
|
|
|
2020-09-06 11:38:10 +02:00
|
|
|
$request = new GetCustomerProfileRequest();
|
|
|
|
$request->setMerchantAuthentication($merchantAuthentication);
|
|
|
|
$request->setCustomerProfileId($this->customer_profile_id);
|
|
|
|
$controller = new GetCustomerProfileController($request);
|
|
|
|
$response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);
|
2020-06-10 03:06:37 +02:00
|
|
|
|
2020-09-06 11:38:10 +02:00
|
|
|
if (($response != null) && ($response->getMessages()->getResultCode() == 'Ok')) {
|
|
|
|
info('got profile');
|
|
|
|
info(print_r($response->getProfile(), 1));
|
2020-06-10 03:06:37 +02:00
|
|
|
} else {
|
|
|
|
info("ERROR : Invalid response\n");
|
|
|
|
}
|
2020-09-06 11:38:10 +02:00
|
|
|
|
2020-06-10 03:06:37 +02:00
|
|
|
$this->assertNotNull($response);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testCreateCustomerPaymentProfile()
|
|
|
|
{
|
2020-09-06 11:38:10 +02:00
|
|
|
info('test create customer payment profile');
|
2020-06-10 03:06:37 +02:00
|
|
|
|
2020-09-06 11:38:10 +02:00
|
|
|
error_reporting(E_ALL & ~E_DEPRECATED);
|
2020-06-10 03:06:37 +02:00
|
|
|
|
|
|
|
$vars = json_decode(config('ninja.testvars.authorize'));
|
|
|
|
|
|
|
|
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
|
|
|
|
$merchantAuthentication->setName($vars->apiLoginId);
|
|
|
|
$merchantAuthentication->setTransactionKey($vars->transactionKey);
|
2020-09-06 11:38:10 +02:00
|
|
|
|
2020-06-10 03:06:37 +02:00
|
|
|
// Set the transaction's refId
|
2020-09-06 11:38:10 +02:00
|
|
|
$refId = 'ref'.time();
|
2020-06-10 03:06:37 +02:00
|
|
|
|
|
|
|
// Set credit card information for payment profile
|
|
|
|
$creditCard = new CreditCardType();
|
2020-09-06 11:38:10 +02:00
|
|
|
$creditCard->setCardNumber('4111111111111111');
|
|
|
|
$creditCard->setExpirationDate('2024-01');
|
|
|
|
$creditCard->setCardCode('100');
|
2020-06-10 03:06:37 +02:00
|
|
|
$paymentCreditCard = new PaymentType();
|
|
|
|
$paymentCreditCard->setCreditCard($creditCard);
|
|
|
|
|
|
|
|
// Create the Bill To info for new payment type
|
|
|
|
$billto = new CustomerAddressType();
|
2020-09-06 11:38:10 +02:00
|
|
|
$billto->setFirstName('Elas');
|
|
|
|
$billto->setLastName('Joson');
|
|
|
|
$billto->setCompany('Souveniropolis');
|
|
|
|
$billto->setAddress('14 Main Street');
|
|
|
|
$billto->setCity('Pecan Springs');
|
|
|
|
$billto->setState('TX');
|
|
|
|
$billto->setZip('44628');
|
|
|
|
$billto->setCountry('USA');
|
|
|
|
$billto->setPhoneNumber('999-999-9999');
|
|
|
|
$billto->setfaxNumber('999-999-9999');
|
2020-06-10 03:06:37 +02:00
|
|
|
|
|
|
|
// Create a new Customer Payment Profile object
|
|
|
|
$paymentprofile = new CustomerPaymentProfileType();
|
|
|
|
$paymentprofile->setCustomerType('individual');
|
|
|
|
$paymentprofile->setBillTo($billto);
|
|
|
|
$paymentprofile->setPayment($paymentCreditCard);
|
|
|
|
$paymentprofile->setDefaultPaymentProfile(true);
|
|
|
|
|
|
|
|
$paymentprofiles[] = $paymentprofile;
|
|
|
|
|
|
|
|
// Assemble the complete transaction request
|
|
|
|
$paymentprofilerequest = new CreateCustomerPaymentProfileRequest();
|
|
|
|
$paymentprofilerequest->setMerchantAuthentication($merchantAuthentication);
|
|
|
|
|
|
|
|
// Add an existing profile id to the request
|
|
|
|
$paymentprofilerequest->setCustomerProfileId($this->customer_profile_id);
|
|
|
|
$paymentprofilerequest->setPaymentProfile($paymentprofile);
|
2020-09-06 11:38:10 +02:00
|
|
|
$paymentprofilerequest->setValidationMode('liveMode');
|
2020-06-10 03:06:37 +02:00
|
|
|
|
|
|
|
// Create the controller and get the response
|
|
|
|
$controller = new CreateCustomerPaymentProfileController($paymentprofilerequest);
|
|
|
|
$response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);
|
|
|
|
|
2020-09-06 11:38:10 +02:00
|
|
|
if (($response != null) && ($response->getMessages()->getResultCode() == 'Ok')) {
|
|
|
|
info('Create Customer Payment Profile SUCCESS: '.$response->getCustomerPaymentProfileId()."\n");
|
2020-06-10 03:06:37 +02:00
|
|
|
} else {
|
|
|
|
info("Create Customer Payment Profile: ERROR Invalid response\n");
|
|
|
|
$errorMessages = $response->getMessages()->getMessage();
|
2020-09-06 11:38:10 +02:00
|
|
|
info('Response : '.$errorMessages[0]->getCode().' '.$errorMessages[0]->getText()."\n");
|
2020-06-10 03:06:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->assertNotNull($response);
|
|
|
|
}
|
|
|
|
|
2020-09-06 11:38:10 +02:00
|
|
|
public function testChargeCustomerProfile()
|
2020-06-10 03:06:37 +02:00
|
|
|
{
|
2020-09-06 11:38:10 +02:00
|
|
|
error_reporting(E_ALL & ~E_DEPRECATED);
|
2020-06-10 03:06:37 +02:00
|
|
|
|
|
|
|
$vars = json_decode(config('ninja.testvars.authorize'));
|
|
|
|
|
|
|
|
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
|
|
|
|
$merchantAuthentication->setName($vars->apiLoginId);
|
|
|
|
$merchantAuthentication->setTransactionKey($vars->transactionKey);
|
2020-09-06 11:38:10 +02:00
|
|
|
|
2020-06-10 03:06:37 +02:00
|
|
|
// Set the transaction's refId
|
2020-09-06 11:38:10 +02:00
|
|
|
$refId = 'ref'.time();
|
2020-06-10 03:06:37 +02:00
|
|
|
|
|
|
|
$profileToCharge = new CustomerProfilePaymentType();
|
|
|
|
$profileToCharge->setCustomerProfileId($this->customer_profile_id);
|
|
|
|
$paymentProfile = new PaymentProfileType();
|
|
|
|
$paymentProfile->setPaymentProfileId($this->customer_payment_profile);
|
|
|
|
$profileToCharge->setPaymentProfile($paymentProfile);
|
|
|
|
|
|
|
|
$transactionRequestType = new TransactionRequestType();
|
2020-09-06 11:38:10 +02:00
|
|
|
$transactionRequestType->setTransactionType('authCaptureTransaction');
|
2020-06-24 07:20:33 +02:00
|
|
|
$transactionRequestType->setAmount(350);
|
2020-06-10 03:06:37 +02:00
|
|
|
$transactionRequestType->setProfile($profileToCharge);
|
|
|
|
|
|
|
|
$request = new CreateTransactionRequest();
|
|
|
|
$request->setMerchantAuthentication($merchantAuthentication);
|
2020-09-06 11:38:10 +02:00
|
|
|
$request->setRefId($refId);
|
|
|
|
$request->setTransactionRequest($transactionRequestType);
|
2020-06-10 03:06:37 +02:00
|
|
|
$controller = new CreateTransactionController($request);
|
2020-09-06 11:38:10 +02:00
|
|
|
$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) {
|
|
|
|
info(' Transaction Response code : '.$tresponse->getResponseCode()."\n");
|
|
|
|
info('Charge Customer Profile APPROVED :'."\n");
|
|
|
|
info(' Charge Customer Profile AUTH CODE : '.$tresponse->getAuthCode()."\n");
|
|
|
|
info(' Charge Customer Profile TRANS ID : '.$tresponse->getTransId()."\n");
|
|
|
|
info(' Code : '.$tresponse->getMessages()[0]->getCode()."\n");
|
|
|
|
info(' Description : '.$tresponse->getMessages()[0]->getDescription()."\n");
|
|
|
|
} else {
|
|
|
|
info("Transaction Failed \n");
|
|
|
|
if ($tresponse->getErrors() != null) {
|
|
|
|
info(' Error code : '.$tresponse->getErrors()[0]->getErrorCode()."\n");
|
|
|
|
info(' Error message : '.$tresponse->getErrors()[0]->getErrorText()."\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
info("Transaction Failed \n");
|
|
|
|
$tresponse = $response->getTransactionResponse();
|
|
|
|
if ($tresponse != null && $tresponse->getErrors() != null) {
|
|
|
|
info(' Error code : '.$tresponse->getErrors()[0]->getErrorCode()."\n");
|
|
|
|
info(' Error message : '.$tresponse->getErrors()[0]->getErrorText()."\n");
|
|
|
|
} else {
|
|
|
|
info(' Error code : '.$response->getMessages()->getMessage()[0]->getCode()."\n");
|
|
|
|
info(' Error message : '.$response->getMessages()->getMessage()[0]->getText()."\n");
|
|
|
|
}
|
2020-06-10 03:06:37 +02:00
|
|
|
}
|
2020-09-06 11:38:10 +02:00
|
|
|
} else {
|
|
|
|
info("No response returned \n");
|
2020-06-10 03:06:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->assertNotNull($response);
|
2020-06-24 03:15:51 +02:00
|
|
|
|
|
|
|
$this->assertNotNull($tresponse);
|
|
|
|
|
2020-06-24 07:20:33 +02:00
|
|
|
/* Testing refunds - need to research more as payments are in a pending state so cannot be 'refunded'*/
|
|
|
|
|
|
|
|
// info("transaction reference = " . $tresponse->getTransId());
|
2020-09-06 11:38:10 +02:00
|
|
|
|
2020-06-24 07:20:33 +02:00
|
|
|
// $payment = PaymentFactory::create($this->company->id, $this->user->id);
|
|
|
|
// $payment->amount = 400;
|
|
|
|
// $payment->client_id = $this->client->id;
|
|
|
|
// $payment->date = now();
|
|
|
|
// $payment->transaction_reference = $tresponse->getTransId();
|
|
|
|
// $payment->company_gateway_id = 1;
|
|
|
|
|
|
|
|
// $payment->save();
|
2020-06-24 03:15:51 +02:00
|
|
|
|
2020-06-24 07:20:33 +02:00
|
|
|
// $company_gateway = CompanyGateway::where('gateway_key', '3b6621f970ab18887c4f6dca78d3f8bb')->first();
|
2020-06-24 03:15:51 +02:00
|
|
|
|
2020-06-24 07:20:33 +02:00
|
|
|
// $authorize_payment_driver = new AuthorizePaymentDriver($company_gateway, $this->client);
|
|
|
|
// $response = $authorize_payment_driver->refund($payment, 350);
|
2020-06-24 03:15:51 +02:00
|
|
|
|
2020-06-24 07:20:33 +02:00
|
|
|
// info(print_r($response,1));
|
2020-06-24 03:15:51 +02:00
|
|
|
|
2020-06-24 07:20:33 +02:00
|
|
|
// $this->assertTrue(is_array($response));
|
2020-09-06 11:38:10 +02:00
|
|
|
}
|
2020-06-09 13:17:26 +02:00
|
|
|
}
|