allow vendord
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
This commit is contained in:
48
vendor/omnipay/paypal/tests/Message/CaptureRequestTest.php
vendored
Normal file
48
vendor/omnipay/paypal/tests/Message/CaptureRequestTest.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\PayPal\Message\CaptureRequest;
|
||||
use Omnipay\Tests\TestCase;
|
||||
|
||||
class CaptureRequestTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var \Omnipay\PayPal\Message\CaptureRequest
|
||||
*/
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$client = $this->getHttpClient();
|
||||
$request = $this->getHttpRequest();
|
||||
$this->request = new CaptureRequest($client, $request);
|
||||
}
|
||||
|
||||
public function testGetData()
|
||||
{
|
||||
$this->request->setTransactionReference('ABC-123');
|
||||
$this->request->setAmount('1.23');
|
||||
$this->request->setCurrency('USD');
|
||||
$this->request->setUsername('testuser');
|
||||
$this->request->setPassword('testpass');
|
||||
$this->request->setSignature('SIG');
|
||||
$this->request->setSubject('SUB');
|
||||
$this->request->setButtonSource('BNCode_PP');
|
||||
|
||||
$expected = array();
|
||||
$expected['METHOD'] = 'DoCapture';
|
||||
$expected['AUTHORIZATIONID'] = 'ABC-123';
|
||||
$expected['AMT'] = '1.23';
|
||||
$expected['CURRENCYCODE'] = 'USD';
|
||||
$expected['COMPLETETYPE'] = 'Complete';
|
||||
$expected['USER'] = 'testuser';
|
||||
$expected['PWD'] = 'testpass';
|
||||
$expected['SIGNATURE'] = 'SIG';
|
||||
$expected['SUBJECT'] = 'SUB';
|
||||
$expected['BUTTONSOURCE'] = 'BNCode_PP';
|
||||
$expected['VERSION'] = CaptureRequest::API_VERSION;
|
||||
|
||||
$this->assertEquals($expected, $this->request->getData());
|
||||
}
|
||||
}
|
||||
416
vendor/omnipay/paypal/tests/Message/ExpressAuthorizeRequestTest.php
vendored
Normal file
416
vendor/omnipay/paypal/tests/Message/ExpressAuthorizeRequestTest.php
vendored
Normal file
@@ -0,0 +1,416 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Common\CreditCard;
|
||||
use Omnipay\Common\Exception\InvalidRequestException;
|
||||
use Omnipay\PayPal\Message\ExpressAuthorizeRequest;
|
||||
use Omnipay\PayPal\Support\InstantUpdateApi\BillingAgreement;
|
||||
use Omnipay\PayPal\Support\InstantUpdateApi\ShippingOption;
|
||||
use Omnipay\Tests\TestCase;
|
||||
|
||||
class ExpressAuthorizeRequestTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var ExpressAuthorizeRequest
|
||||
*/
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->request = new ExpressAuthorizeRequest($this->getHttpClient(), $this->getHttpRequest());
|
||||
$this->request->initialize(
|
||||
array(
|
||||
'amount' => '10.00',
|
||||
'returnUrl' => 'https://www.example.com/return',
|
||||
'cancelUrl' => 'https://www.example.com/cancel',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetDataWithoutCard()
|
||||
{
|
||||
$this->request->initialize(array(
|
||||
'amount' => '10.00',
|
||||
'currency' => 'AUD',
|
||||
'transactionId' => '111',
|
||||
'description' => 'Order Description',
|
||||
'returnUrl' => 'https://www.example.com/return',
|
||||
'cancelUrl' => 'https://www.example.com/cancel',
|
||||
'subject' => 'demo@example.com',
|
||||
'headerImageUrl' => 'https://www.example.com/header.jpg',
|
||||
'noShipping' => 0,
|
||||
'localeCode' => 'EN',
|
||||
'allowNote' => 0,
|
||||
'addressOverride' => 0,
|
||||
'brandName' => 'Dunder Mifflin Paper Company, Inc.',
|
||||
'customerServiceNumber' => '1-801-FLOWERS',
|
||||
));
|
||||
|
||||
$data = $this->request->getData();
|
||||
|
||||
$this->assertSame('10.00', $data['PAYMENTREQUEST_0_AMT']);
|
||||
$this->assertSame('AUD', $data['PAYMENTREQUEST_0_CURRENCYCODE']);
|
||||
$this->assertSame('111', $data['PAYMENTREQUEST_0_INVNUM']);
|
||||
$this->assertSame('Order Description', $data['PAYMENTREQUEST_0_DESC']);
|
||||
$this->assertSame('https://www.example.com/return', $data['RETURNURL']);
|
||||
$this->assertSame('https://www.example.com/cancel', $data['CANCELURL']);
|
||||
$this->assertSame('demo@example.com', $data['SUBJECT']);
|
||||
$this->assertSame('https://www.example.com/header.jpg', $data['HDRIMG']);
|
||||
$this->assertSame(0, $data['NOSHIPPING']);
|
||||
$this->assertSame(0, $data['ALLOWNOTE']);
|
||||
$this->assertSame('EN', $data['LOCALECODE']);
|
||||
$this->assertSame(0, $data['ADDROVERRIDE']);
|
||||
$this->assertSame('Dunder Mifflin Paper Company, Inc.', $data['BRANDNAME']);
|
||||
$this->assertSame('1-801-FLOWERS', $data['CUSTOMERSERVICENUMBER']);
|
||||
}
|
||||
|
||||
public function testGetDataWithCard()
|
||||
{
|
||||
$this->request->initialize(array(
|
||||
'amount' => '10.00',
|
||||
'currency' => 'AUD',
|
||||
'transactionId' => '111',
|
||||
'description' => 'Order Description',
|
||||
'returnUrl' => 'https://www.example.com/return',
|
||||
'cancelUrl' => 'https://www.example.com/cancel',
|
||||
'subject' => 'demo@example.com',
|
||||
'headerImageUrl' => 'https://www.example.com/header.jpg',
|
||||
'noShipping' => 2,
|
||||
'allowNote' => 1,
|
||||
'addressOverride' => 1,
|
||||
'brandName' => 'Dunder Mifflin Paper Company, Inc.',
|
||||
'maxAmount' => 123.45,
|
||||
'logoImageUrl' => 'https://www.example.com/logo.jpg',
|
||||
'borderColor' => 'CCCCCC',
|
||||
'localeCode' => 'EN',
|
||||
'customerServiceNumber' => '1-801-FLOWERS',
|
||||
'sellerPaypalAccountId' => 'billing@example.com',
|
||||
));
|
||||
|
||||
$card = new CreditCard(array(
|
||||
'name' => 'John Doe',
|
||||
'address1' => '123 NW Blvd',
|
||||
'address2' => 'Lynx Lane',
|
||||
'city' => 'Topeka',
|
||||
'state' => 'KS',
|
||||
'country' => 'USA',
|
||||
'postcode' => '66605',
|
||||
'phone' => '555-555-5555',
|
||||
'email' => 'test@email.com',
|
||||
));
|
||||
$this->request->setCard($card);
|
||||
|
||||
$expected = array(
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
'VERSION' => ExpressAuthorizeRequest::API_VERSION,
|
||||
'USER' => null,
|
||||
'PWD' => null,
|
||||
'SIGNATURE' => null,
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Authorization',
|
||||
'SOLUTIONTYPE' => null,
|
||||
'LANDINGPAGE' => null,
|
||||
'NOSHIPPING' => 2,
|
||||
'ALLOWNOTE' => 1,
|
||||
'ADDROVERRIDE' => 1,
|
||||
'PAYMENTREQUEST_0_AMT' => '10.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'AUD',
|
||||
'PAYMENTREQUEST_0_INVNUM' => '111',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Order Description',
|
||||
'RETURNURL' => 'https://www.example.com/return',
|
||||
'CANCELURL' => 'https://www.example.com/cancel',
|
||||
'SUBJECT' => 'demo@example.com',
|
||||
'HDRIMG' => 'https://www.example.com/header.jpg',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => '123 NW Blvd',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET2' => 'Lynx Lane',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Topeka',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTATE' => 'KS',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'USA',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '66605',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '555-555-5555',
|
||||
'EMAIL' => 'test@email.com',
|
||||
'BRANDNAME' => 'Dunder Mifflin Paper Company, Inc.',
|
||||
'MAXAMT' => 123.45,
|
||||
'PAYMENTREQUEST_0_TAXAMT' => null,
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => null,
|
||||
'PAYMENTREQUEST_0_HANDLINGAMT' => null,
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => null,
|
||||
'PAYMENTREQUEST_0_INSURANCEAMT' => null,
|
||||
'LOGOIMG' => 'https://www.example.com/logo.jpg',
|
||||
'CARTBORDERCOLOR' => 'CCCCCC',
|
||||
'LOCALECODE' => 'EN',
|
||||
'CUSTOMERSERVICENUMBER' => '1-801-FLOWERS',
|
||||
'PAYMENTREQUEST_0_SELLERPAYPALACCOUNTID' => 'billing@example.com',
|
||||
);
|
||||
|
||||
$this->assertEquals($expected, $this->request->getData());
|
||||
}
|
||||
|
||||
public function testGetDataWithItems()
|
||||
{
|
||||
$this->request->setItems(array(
|
||||
array('name' => 'Floppy Disk', 'description' => 'MS-DOS', 'quantity' => 2, 'price' => 10, 'code' => '123456'),
|
||||
array('name' => 'CD-ROM', 'description' => 'Windows 95', 'quantity' => 1, 'price' => 40),
|
||||
));
|
||||
|
||||
$data = $this->request->getData();
|
||||
$this->assertSame('Floppy Disk', $data['L_PAYMENTREQUEST_0_NAME0']);
|
||||
$this->assertSame('MS-DOS', $data['L_PAYMENTREQUEST_0_DESC0']);
|
||||
$this->assertSame(2, $data['L_PAYMENTREQUEST_0_QTY0']);
|
||||
$this->assertSame('10.00', $data['L_PAYMENTREQUEST_0_AMT0']);
|
||||
$this->assertSame('123456', $data['L_PAYMENTREQUEST_0_NUMBER0']);
|
||||
|
||||
$this->assertSame('CD-ROM', $data['L_PAYMENTREQUEST_0_NAME1']);
|
||||
$this->assertSame('Windows 95', $data['L_PAYMENTREQUEST_0_DESC1']);
|
||||
$this->assertSame(1, $data['L_PAYMENTREQUEST_0_QTY1']);
|
||||
$this->assertSame('40.00', $data['L_PAYMENTREQUEST_0_AMT1']);
|
||||
|
||||
$this->assertSame('60.00', $data['PAYMENTREQUEST_0_ITEMAMT']);
|
||||
}
|
||||
|
||||
public function testGetDataWithExtraOrderDetails()
|
||||
{
|
||||
$this->request->initialize(array(
|
||||
'amount' => '10.00',
|
||||
'currency' => 'AUD',
|
||||
'transactionId' => '111',
|
||||
'description' => 'Order Description',
|
||||
'returnUrl' => 'https://www.example.com/return',
|
||||
'cancelUrl' => 'https://www.example.com/cancel',
|
||||
'subject' => 'demo@example.com',
|
||||
'headerImageUrl' => 'https://www.example.com/header.jpg',
|
||||
'noShipping' => 0,
|
||||
'allowNote' => 0,
|
||||
'addressOverride' => 0,
|
||||
'brandName' => 'Dunder Mifflin Paper Company, Inc.',
|
||||
'taxAmount' => '2.00',
|
||||
'shippingAmount' => '5.00',
|
||||
'handlingAmount' => '1.00',
|
||||
'shippingDiscount' => '-1.00',
|
||||
'insuranceAmount' => '3.00',
|
||||
));
|
||||
|
||||
$data = $this->request->getData();
|
||||
$this->assertSame('2.00', $data['PAYMENTREQUEST_0_TAXAMT']);
|
||||
$this->assertSame('5.00', $data['PAYMENTREQUEST_0_SHIPPINGAMT']);
|
||||
$this->assertSame('1.00', $data['PAYMENTREQUEST_0_HANDLINGAMT']);
|
||||
$this->assertSame('-1.00', $data['PAYMENTREQUEST_0_SHIPDISCAMT']);
|
||||
$this->assertSame('3.00', $data['PAYMENTREQUEST_0_INSURANCEAMT']);
|
||||
}
|
||||
|
||||
public function testHeaderImageUrl()
|
||||
{
|
||||
$this->assertSame($this->request, $this->request->setHeaderImageUrl('https://www.example.com/header.jpg'));
|
||||
$this->assertSame('https://www.example.com/header.jpg', $this->request->getHeaderImageUrl());
|
||||
|
||||
$data = $this->request->getData();
|
||||
$this->assertEquals('https://www.example.com/header.jpg', $data['HDRIMG']);
|
||||
}
|
||||
|
||||
public function testMaxAmount()
|
||||
{
|
||||
$this->request->setMaxAmount(321.54);
|
||||
|
||||
$this->assertSame(321.54, $this->request->getMaxAmount());
|
||||
|
||||
$data = $this->request->getData();
|
||||
|
||||
$this->assertSame(321.54, $data['MAXAMT']);
|
||||
}
|
||||
|
||||
public function testDataWithCallback()
|
||||
{
|
||||
$baseData = array(
|
||||
'amount' => '10.00',
|
||||
'currency' => 'AUD',
|
||||
'transactionId' => '111',
|
||||
'description' => 'Order Description',
|
||||
'returnUrl' => 'https://www.example.com/return',
|
||||
'cancelUrl' => 'https://www.example.com/cancel',
|
||||
'subject' => 'demo@example.com',
|
||||
'headerImageUrl' => 'https://www.example.com/header.jpg',
|
||||
'allowNote' => 0,
|
||||
'addressOverride' => 0,
|
||||
'brandName' => 'Dunder Mifflin Paper Company, Incy.',
|
||||
);
|
||||
|
||||
$shippingOptions = array(
|
||||
new ShippingOption('First Class', 1.20, true, '1-2 days'),
|
||||
new ShippingOption('Second Class', 0.70, false, '3-5 days'),
|
||||
new ShippingOption('International', 3.50),
|
||||
);
|
||||
|
||||
// with a default callback timeout
|
||||
$this->request->initialize(array_merge($baseData, array(
|
||||
'callback' => 'https://www.example.com/calculate-shipping',
|
||||
'shippingOptions' => $shippingOptions,
|
||||
)));
|
||||
|
||||
$data = $this->request->getData();
|
||||
$this->assertSame('https://www.example.com/calculate-shipping', $data['CALLBACK']);
|
||||
$this->assertSame(ExpressAuthorizeRequest::DEFAULT_CALLBACK_TIMEOUT, $data['CALLBACKTIMEOUT']);
|
||||
|
||||
$this->assertSame('First Class', $data['L_SHIPPINGOPTIONNAME0']);
|
||||
$this->assertSame('1.20', $data['L_SHIPPINGOPTIONAMOUNT0']);
|
||||
$this->assertSame('1', $data['L_SHIPPINGOPTIONISDEFAULT0']);
|
||||
$this->assertSame('1-2 days', $data['L_SHIPPINGOPTIONLABEL0']);
|
||||
|
||||
$this->assertSame('Second Class', $data['L_SHIPPINGOPTIONNAME1']);
|
||||
$this->assertSame('0.70', $data['L_SHIPPINGOPTIONAMOUNT1']);
|
||||
$this->assertSame('0', $data['L_SHIPPINGOPTIONISDEFAULT1']);
|
||||
$this->assertSame('3-5 days', $data['L_SHIPPINGOPTIONLABEL1']);
|
||||
|
||||
$this->assertSame('International', $data['L_SHIPPINGOPTIONNAME2']);
|
||||
$this->assertSame('3.50', $data['L_SHIPPINGOPTIONAMOUNT2']);
|
||||
$this->assertSame('0', $data['L_SHIPPINGOPTIONISDEFAULT2']);
|
||||
|
||||
// with a defined callback timeout
|
||||
$this->request->initialize(array_merge($baseData, array(
|
||||
'callback' => 'https://www.example.com/calculate-shipping',
|
||||
'callbackTimeout' => 10,
|
||||
'shippingOptions' => $shippingOptions,
|
||||
)));
|
||||
|
||||
$data = $this->request->getData();
|
||||
$this->assertSame('https://www.example.com/calculate-shipping', $data['CALLBACK']);
|
||||
$this->assertSame(10, $data['CALLBACKTIMEOUT']);
|
||||
}
|
||||
|
||||
public function testDataWithCallbackAndNoDefaultShippingOption()
|
||||
{
|
||||
$baseData = array(
|
||||
'amount' => '10.00',
|
||||
'currency' => 'AUD',
|
||||
'transactionId' => '111',
|
||||
'description' => 'Order Description',
|
||||
'returnUrl' => 'https://www.example.com/return',
|
||||
'cancelUrl' => 'https://www.example.com/cancel',
|
||||
'subject' => 'demo@example.com',
|
||||
'headerImageUrl' => 'https://www.example.com/header.jpg',
|
||||
'allowNote' => 0,
|
||||
'addressOverride' => 0,
|
||||
'brandName' => 'Dunder Mifflin Paper Company, Incy.',
|
||||
);
|
||||
|
||||
$shippingOptions = array(
|
||||
new ShippingOption('First Class', 1.20, false, '1-2 days'),
|
||||
new ShippingOption('Second Class', 0.70, false, '3-5 days'),
|
||||
new ShippingOption('International', 3.50),
|
||||
);
|
||||
|
||||
// with a default callback timeout
|
||||
$this->request->initialize(array_merge($baseData, array(
|
||||
'callback' => 'https://www.example.com/calculate-shipping',
|
||||
'shippingOptions' => $shippingOptions,
|
||||
)));
|
||||
|
||||
$this->expectException(InvalidRequestException::class);
|
||||
$this->expectExceptionMessage('One of the supplied shipping options must be set as default');
|
||||
|
||||
$this->request->getData();
|
||||
}
|
||||
|
||||
public function testNoAmount()
|
||||
{
|
||||
$baseData = array(// nothing here - should cause a certain exception
|
||||
);
|
||||
|
||||
$this->request->initialize($baseData);
|
||||
|
||||
$this->expectException(InvalidRequestException::class);
|
||||
$this->expectExceptionMessage('The amount parameter is required');
|
||||
|
||||
$this->request->getData();
|
||||
}
|
||||
|
||||
public function testAmountButNoReturnUrl()
|
||||
{
|
||||
$baseData = array(
|
||||
'amount' => 10.00,
|
||||
);
|
||||
|
||||
$this->request->initialize($baseData);
|
||||
|
||||
$this->expectException(InvalidRequestException::class);
|
||||
$this->expectExceptionMessage('The returnUrl parameter is required');
|
||||
|
||||
$this->request->getData();
|
||||
}
|
||||
|
||||
public function testBadCallbackConfiguration()
|
||||
{
|
||||
$baseData = array(
|
||||
'amount' => '10.00',
|
||||
'currency' => 'AUD',
|
||||
'transactionId' => '111',
|
||||
'description' => 'Order Description',
|
||||
'returnUrl' => 'https://www.example.com/return',
|
||||
'cancelUrl' => 'https://www.example.com/cancel',
|
||||
'subject' => 'demo@example.com',
|
||||
'headerImageUrl' => 'https://www.example.com/header.jpg',
|
||||
'allowNote' => 0,
|
||||
'addressOverride' => 0,
|
||||
'brandName' => 'Dunder Mifflin Paper Company, Incy.',
|
||||
);
|
||||
|
||||
$this->request->initialize(array_merge($baseData, array(
|
||||
'callback' => 'https://www.example.com/calculate-shipping',
|
||||
)));
|
||||
|
||||
// from the docblock on this exception -
|
||||
// Thrown when a request is invalid or missing required fields.
|
||||
// callback has been set but no shipping options so expect one of these:
|
||||
$this->expectException(InvalidRequestException::class);
|
||||
|
||||
$this->request->getData();
|
||||
}
|
||||
|
||||
public function testGetDataWithSingleBillingAgreement()
|
||||
{
|
||||
$billingAgreement = new BillingAgreement(false, 'Some Stuff');
|
||||
$this->request->setBillingAgreement($billingAgreement);
|
||||
|
||||
$data = $this->request->getData();
|
||||
|
||||
$this->assertSame('MerchantInitiatedBillingSingleAgreement', $data['L_BILLINGTYPE0']);
|
||||
$this->assertSame('Some Stuff', $data['L_BILLINGAGREEMENTDESCRIPTION0']);
|
||||
}
|
||||
|
||||
public function testGetDataWithRecurringBillingAgreement()
|
||||
{
|
||||
$billingAgreement = new BillingAgreement(true, 'Some Stuff');
|
||||
$this->request->setBillingAgreement($billingAgreement);
|
||||
|
||||
$data = $this->request->getData();
|
||||
|
||||
$this->assertSame('MerchantInitiatedBilling', $data['L_BILLINGTYPE0']);
|
||||
$this->assertSame('Some Stuff', $data['L_BILLINGAGREEMENTDESCRIPTION0']);
|
||||
}
|
||||
|
||||
public function testGetDataWithBillingAgreementOptionalParameters()
|
||||
{
|
||||
$billingAgreement = new BillingAgreement(true, 'Some Stuff', 'InstantOnly', 'Some custom annotation');
|
||||
$this->request->setBillingAgreement($billingAgreement);
|
||||
|
||||
$data = $this->request->getData();
|
||||
|
||||
$this->assertSame('MerchantInitiatedBilling', $data['L_BILLINGTYPE0']);
|
||||
$this->assertSame('Some Stuff', $data['L_BILLINGAGREEMENTDESCRIPTION0']);
|
||||
$this->assertSame('InstantOnly', $data['L_PAYMENTTYPE0']);
|
||||
$this->assertSame('Some custom annotation', $data['L_BILLINGAGREEMENTCUSTOM0']);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function testGetDataWithBillingAgreementWrongPaymentType()
|
||||
{
|
||||
$this->expectException(InvalidRequestException::class);
|
||||
$this->expectExceptionMessage("The 'paymentType' parameter can be only 'Any' or 'InstantOnly'");
|
||||
|
||||
$billingAgreement = new BillingAgreement(false, 'Some Stuff', 'BadType', 'Some custom annotation');
|
||||
}
|
||||
}
|
||||
45
vendor/omnipay/paypal/tests/Message/ExpressAuthorizeResponseTest.php
vendored
Normal file
45
vendor/omnipay/paypal/tests/Message/ExpressAuthorizeResponseTest.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Tests\TestCase;
|
||||
use Omnipay\PayPal\Message\ExpressAuthorizeResponse;
|
||||
|
||||
class ExpressAuthorizeResponseTest extends TestCase
|
||||
{
|
||||
public function testConstruct()
|
||||
{
|
||||
// response should decode URL format data
|
||||
$response = new ExpressAuthorizeResponse($this->getMockRequest(), 'example=value&foo=bar');
|
||||
|
||||
$this->assertEquals(array('example' => 'value', 'foo' => 'bar'), $response->getData());
|
||||
}
|
||||
|
||||
public function testExpressPurchaseSuccess()
|
||||
{
|
||||
$httpResponse = $this->getMockHttpResponse('ExpressPurchaseSuccess.txt');
|
||||
$request = $this->getMockRequest();
|
||||
$request->shouldReceive('getTestMode')->once()->andReturn(true);
|
||||
$response = new ExpressAuthorizeResponse($request, $httpResponse->getBody());
|
||||
|
||||
$this->assertFalse($response->isPending());
|
||||
$this->assertFalse($response->isSuccessful());
|
||||
$this->assertSame('EC-42721413K79637829', $response->getTransactionReference());
|
||||
$this->assertNull($response->getMessage());
|
||||
$this->assertNull($response->getRedirectData());
|
||||
$this->assertSame('https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&useraction=commit&token=EC-42721413K79637829', $response->getRedirectUrl());
|
||||
$this->assertSame('GET', $response->getRedirectMethod());
|
||||
}
|
||||
|
||||
public function testExpressPurchaseFailure()
|
||||
{
|
||||
$httpResponse = $this->getMockHttpResponse('ExpressPurchaseFailure.txt');
|
||||
$response = new ExpressAuthorizeResponse($this->getMockRequest(), $httpResponse->getBody());
|
||||
|
||||
$this->assertFalse($response->isPending());
|
||||
$this->assertFalse($response->isSuccessful());
|
||||
$this->assertNull($response->getTransactionReference());
|
||||
$this->assertNull($response->getTransactionReference());
|
||||
$this->assertSame('This transaction cannot be processed. The amount to be charged is zero.', $response->getMessage());
|
||||
}
|
||||
}
|
||||
96
vendor/omnipay/paypal/tests/Message/ExpressCompleteAuthorizeRequestTest.php
vendored
Normal file
96
vendor/omnipay/paypal/tests/Message/ExpressCompleteAuthorizeRequestTest.php
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\PayPal\Message\ExpressCompleteAuthorizeRequest;
|
||||
use Omnipay\Tests\TestCase;
|
||||
|
||||
class ExpressCompleteAuthorizeRequestTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var \Omnipay\PayPal\Message\ExpressCompleteAuthorizeRequest
|
||||
*/
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$client = $this->getHttpClient();
|
||||
|
||||
$request = $this->getHttpRequest();
|
||||
$request->query->set('PayerID', 'Payer-1234');
|
||||
$request->query->set('token', 'TOKEN1234');
|
||||
|
||||
$this->request = new ExpressCompleteAuthorizeRequest($client, $request);
|
||||
}
|
||||
|
||||
public function testGetData()
|
||||
{
|
||||
$this->request->setAmount('1.23');
|
||||
$this->request->setCurrency('USD');
|
||||
$this->request->setTransactionId('ABC-123');
|
||||
$this->request->setUsername('testuser');
|
||||
$this->request->setPassword('testpass');
|
||||
$this->request->setSignature('SIG');
|
||||
$this->request->setSubject('SUB');
|
||||
$this->request->setDescription('DESC');
|
||||
$this->request->setNotifyUrl('https://www.example.com/notify');
|
||||
$this->request->setMaxAmount('0.00');
|
||||
$this->request->setTaxAmount('0.00');
|
||||
$this->request->setShippingAmount('0.00');
|
||||
$this->request->setHandlingAmount('0.00');
|
||||
$this->request->setShippingDiscount('0.00');
|
||||
$this->request->setInsuranceAmount('0.00');
|
||||
|
||||
$expected = array();
|
||||
$expected['METHOD'] = 'DoExpressCheckoutPayment';
|
||||
$expected['PAYMENTREQUEST_0_PAYMENTACTION'] = 'Authorization';
|
||||
$expected['PAYMENTREQUEST_0_AMT'] = '1.23';
|
||||
$expected['PAYMENTREQUEST_0_CURRENCYCODE'] = 'USD';
|
||||
$expected['PAYMENTREQUEST_0_INVNUM'] = 'ABC-123';
|
||||
$expected['PAYMENTREQUEST_0_DESC'] = 'DESC';
|
||||
$expected['PAYMENTREQUEST_0_NOTIFYURL'] = 'https://www.example.com/notify';
|
||||
$expected['USER'] = 'testuser';
|
||||
$expected['PWD'] = 'testpass';
|
||||
$expected['SIGNATURE'] = 'SIG';
|
||||
$expected['SUBJECT'] = 'SUB';
|
||||
$expected['VERSION'] = ExpressCompleteAuthorizeRequest::API_VERSION;
|
||||
$expected['TOKEN'] = 'TOKEN1234';
|
||||
$expected['PAYERID'] = 'Payer-1234';
|
||||
$expected['MAXAMT'] = '0.00';
|
||||
$expected['PAYMENTREQUEST_0_TAXAMT'] = '0.00';
|
||||
$expected['PAYMENTREQUEST_0_SHIPPINGAMT'] = '0.00';
|
||||
$expected['PAYMENTREQUEST_0_HANDLINGAMT'] = '0.00';
|
||||
$expected['PAYMENTREQUEST_0_SHIPDISCAMT'] = '0.00';
|
||||
$expected['PAYMENTREQUEST_0_INSURANCEAMT'] = '0.00';
|
||||
|
||||
$this->assertEquals($expected, $this->request->getData());
|
||||
}
|
||||
|
||||
public function testGetDataWithItems()
|
||||
{
|
||||
$this->request->setAmount('50.00');
|
||||
$this->request->setCurrency('USD');
|
||||
$this->request->setTransactionId('ABC-123');
|
||||
$this->request->setUsername('testuser');
|
||||
$this->request->setPassword('testpass');
|
||||
$this->request->setSignature('SIG');
|
||||
$this->request->setSubject('SUB');
|
||||
$this->request->setDescription('DESC');
|
||||
|
||||
$this->request->setItems(array(
|
||||
array('name' => 'Floppy Disk', 'description' => 'MS-DOS', 'quantity' => 2, 'price' => 10),
|
||||
array('name' => 'CD-ROM', 'description' => 'Windows 95', 'quantity' => 1, 'price' => 40),
|
||||
));
|
||||
|
||||
$data = $this->request->getData();
|
||||
$this->assertSame('Floppy Disk', $data['L_PAYMENTREQUEST_0_NAME0']);
|
||||
$this->assertSame('MS-DOS', $data['L_PAYMENTREQUEST_0_DESC0']);
|
||||
$this->assertSame(2, $data['L_PAYMENTREQUEST_0_QTY0']);
|
||||
$this->assertSame('10.00', $data['L_PAYMENTREQUEST_0_AMT0']);
|
||||
|
||||
$this->assertSame('CD-ROM', $data['L_PAYMENTREQUEST_0_NAME1']);
|
||||
$this->assertSame('Windows 95', $data['L_PAYMENTREQUEST_0_DESC1']);
|
||||
$this->assertSame(1, $data['L_PAYMENTREQUEST_0_QTY1']);
|
||||
$this->assertSame('40.00', $data['L_PAYMENTREQUEST_0_AMT1']);
|
||||
}
|
||||
}
|
||||
96
vendor/omnipay/paypal/tests/Message/ExpressCompletePurchaseRequestTest.php
vendored
Normal file
96
vendor/omnipay/paypal/tests/Message/ExpressCompletePurchaseRequestTest.php
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\PayPal\Message\ExpressCompletePurchaseRequest;
|
||||
use Omnipay\Tests\TestCase;
|
||||
|
||||
class ExpressCompletePurchaseRequestTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var \Omnipay\PayPal\Message\ExpressCompletePurchaseRequest
|
||||
*/
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$client = $this->getHttpClient();
|
||||
|
||||
$request = $this->getHttpRequest();
|
||||
$request->query->set('PayerID', 'Payer-1234');
|
||||
$request->query->set('token', 'TOKEN1234');
|
||||
|
||||
$this->request = new ExpressCompletePurchaseRequest($client, $request);
|
||||
}
|
||||
|
||||
public function testGetData()
|
||||
{
|
||||
$this->request->setAmount('1.23');
|
||||
$this->request->setCurrency('USD');
|
||||
$this->request->setTransactionId('ABC-123');
|
||||
$this->request->setUsername('testuser');
|
||||
$this->request->setPassword('testpass');
|
||||
$this->request->setSignature('SIG');
|
||||
$this->request->setSubject('SUB');
|
||||
$this->request->setDescription('DESC');
|
||||
$this->request->setNotifyUrl('https://www.example.com/notify');
|
||||
$this->request->setMaxAmount('0.00');
|
||||
$this->request->setTaxAmount('0.00');
|
||||
$this->request->setShippingAmount('0.00');
|
||||
$this->request->setHandlingAmount('0.00');
|
||||
$this->request->setShippingDiscount('0.00');
|
||||
$this->request->setInsuranceAmount('0.00');
|
||||
|
||||
$expected = array();
|
||||
$expected['METHOD'] = 'DoExpressCheckoutPayment';
|
||||
$expected['PAYMENTREQUEST_0_PAYMENTACTION'] = 'Sale';
|
||||
$expected['PAYMENTREQUEST_0_AMT'] = '1.23';
|
||||
$expected['PAYMENTREQUEST_0_CURRENCYCODE'] = 'USD';
|
||||
$expected['PAYMENTREQUEST_0_INVNUM'] = 'ABC-123';
|
||||
$expected['PAYMENTREQUEST_0_DESC'] = 'DESC';
|
||||
$expected['PAYMENTREQUEST_0_NOTIFYURL'] = 'https://www.example.com/notify';
|
||||
$expected['USER'] = 'testuser';
|
||||
$expected['PWD'] = 'testpass';
|
||||
$expected['SIGNATURE'] = 'SIG';
|
||||
$expected['SUBJECT'] = 'SUB';
|
||||
$expected['VERSION'] = ExpressCompletePurchaseRequest::API_VERSION;
|
||||
$expected['TOKEN'] = 'TOKEN1234';
|
||||
$expected['PAYERID'] = 'Payer-1234';
|
||||
$expected['MAXAMT'] = '0.00';
|
||||
$expected['PAYMENTREQUEST_0_TAXAMT'] = '0.00';
|
||||
$expected['PAYMENTREQUEST_0_SHIPPINGAMT'] = '0.00';
|
||||
$expected['PAYMENTREQUEST_0_HANDLINGAMT'] = '0.00';
|
||||
$expected['PAYMENTREQUEST_0_SHIPDISCAMT'] = '0.00';
|
||||
$expected['PAYMENTREQUEST_0_INSURANCEAMT'] = '0.00';
|
||||
|
||||
$this->assertEquals($expected, $this->request->getData());
|
||||
}
|
||||
|
||||
public function testGetDataWithItems()
|
||||
{
|
||||
$this->request->setAmount('50.00');
|
||||
$this->request->setCurrency('USD');
|
||||
$this->request->setTransactionId('ABC-123');
|
||||
$this->request->setUsername('testuser');
|
||||
$this->request->setPassword('testpass');
|
||||
$this->request->setSignature('SIG');
|
||||
$this->request->setSubject('SUB');
|
||||
$this->request->setDescription('DESC');
|
||||
|
||||
$this->request->setItems(array(
|
||||
array('name' => 'Floppy Disk', 'description' => 'MS-DOS', 'quantity' => 2, 'price' => 10),
|
||||
array('name' => 'CD-ROM', 'description' => 'Windows 95', 'quantity' => 1, 'price' => 40),
|
||||
));
|
||||
|
||||
$data = $this->request->getData();
|
||||
$this->assertSame('Floppy Disk', $data['L_PAYMENTREQUEST_0_NAME0']);
|
||||
$this->assertSame('MS-DOS', $data['L_PAYMENTREQUEST_0_DESC0']);
|
||||
$this->assertSame(2, $data['L_PAYMENTREQUEST_0_QTY0']);
|
||||
$this->assertSame('10.00', $data['L_PAYMENTREQUEST_0_AMT0']);
|
||||
|
||||
$this->assertSame('CD-ROM', $data['L_PAYMENTREQUEST_0_NAME1']);
|
||||
$this->assertSame('Windows 95', $data['L_PAYMENTREQUEST_0_DESC1']);
|
||||
$this->assertSame(1, $data['L_PAYMENTREQUEST_0_QTY1']);
|
||||
$this->assertSame('40.00', $data['L_PAYMENTREQUEST_0_AMT1']);
|
||||
}
|
||||
}
|
||||
72
vendor/omnipay/paypal/tests/Message/ExpressFetchCheckoutRequestTest.php
vendored
Normal file
72
vendor/omnipay/paypal/tests/Message/ExpressFetchCheckoutRequestTest.php
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\PayPal\Message\ExpressFetchCheckoutRequest;
|
||||
use Omnipay\Tests\TestCase;
|
||||
|
||||
class ExpressFetchCheckoutRequestTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var \Omnipay\PayPal\Message\ExpressFetchCheckoutRequest
|
||||
*/
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$client = $this->getHttpClient();
|
||||
|
||||
$request = $this->getHttpRequest();
|
||||
$request->query->set('token', 'TOKEN1234');
|
||||
|
||||
$this->request = new ExpressFetchCheckoutRequest($client, $request);
|
||||
}
|
||||
|
||||
public function testGetData()
|
||||
{
|
||||
$this->request->setUsername('testuser');
|
||||
$this->request->setPassword('testpass');
|
||||
$this->request->setSignature('SIG');
|
||||
|
||||
$expected = array();
|
||||
$expected['METHOD'] = 'GetExpressCheckoutDetails';
|
||||
$expected['USER'] = 'testuser';
|
||||
$expected['PWD'] = 'testpass';
|
||||
$expected['SIGNATURE'] = 'SIG';
|
||||
$expected['SUBJECT'] = null;
|
||||
$expected['VERSION'] = ExpressCompletePurchaseRequest::API_VERSION;
|
||||
$expected['TOKEN'] = 'TOKEN1234';
|
||||
|
||||
$this->assertEquals($expected, $this->request->getData());
|
||||
}
|
||||
|
||||
public function testGetDataTokenOverride()
|
||||
{
|
||||
$this->request->setToken('TOKEN2000');
|
||||
|
||||
$data = $this->request->getData();
|
||||
|
||||
$this->assertSame('TOKEN2000', $data['TOKEN']);
|
||||
}
|
||||
|
||||
public function testSendSuccess()
|
||||
{
|
||||
$this->setMockHttpResponse('ExpressFetchCheckoutSuccess.txt');
|
||||
|
||||
$response = $this->request->send();
|
||||
$this->assertFalse($response->isPending());
|
||||
$this->assertTrue($response->isSuccessful());
|
||||
$this->assertFalse($response->isRedirect());
|
||||
}
|
||||
|
||||
public function testSendFailure()
|
||||
{
|
||||
$this->setMockHttpResponse('ExpressFetchCheckoutFailure.txt');
|
||||
|
||||
$response = $this->request->send();
|
||||
$this->assertFalse($response->isPending());
|
||||
$this->assertFalse($response->isSuccessful());
|
||||
$this->assertFalse($response->isRedirect());
|
||||
$this->assertSame('The amount exceeds the maximum amount for a single transaction.', $response->getMessage());
|
||||
}
|
||||
}
|
||||
369
vendor/omnipay/paypal/tests/Message/ExpressInContextAuthorizeRequestTest.php
vendored
Normal file
369
vendor/omnipay/paypal/tests/Message/ExpressInContextAuthorizeRequestTest.php
vendored
Normal file
@@ -0,0 +1,369 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Common\CreditCard;
|
||||
use Omnipay\Common\Exception\InvalidRequestException;
|
||||
use Omnipay\PayPal\Message\ExpressInContextAuthorizeRequest;
|
||||
use Omnipay\PayPal\Support\InstantUpdateApi\ShippingOption;
|
||||
use Omnipay\Tests\TestCase;
|
||||
|
||||
class ExpressInContextAuthorizeRequestTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var ExpressInContextAuthorizeRequest
|
||||
*/
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->request = new ExpressInContextAuthorizeRequest($this->getHttpClient(), $this->getHttpRequest());
|
||||
$this->request->initialize(
|
||||
array(
|
||||
'amount' => '10.00',
|
||||
'returnUrl' => 'https://www.example.com/return',
|
||||
'cancelUrl' => 'https://www.example.com/cancel',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetDataWithoutCard()
|
||||
{
|
||||
$this->request->initialize(array(
|
||||
'amount' => '10.00',
|
||||
'currency' => 'AUD',
|
||||
'transactionId' => '111',
|
||||
'description' => 'Order Description',
|
||||
'returnUrl' => 'https://www.example.com/return',
|
||||
'cancelUrl' => 'https://www.example.com/cancel',
|
||||
'subject' => 'demo@example.com',
|
||||
'headerImageUrl' => 'https://www.example.com/header.jpg',
|
||||
'noShipping' => 0,
|
||||
'localeCode' => 'EN',
|
||||
'allowNote' => 0,
|
||||
'addressOverride' => 0,
|
||||
'brandName' => 'Dunder Mifflin Paper Company, Inc.',
|
||||
'customerServiceNumber' => '1-801-FLOWERS',
|
||||
));
|
||||
|
||||
$data = $this->request->getData();
|
||||
|
||||
$this->assertSame('10.00', $data['PAYMENTREQUEST_0_AMT']);
|
||||
$this->assertSame('AUD', $data['PAYMENTREQUEST_0_CURRENCYCODE']);
|
||||
$this->assertSame('111', $data['PAYMENTREQUEST_0_INVNUM']);
|
||||
$this->assertSame('Order Description', $data['PAYMENTREQUEST_0_DESC']);
|
||||
$this->assertSame('https://www.example.com/return', $data['RETURNURL']);
|
||||
$this->assertSame('https://www.example.com/cancel', $data['CANCELURL']);
|
||||
$this->assertSame('demo@example.com', $data['SUBJECT']);
|
||||
$this->assertSame('https://www.example.com/header.jpg', $data['HDRIMG']);
|
||||
$this->assertSame(0, $data['NOSHIPPING']);
|
||||
$this->assertSame(0, $data['ALLOWNOTE']);
|
||||
$this->assertSame('EN', $data['LOCALECODE']);
|
||||
$this->assertSame(0, $data['ADDROVERRIDE']);
|
||||
$this->assertSame('Dunder Mifflin Paper Company, Inc.', $data['BRANDNAME']);
|
||||
$this->assertSame('1-801-FLOWERS', $data['CUSTOMERSERVICENUMBER']);
|
||||
}
|
||||
|
||||
public function testGetDataWithCard()
|
||||
{
|
||||
$this->request->initialize(array(
|
||||
'amount' => '10.00',
|
||||
'currency' => 'AUD',
|
||||
'transactionId' => '111',
|
||||
'description' => 'Order Description',
|
||||
'returnUrl' => 'https://www.example.com/return',
|
||||
'cancelUrl' => 'https://www.example.com/cancel',
|
||||
'subject' => 'demo@example.com',
|
||||
'headerImageUrl' => 'https://www.example.com/header.jpg',
|
||||
'noShipping' => 2,
|
||||
'allowNote' => 1,
|
||||
'addressOverride' => 1,
|
||||
'brandName' => 'Dunder Mifflin Paper Company, Inc.',
|
||||
'maxAmount' => 123.45,
|
||||
'logoImageUrl' => 'https://www.example.com/logo.jpg',
|
||||
'borderColor' => 'CCCCCC',
|
||||
'localeCode' => 'EN',
|
||||
'customerServiceNumber' => '1-801-FLOWERS',
|
||||
'sellerPaypalAccountId' => 'billing@example.com',
|
||||
));
|
||||
|
||||
$card = new CreditCard(array(
|
||||
'name' => 'John Doe',
|
||||
'address1' => '123 NW Blvd',
|
||||
'address2' => 'Lynx Lane',
|
||||
'city' => 'Topeka',
|
||||
'state' => 'KS',
|
||||
'country' => 'USA',
|
||||
'postcode' => '66605',
|
||||
'phone' => '555-555-5555',
|
||||
'email' => 'test@email.com',
|
||||
));
|
||||
$this->request->setCard($card);
|
||||
|
||||
$expected = array(
|
||||
'METHOD' => 'SetExpressCheckout',
|
||||
'VERSION' => ExpressInContextAuthorizeRequest::API_VERSION,
|
||||
'USER' => null,
|
||||
'PWD' => null,
|
||||
'SIGNATURE' => null,
|
||||
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Authorization',
|
||||
'SOLUTIONTYPE' => null,
|
||||
'LANDINGPAGE' => null,
|
||||
'NOSHIPPING' => 2,
|
||||
'ALLOWNOTE' => 1,
|
||||
'ADDROVERRIDE' => 1,
|
||||
'PAYMENTREQUEST_0_AMT' => '10.00',
|
||||
'PAYMENTREQUEST_0_CURRENCYCODE' => 'AUD',
|
||||
'PAYMENTREQUEST_0_INVNUM' => '111',
|
||||
'PAYMENTREQUEST_0_DESC' => 'Order Description',
|
||||
'RETURNURL' => 'https://www.example.com/return',
|
||||
'CANCELURL' => 'https://www.example.com/cancel',
|
||||
'SUBJECT' => 'demo@example.com',
|
||||
'HDRIMG' => 'https://www.example.com/header.jpg',
|
||||
'PAYMENTREQUEST_0_SHIPTONAME' => 'John Doe',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET' => '123 NW Blvd',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTREET2' => 'Lynx Lane',
|
||||
'PAYMENTREQUEST_0_SHIPTOCITY' => 'Topeka',
|
||||
'PAYMENTREQUEST_0_SHIPTOSTATE' => 'KS',
|
||||
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE' => 'USA',
|
||||
'PAYMENTREQUEST_0_SHIPTOZIP' => '66605',
|
||||
'PAYMENTREQUEST_0_SHIPTOPHONENUM' => '555-555-5555',
|
||||
'EMAIL' => 'test@email.com',
|
||||
'BRANDNAME' => 'Dunder Mifflin Paper Company, Inc.',
|
||||
'MAXAMT' => 123.45,
|
||||
'PAYMENTREQUEST_0_TAXAMT' => null,
|
||||
'PAYMENTREQUEST_0_SHIPPINGAMT' => null,
|
||||
'PAYMENTREQUEST_0_HANDLINGAMT' => null,
|
||||
'PAYMENTREQUEST_0_SHIPDISCAMT' => null,
|
||||
'PAYMENTREQUEST_0_INSURANCEAMT' => null,
|
||||
'LOGOIMG' => 'https://www.example.com/logo.jpg',
|
||||
'CARTBORDERCOLOR' => 'CCCCCC',
|
||||
'LOCALECODE' => 'EN',
|
||||
'CUSTOMERSERVICENUMBER' => '1-801-FLOWERS',
|
||||
'PAYMENTREQUEST_0_SELLERPAYPALACCOUNTID' => 'billing@example.com',
|
||||
);
|
||||
|
||||
$this->assertEquals($expected, $this->request->getData());
|
||||
}
|
||||
|
||||
public function testGetDataWithItems()
|
||||
{
|
||||
$this->request->setItems(array(
|
||||
array('name' => 'Floppy Disk', 'description' => 'MS-DOS', 'quantity' => 2, 'price' => 10, 'code' => '123456'),
|
||||
array('name' => 'CD-ROM', 'description' => 'Windows 95', 'quantity' => 1, 'price' => 40),
|
||||
));
|
||||
|
||||
$data = $this->request->getData();
|
||||
$this->assertSame('Floppy Disk', $data['L_PAYMENTREQUEST_0_NAME0']);
|
||||
$this->assertSame('MS-DOS', $data['L_PAYMENTREQUEST_0_DESC0']);
|
||||
$this->assertSame(2, $data['L_PAYMENTREQUEST_0_QTY0']);
|
||||
$this->assertSame('10.00', $data['L_PAYMENTREQUEST_0_AMT0']);
|
||||
$this->assertSame('123456', $data['L_PAYMENTREQUEST_0_NUMBER0']);
|
||||
|
||||
$this->assertSame('CD-ROM', $data['L_PAYMENTREQUEST_0_NAME1']);
|
||||
$this->assertSame('Windows 95', $data['L_PAYMENTREQUEST_0_DESC1']);
|
||||
$this->assertSame(1, $data['L_PAYMENTREQUEST_0_QTY1']);
|
||||
$this->assertSame('40.00', $data['L_PAYMENTREQUEST_0_AMT1']);
|
||||
|
||||
$this->assertSame('60.00', $data['PAYMENTREQUEST_0_ITEMAMT']);
|
||||
}
|
||||
|
||||
public function testGetDataWithExtraOrderDetails()
|
||||
{
|
||||
$this->request->initialize(array(
|
||||
'amount' => '10.00',
|
||||
'currency' => 'AUD',
|
||||
'transactionId' => '111',
|
||||
'description' => 'Order Description',
|
||||
'returnUrl' => 'https://www.example.com/return',
|
||||
'cancelUrl' => 'https://www.example.com/cancel',
|
||||
'subject' => 'demo@example.com',
|
||||
'headerImageUrl' => 'https://www.example.com/header.jpg',
|
||||
'noShipping' => 0,
|
||||
'allowNote' => 0,
|
||||
'addressOverride' => 0,
|
||||
'brandName' => 'Dunder Mifflin Paper Company, Inc.',
|
||||
'taxAmount' => '2.00',
|
||||
'shippingAmount' => '5.00',
|
||||
'handlingAmount' => '1.00',
|
||||
'shippingDiscount' => '-1.00',
|
||||
'insuranceAmount' => '3.00',
|
||||
));
|
||||
|
||||
$data = $this->request->getData();
|
||||
$this->assertSame('2.00', $data['PAYMENTREQUEST_0_TAXAMT']);
|
||||
$this->assertSame('5.00', $data['PAYMENTREQUEST_0_SHIPPINGAMT']);
|
||||
$this->assertSame('1.00', $data['PAYMENTREQUEST_0_HANDLINGAMT']);
|
||||
$this->assertSame('-1.00', $data['PAYMENTREQUEST_0_SHIPDISCAMT']);
|
||||
$this->assertSame('3.00', $data['PAYMENTREQUEST_0_INSURANCEAMT']);
|
||||
}
|
||||
|
||||
public function testHeaderImageUrl()
|
||||
{
|
||||
$this->assertSame($this->request, $this->request->setHeaderImageUrl('https://www.example.com/header.jpg'));
|
||||
$this->assertSame('https://www.example.com/header.jpg', $this->request->getHeaderImageUrl());
|
||||
|
||||
$data = $this->request->getData();
|
||||
$this->assertEquals('https://www.example.com/header.jpg', $data['HDRIMG']);
|
||||
}
|
||||
|
||||
public function testMaxAmount()
|
||||
{
|
||||
$this->request->setMaxAmount(321.54);
|
||||
|
||||
$this->assertSame(321.54, $this->request->getMaxAmount());
|
||||
|
||||
$data = $this->request->getData();
|
||||
|
||||
$this->assertSame(321.54, $data['MAXAMT']);
|
||||
}
|
||||
|
||||
public function testDataWithCallback()
|
||||
{
|
||||
$baseData = array(
|
||||
'amount' => '10.00',
|
||||
'currency' => 'AUD',
|
||||
'transactionId' => '111',
|
||||
'description' => 'Order Description',
|
||||
'returnUrl' => 'https://www.example.com/return',
|
||||
'cancelUrl' => 'https://www.example.com/cancel',
|
||||
'subject' => 'demo@example.com',
|
||||
'headerImageUrl' => 'https://www.example.com/header.jpg',
|
||||
'allowNote' => 0,
|
||||
'addressOverride' => 0,
|
||||
'brandName' => 'Dunder Mifflin Paper Company, Incy.',
|
||||
);
|
||||
|
||||
$shippingOptions = array(
|
||||
new ShippingOption('First Class', 1.20, true, '1-2 days'),
|
||||
new ShippingOption('Second Class', 0.70, false, '3-5 days'),
|
||||
new ShippingOption('International', 3.50),
|
||||
);
|
||||
|
||||
// with a default callback timeout
|
||||
$this->request->initialize(array_merge($baseData, array(
|
||||
'callback' => 'https://www.example.com/calculate-shipping',
|
||||
'shippingOptions' => $shippingOptions,
|
||||
)));
|
||||
|
||||
$data = $this->request->getData();
|
||||
$this->assertSame('https://www.example.com/calculate-shipping', $data['CALLBACK']);
|
||||
$this->assertSame(ExpressInContextAuthorizeRequest::DEFAULT_CALLBACK_TIMEOUT, $data['CALLBACKTIMEOUT']);
|
||||
|
||||
$this->assertSame('First Class', $data['L_SHIPPINGOPTIONNAME0']);
|
||||
$this->assertSame('1.20', $data['L_SHIPPINGOPTIONAMOUNT0']);
|
||||
$this->assertSame('1', $data['L_SHIPPINGOPTIONISDEFAULT0']);
|
||||
$this->assertSame('1-2 days', $data['L_SHIPPINGOPTIONLABEL0']);
|
||||
|
||||
$this->assertSame('Second Class', $data['L_SHIPPINGOPTIONNAME1']);
|
||||
$this->assertSame('0.70', $data['L_SHIPPINGOPTIONAMOUNT1']);
|
||||
$this->assertSame('0', $data['L_SHIPPINGOPTIONISDEFAULT1']);
|
||||
$this->assertSame('3-5 days', $data['L_SHIPPINGOPTIONLABEL1']);
|
||||
|
||||
$this->assertSame('International', $data['L_SHIPPINGOPTIONNAME2']);
|
||||
$this->assertSame('3.50', $data['L_SHIPPINGOPTIONAMOUNT2']);
|
||||
$this->assertSame('0', $data['L_SHIPPINGOPTIONISDEFAULT2']);
|
||||
|
||||
// with a defined callback timeout
|
||||
$this->request->initialize(array_merge($baseData, array(
|
||||
'callback' => 'https://www.example.com/calculate-shipping',
|
||||
'callbackTimeout' => 10,
|
||||
'shippingOptions' => $shippingOptions,
|
||||
)));
|
||||
|
||||
$data = $this->request->getData();
|
||||
$this->assertSame('https://www.example.com/calculate-shipping', $data['CALLBACK']);
|
||||
$this->assertSame(10, $data['CALLBACKTIMEOUT']);
|
||||
}
|
||||
|
||||
public function testDataWithCallbackAndNoDefaultShippingOption()
|
||||
{
|
||||
$baseData = array(
|
||||
'amount' => '10.00',
|
||||
'currency' => 'AUD',
|
||||
'transactionId' => '111',
|
||||
'description' => 'Order Description',
|
||||
'returnUrl' => 'https://www.example.com/return',
|
||||
'cancelUrl' => 'https://www.example.com/cancel',
|
||||
'subject' => 'demo@example.com',
|
||||
'headerImageUrl' => 'https://www.example.com/header.jpg',
|
||||
'allowNote' => 0,
|
||||
'addressOverride' => 0,
|
||||
'brandName' => 'Dunder Mifflin Paper Company, Incy.',
|
||||
);
|
||||
|
||||
$shippingOptions = array(
|
||||
new ShippingOption('First Class', 1.20, false, '1-2 days'),
|
||||
new ShippingOption('Second Class', 0.70, false, '3-5 days'),
|
||||
new ShippingOption('International', 3.50),
|
||||
);
|
||||
|
||||
// with a default callback timeout
|
||||
$this->request->initialize(array_merge($baseData, array(
|
||||
'callback' => 'https://www.example.com/calculate-shipping',
|
||||
'shippingOptions' => $shippingOptions,
|
||||
)));
|
||||
|
||||
$this->expectException(InvalidRequestException::class);
|
||||
$this->expectExceptionMessage('One of the supplied shipping options must be set as default');
|
||||
|
||||
$this->request->getData();
|
||||
}
|
||||
|
||||
public function testNoAmount()
|
||||
{
|
||||
$baseData = array(// nothing here - should cause a certain exception
|
||||
);
|
||||
|
||||
$this->request->initialize($baseData);
|
||||
|
||||
$this->expectException(InvalidRequestException::class);
|
||||
$this->expectExceptionMessage('The amount parameter is required');
|
||||
|
||||
$this->request->getData();
|
||||
}
|
||||
|
||||
public function testAmountButNoReturnUrl()
|
||||
{
|
||||
$baseData = array(
|
||||
'amount' => 10.00,
|
||||
);
|
||||
|
||||
$this->request->initialize($baseData);
|
||||
|
||||
$this->expectException(InvalidRequestException::class);
|
||||
$this->expectExceptionMessage('The returnUrl parameter is required');
|
||||
|
||||
$this->request->getData();
|
||||
}
|
||||
|
||||
public function testBadCallbackConfiguration()
|
||||
{
|
||||
$baseData = array(
|
||||
'amount' => '10.00',
|
||||
'currency' => 'AUD',
|
||||
'transactionId' => '111',
|
||||
'description' => 'Order Description',
|
||||
'returnUrl' => 'https://www.example.com/return',
|
||||
'cancelUrl' => 'https://www.example.com/cancel',
|
||||
'subject' => 'demo@example.com',
|
||||
'headerImageUrl' => 'https://www.example.com/header.jpg',
|
||||
'allowNote' => 0,
|
||||
'addressOverride' => 0,
|
||||
'brandName' => 'Dunder Mifflin Paper Company, Incy.',
|
||||
);
|
||||
|
||||
$this->request->initialize(array_merge($baseData, array(
|
||||
'callback' => 'https://www.example.com/calculate-shipping',
|
||||
)));
|
||||
|
||||
// from the docblock on this exception -
|
||||
// Thrown when a request is invalid or missing required fields.
|
||||
// callback has been set but no shipping options so expect one of these:
|
||||
$this->expectException(InvalidRequestException::class);
|
||||
|
||||
$this->request->getData();
|
||||
}
|
||||
}
|
||||
45
vendor/omnipay/paypal/tests/Message/ExpressInContextAuthorizeResponseTest.php
vendored
Normal file
45
vendor/omnipay/paypal/tests/Message/ExpressInContextAuthorizeResponseTest.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Tests\TestCase;
|
||||
use Omnipay\PayPal\Message\ExpressInContextAuthorizeResponse;
|
||||
|
||||
class ExpressInContextAuthorizeResponseTest extends TestCase
|
||||
{
|
||||
public function testConstruct()
|
||||
{
|
||||
// response should decode URL format data
|
||||
$response = new ExpressInContextAuthorizeResponse($this->getMockRequest(), 'example=value&foo=bar');
|
||||
|
||||
$this->assertEquals(array('example' => 'value', 'foo' => 'bar'), $response->getData());
|
||||
}
|
||||
|
||||
public function testExpressPurchaseSuccess()
|
||||
{
|
||||
$httpResponse = $this->getMockHttpResponse('ExpressPurchaseSuccess.txt');
|
||||
$request = $this->getMockRequest();
|
||||
$request->shouldReceive('getTestMode')->once()->andReturn(true);
|
||||
$response = new ExpressInContextAuthorizeResponse($request, $httpResponse->getBody());
|
||||
|
||||
$this->assertFalse($response->isPending());
|
||||
$this->assertFalse($response->isSuccessful());
|
||||
$this->assertSame('EC-42721413K79637829', $response->getTransactionReference());
|
||||
$this->assertNull($response->getMessage());
|
||||
$this->assertNull($response->getRedirectData());
|
||||
$this->assertSame('https://www.sandbox.paypal.com/checkoutnow?useraction=commit&token=EC-42721413K79637829', $response->getRedirectUrl());
|
||||
$this->assertSame('GET', $response->getRedirectMethod());
|
||||
}
|
||||
|
||||
public function testExpressPurchaseFailure()
|
||||
{
|
||||
$httpResponse = $this->getMockHttpResponse('ExpressPurchaseFailure.txt');
|
||||
$response = new ExpressInContextAuthorizeResponse($this->getMockRequest(), $httpResponse->getBody());
|
||||
|
||||
$this->assertFalse($response->isPending());
|
||||
$this->assertFalse($response->isSuccessful());
|
||||
$this->assertNull($response->getTransactionReference());
|
||||
$this->assertNull($response->getTransactionReference());
|
||||
$this->assertSame('This transaction cannot be processed. The amount to be charged is zero.', $response->getMessage());
|
||||
}
|
||||
}
|
||||
93
vendor/omnipay/paypal/tests/Message/ExpressTransactionSearchRequestTest.php
vendored
Normal file
93
vendor/omnipay/paypal/tests/Message/ExpressTransactionSearchRequestTest.php
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Common\Exception\InvalidRequestException;
|
||||
use Omnipay\Tests\TestCase;
|
||||
|
||||
class ExpressTransactionSearchRequestTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var ExpressTransactionSearchRequest
|
||||
*/
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->request = new ExpressTransactionSearchRequest($this->getHttpClient(), $this->getHttpRequest());
|
||||
}
|
||||
|
||||
public function testGetData()
|
||||
{
|
||||
$startDate = '2015-01-01';
|
||||
$endDate = '2016-01-01';
|
||||
|
||||
$this->request->initialize(array(
|
||||
'amount' => '10.00',
|
||||
'currency' => 'USD',
|
||||
'startDate' => $startDate,
|
||||
'endDate' => $endDate,
|
||||
'salutation' => 'Mr.',
|
||||
'firstName' => 'Jhon',
|
||||
'middleName' => 'Carter',
|
||||
'lastName' => 'Macgiver',
|
||||
'suffix' => 'Jh',
|
||||
'email' => 'test@email.com',
|
||||
'receiver' => 'Patt Doret',
|
||||
'receiptId' => '1111',
|
||||
'transactionId' => 'XKCD',
|
||||
'invoiceNumber' => '123456789',
|
||||
'card' => array('number' => '376449047333005'),
|
||||
'auctionItemNumber' => '321564',
|
||||
'transactionClass' => 'Received',
|
||||
'status' => 'Success',
|
||||
'profileId' => '00000000000'
|
||||
));
|
||||
|
||||
$data = $this->request->getData();
|
||||
|
||||
$startDate = new \DateTime($startDate);
|
||||
$endDate = new \DateTime($endDate);
|
||||
|
||||
$this->assertSame('10.00', $data['AMT']);
|
||||
$this->assertSame('USD', $data['CURRENCYCODE']);
|
||||
$this->assertSame($startDate->format(\DateTime::ISO8601), $data['STARTDATE']);
|
||||
$this->assertSame($endDate->format(\DateTime::ISO8601), $data['ENDDATE']);
|
||||
$this->assertSame('Mr.', $data['SALUTATION']);
|
||||
$this->assertSame('Jhon', $data['FIRSTNAME']);
|
||||
$this->assertSame('Carter', $data['MIDDLENAME']);
|
||||
$this->assertSame('Macgiver', $data['LASTNAME']);
|
||||
$this->assertSame('Jh', $data['SUFFIX']);
|
||||
$this->assertSame('test@email.com', $data['EMAIL']);
|
||||
$this->assertSame('XKCD', $data['TRANSACTIONID']);
|
||||
$this->assertSame('123456789', $data['INVNUM']);
|
||||
$this->assertSame('376449047333005', $data['ACCT']);
|
||||
$this->assertSame('321564', $data['AUCTIONITEMNUMBER']);
|
||||
$this->assertSame('Received', $data['TRANSACTIONCLASS']);
|
||||
$this->assertSame('Success', $data['STATUS']);
|
||||
$this->assertSame('00000000000', $data['PROFILEID']);
|
||||
}
|
||||
|
||||
public function testWithoutStartDate()
|
||||
{
|
||||
$this->request->initialize(array());
|
||||
|
||||
$this->expectException(InvalidRequestException::class);
|
||||
$this->expectExceptionMessage('The startDate parameter is required');
|
||||
|
||||
$this->request->getData();
|
||||
}
|
||||
|
||||
public function testAmountWithoutCurrency()
|
||||
{
|
||||
$this->request->setStartDate('2015-01-01');
|
||||
$this->request->setAmount(150.00);
|
||||
|
||||
$this->expectException(InvalidRequestException::class);
|
||||
$this->expectExceptionMessage('The currency parameter is required');
|
||||
|
||||
$this->request->getData();
|
||||
}
|
||||
}
|
||||
44
vendor/omnipay/paypal/tests/Message/ExpressTransactionSearchResponseTest.php
vendored
Normal file
44
vendor/omnipay/paypal/tests/Message/ExpressTransactionSearchResponseTest.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Tests\TestCase;
|
||||
|
||||
class ExpressTransactionSearchResponseTest extends TestCase
|
||||
{
|
||||
public function testConstruct()
|
||||
{
|
||||
// response should decode URL format data
|
||||
$response = new ExpressTransactionSearchResponse($this->getMockRequest(), 'ACK=Success&BUILD=18308778');
|
||||
|
||||
$this->assertEquals(
|
||||
array('ACK' => 'Success', 'BUILD' => '18308778', 'payments' => array()),
|
||||
$response->getData()
|
||||
);
|
||||
}
|
||||
|
||||
public function testExpressTransactionSearch()
|
||||
{
|
||||
$httpResponse = $this->getMockHttpResponse('ExpressTransactionSearchResponse.txt');
|
||||
|
||||
$response = new ExpressTransactionSearchResponse($this->getMockRequest(), $httpResponse->getBody());
|
||||
|
||||
$this->assertTrue($response->isSuccessful());
|
||||
$this->assertNull($response->getMessage());
|
||||
$this->assertArrayHasKey('payments', $response->getData());
|
||||
|
||||
foreach ($response->getPayments() as $payment) {
|
||||
$this->assertArrayHasKey('TIMESTAMP', $payment);
|
||||
$this->assertArrayHasKey('TIMEZONE', $payment);
|
||||
$this->assertArrayHasKey('TYPE', $payment);
|
||||
$this->assertArrayHasKey('EMAIL', $payment);
|
||||
$this->assertArrayHasKey('NAME', $payment);
|
||||
$this->assertArrayHasKey('TRANSACTIONID', $payment);
|
||||
$this->assertArrayHasKey('STATUS', $payment);
|
||||
$this->assertArrayHasKey('AMT', $payment);
|
||||
$this->assertArrayHasKey('CURRENCYCODE', $payment);
|
||||
$this->assertArrayHasKey('FEEAMT', $payment);
|
||||
$this->assertArrayHasKey('NETAMT', $payment);
|
||||
}
|
||||
}
|
||||
}
|
||||
34
vendor/omnipay/paypal/tests/Message/ExpressVoidRequestTest.php
vendored
Normal file
34
vendor/omnipay/paypal/tests/Message/ExpressVoidRequestTest.php
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Common\CreditCard;
|
||||
use Omnipay\Tests\TestCase;
|
||||
|
||||
class ExpressVoidRequestTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var ExpressVoidRequest
|
||||
*/
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->request = new ExpressVoidRequest($this->getHttpClient(), $this->getHttpRequest());
|
||||
$this->request->initialize(
|
||||
array(
|
||||
'transactionReference' => 'ASDFASDFASDF',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetData()
|
||||
{
|
||||
$data = $this->request->getData();
|
||||
|
||||
$this->assertSame('ASDFASDFASDF', $data['AUTHORIZATIONID']);
|
||||
$this->assertSame('DoVoid', $data['METHOD']);
|
||||
}
|
||||
}
|
||||
43
vendor/omnipay/paypal/tests/Message/FetchTransactionRequestTest.php
vendored
Normal file
43
vendor/omnipay/paypal/tests/Message/FetchTransactionRequestTest.php
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\PayPal\Message\FetchTransactionRequest;
|
||||
use Omnipay\Tests\TestCase;
|
||||
|
||||
class FetchTransactionRequestTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var \Omnipay\PayPal\Message\FetchTransactionRequest
|
||||
*/
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$client = $this->getHttpClient();
|
||||
|
||||
$request = $this->getHttpRequest();
|
||||
|
||||
$this->request = new FetchTransactionRequest($client, $request);
|
||||
}
|
||||
|
||||
public function testGetData()
|
||||
{
|
||||
$this->request->setTransactionReference('ABC-123');
|
||||
$this->request->setUsername('testuser');
|
||||
$this->request->setPassword('testpass');
|
||||
$this->request->setSignature('SIG');
|
||||
$this->request->setSubject('SUB');
|
||||
|
||||
$expected = array();
|
||||
$expected['METHOD'] = 'GetTransactionDetails';
|
||||
$expected['TRANSACTIONID'] = 'ABC-123';
|
||||
$expected['USER'] = 'testuser';
|
||||
$expected['PWD'] = 'testpass';
|
||||
$expected['SIGNATURE'] = 'SIG';
|
||||
$expected['SUBJECT'] = 'SUB';
|
||||
$expected['VERSION'] = RefundRequest::API_VERSION;
|
||||
|
||||
$this->assertEquals($expected, $this->request->getData());
|
||||
}
|
||||
}
|
||||
67
vendor/omnipay/paypal/tests/Message/ProAuthorizeRequestTest.php
vendored
Normal file
67
vendor/omnipay/paypal/tests/Message/ProAuthorizeRequestTest.php
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Common\CreditCard;
|
||||
use Omnipay\Tests\TestCase;
|
||||
|
||||
class ProAuthorizeRequestTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var ProAuthorizeRequest
|
||||
*/
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->request = new ProAuthorizeRequest($this->getHttpClient(), $this->getHttpRequest());
|
||||
$this->request->initialize(
|
||||
array(
|
||||
'amount' => '10.00',
|
||||
'currency' => 'USD',
|
||||
'card' => $this->getValidCard(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetData()
|
||||
{
|
||||
$card = new CreditCard($this->getValidCard());
|
||||
$card->setStartMonth(1);
|
||||
$card->setStartYear(2000);
|
||||
|
||||
$this->request->setCard($card);
|
||||
$this->request->setTransactionId('abc123');
|
||||
$this->request->setDescription('Sheep');
|
||||
$this->request->setClientIp('127.0.0.1');
|
||||
|
||||
$data = $this->request->getData();
|
||||
|
||||
$this->assertSame('DoDirectPayment', $data['METHOD']);
|
||||
$this->assertSame('Authorization', $data['PAYMENTACTION']);
|
||||
$this->assertSame('10.00', $data['AMT']);
|
||||
$this->assertSame('USD', $data['CURRENCYCODE']);
|
||||
$this->assertSame('abc123', $data['INVNUM']);
|
||||
$this->assertSame('Sheep', $data['DESC']);
|
||||
$this->assertSame('127.0.0.1', $data['IPADDRESS']);
|
||||
|
||||
$this->assertSame($card->getNumber(), $data['ACCT']);
|
||||
$this->assertSame($card->getBrand(), $data['CREDITCARDTYPE']);
|
||||
$this->assertSame($card->getExpiryDate('mY'), $data['EXPDATE']);
|
||||
$this->assertSame('012000', $data['STARTDATE']);
|
||||
$this->assertSame($card->getCvv(), $data['CVV2']);
|
||||
$this->assertSame($card->getIssueNumber(), $data['ISSUENUMBER']);
|
||||
|
||||
$this->assertSame($card->getFirstName(), $data['FIRSTNAME']);
|
||||
$this->assertSame($card->getLastName(), $data['LASTNAME']);
|
||||
$this->assertSame($card->getEmail(), $data['EMAIL']);
|
||||
$this->assertSame($card->getAddress1(), $data['STREET']);
|
||||
$this->assertSame($card->getAddress2(), $data['STREET2']);
|
||||
$this->assertSame($card->getCity(), $data['CITY']);
|
||||
$this->assertSame($card->getState(), $data['STATE']);
|
||||
$this->assertSame($card->getPostcode(), $data['ZIP']);
|
||||
$this->assertSame($card->getCountry(), $data['COUNTRYCODE']);
|
||||
}
|
||||
}
|
||||
67
vendor/omnipay/paypal/tests/Message/ProPurchaseRequestTest.php
vendored
Normal file
67
vendor/omnipay/paypal/tests/Message/ProPurchaseRequestTest.php
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Common\CreditCard;
|
||||
use Omnipay\Tests\TestCase;
|
||||
|
||||
class ProPurchaseRequestTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var ProPurchaseRequest
|
||||
*/
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->request = new ProPurchaseRequest($this->getHttpClient(), $this->getHttpRequest());
|
||||
$this->request->initialize(
|
||||
array(
|
||||
'amount' => '10.00',
|
||||
'currency' => 'USD',
|
||||
'card' => $this->getValidCard(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetData()
|
||||
{
|
||||
$card = new CreditCard($this->getValidCard());
|
||||
$card->setStartMonth(1);
|
||||
$card->setStartYear(2000);
|
||||
|
||||
$this->request->setCard($card);
|
||||
$this->request->setTransactionId('abc123');
|
||||
$this->request->setDescription('Sheep');
|
||||
$this->request->setClientIp('127.0.0.1');
|
||||
|
||||
$data = $this->request->getData();
|
||||
|
||||
$this->assertSame('DoDirectPayment', $data['METHOD']);
|
||||
$this->assertSame('Sale', $data['PAYMENTACTION']);
|
||||
$this->assertSame('10.00', $data['AMT']);
|
||||
$this->assertSame('USD', $data['CURRENCYCODE']);
|
||||
$this->assertSame('abc123', $data['INVNUM']);
|
||||
$this->assertSame('Sheep', $data['DESC']);
|
||||
$this->assertSame('127.0.0.1', $data['IPADDRESS']);
|
||||
|
||||
$this->assertSame($card->getNumber(), $data['ACCT']);
|
||||
$this->assertSame($card->getBrand(), $data['CREDITCARDTYPE']);
|
||||
$this->assertSame($card->getExpiryDate('mY'), $data['EXPDATE']);
|
||||
$this->assertSame('012000', $data['STARTDATE']);
|
||||
$this->assertSame($card->getCvv(), $data['CVV2']);
|
||||
$this->assertSame($card->getIssueNumber(), $data['ISSUENUMBER']);
|
||||
|
||||
$this->assertSame($card->getFirstName(), $data['FIRSTNAME']);
|
||||
$this->assertSame($card->getLastName(), $data['LASTNAME']);
|
||||
$this->assertSame($card->getEmail(), $data['EMAIL']);
|
||||
$this->assertSame($card->getAddress1(), $data['STREET']);
|
||||
$this->assertSame($card->getAddress2(), $data['STREET2']);
|
||||
$this->assertSame($card->getCity(), $data['CITY']);
|
||||
$this->assertSame($card->getState(), $data['STATE']);
|
||||
$this->assertSame($card->getPostcode(), $data['ZIP']);
|
||||
$this->assertSame($card->getCountry(), $data['COUNTRYCODE']);
|
||||
}
|
||||
}
|
||||
63
vendor/omnipay/paypal/tests/Message/RefundRequestTest.php
vendored
Normal file
63
vendor/omnipay/paypal/tests/Message/RefundRequestTest.php
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\PayPal\Message\RefundRequest;
|
||||
use Omnipay\Tests\TestCase;
|
||||
|
||||
class RefundRequestTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var \Omnipay\PayPal\Message\RefundRequest
|
||||
*/
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$client = $this->getHttpClient();
|
||||
|
||||
$request = $this->getHttpRequest();
|
||||
|
||||
$this->request = new RefundRequest($client, $request);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideRefundTypes
|
||||
*/
|
||||
public function testGetData($type, $amount)
|
||||
{
|
||||
$this->request->setAmount($amount);
|
||||
$this->request->setCurrency('USD');
|
||||
$this->request->setTransactionReference('ABC-123');
|
||||
$this->request->setUsername('testuser');
|
||||
$this->request->setPassword('testpass');
|
||||
$this->request->setSignature('SIG');
|
||||
$this->request->setSubject('SUB');
|
||||
|
||||
$expected = array();
|
||||
$expected['REFUNDTYPE'] = $type;
|
||||
$expected['METHOD'] = 'RefundTransaction';
|
||||
$expected['TRANSACTIONID'] = 'ABC-123';
|
||||
$expected['USER'] = 'testuser';
|
||||
$expected['PWD'] = 'testpass';
|
||||
$expected['SIGNATURE'] = 'SIG';
|
||||
$expected['SUBJECT'] = 'SUB';
|
||||
$expected['VERSION'] = RefundRequest::API_VERSION;
|
||||
// $amount will be a formatted string, and '0.00' evaluates to true
|
||||
if ((float)$amount) {
|
||||
$expected['AMT'] = $amount;
|
||||
$expected['CURRENCYCODE'] = 'USD';
|
||||
}
|
||||
|
||||
$this->assertEquals($expected, $this->request->getData());
|
||||
}
|
||||
|
||||
public function provideRefundTypes()
|
||||
{
|
||||
return array(
|
||||
'Partial' => array('Partial', '1.23'),
|
||||
// All amounts must include decimals or be a float if the currency supports decimals.
|
||||
'Full' => array('Full', '0.00'),
|
||||
);
|
||||
}
|
||||
}
|
||||
37
vendor/omnipay/paypal/tests/Message/ResponseTest.php
vendored
Normal file
37
vendor/omnipay/paypal/tests/Message/ResponseTest.php
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Tests\TestCase;
|
||||
|
||||
class ResponseTest extends TestCase
|
||||
{
|
||||
public function testConstruct()
|
||||
{
|
||||
// response should decode URL format data
|
||||
$response = new Response($this->getMockRequest(), 'example=value&foo=bar');
|
||||
$this->assertEquals(array('example' => 'value', 'foo' => 'bar'), $response->getData());
|
||||
}
|
||||
|
||||
public function testProPurchaseSuccess()
|
||||
{
|
||||
$httpResponse = $this->getMockHttpResponse('ProPurchaseSuccess.txt');
|
||||
$response = new Response($this->getMockRequest(), $httpResponse->getBody());
|
||||
|
||||
$this->assertFalse($response->isPending());
|
||||
$this->assertTrue($response->isSuccessful());
|
||||
$this->assertSame('96U93778BD657313D', $response->getTransactionReference());
|
||||
$this->assertNull($response->getMessage());
|
||||
}
|
||||
|
||||
public function testProPurchaseFailure()
|
||||
{
|
||||
$httpResponse = $this->getMockHttpResponse('ProPurchaseFailure.txt');
|
||||
$response = new Response($this->getMockRequest(), $httpResponse->getBody());
|
||||
|
||||
$this->assertFalse($response->isPending());
|
||||
$this->assertFalse($response->isSuccessful());
|
||||
$this->assertNull($response->getTransactionReference());
|
||||
$this->assertSame('This transaction cannot be processed. Please enter a valid credit card expiration year.', $response->getMessage());
|
||||
}
|
||||
}
|
||||
129
vendor/omnipay/paypal/tests/Message/RestAuthorizeRequestTest.php
vendored
Normal file
129
vendor/omnipay/paypal/tests/Message/RestAuthorizeRequestTest.php
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Common\CreditCard;
|
||||
use Omnipay\Tests\TestCase;
|
||||
|
||||
class RestAuthorizeRequestTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var ProPurchaseRequest
|
||||
*/
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->request = new RestAuthorizeRequest($this->getHttpClient(), $this->getHttpRequest());
|
||||
$this->request->initialize(
|
||||
array(
|
||||
'amount' => '10.00',
|
||||
'currency' => 'USD',
|
||||
'returnUrl' => 'https://www.example.com/return',
|
||||
'cancelUrl' => 'https://www.example.com/cancel',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function testGetDataWithoutCard()
|
||||
{
|
||||
$this->request->setTransactionId('abc123');
|
||||
$this->request->setDescription('Sheep');
|
||||
|
||||
$data = $this->request->getData();
|
||||
|
||||
$this->assertSame('authorize', $data['intent']);
|
||||
$this->assertSame('paypal', $data['payer']['payment_method']);
|
||||
$this->assertSame('10.00', $data['transactions'][0]['amount']['total']);
|
||||
$this->assertSame('USD', $data['transactions'][0]['amount']['currency']);
|
||||
$this->assertSame('abc123 : Sheep', $data['transactions'][0]['description']);
|
||||
|
||||
// Funding instruments must not be set, otherwise paypal API will give error 500.
|
||||
$this->assertArrayNotHasKey('funding_instruments', $data['payer']);
|
||||
|
||||
$this->assertSame('https://www.example.com/return', $data['redirect_urls']['return_url']);
|
||||
$this->assertSame('https://www.example.com/cancel', $data['redirect_urls']['cancel_url']);
|
||||
}
|
||||
|
||||
public function testGetDataWithCard()
|
||||
{
|
||||
$card = new CreditCard($this->getValidCard());
|
||||
$card->setStartMonth(1);
|
||||
$card->setStartYear(2000);
|
||||
|
||||
$this->request->setCard($card);
|
||||
$this->request->setTransactionId('abc123');
|
||||
$this->request->setDescription('Sheep');
|
||||
$this->request->setClientIp('127.0.0.1');
|
||||
|
||||
$data = $this->request->getData();
|
||||
|
||||
$this->assertSame('authorize', $data['intent']);
|
||||
$this->assertSame('credit_card', $data['payer']['payment_method']);
|
||||
$this->assertSame('10.00', $data['transactions'][0]['amount']['total']);
|
||||
$this->assertSame('USD', $data['transactions'][0]['amount']['currency']);
|
||||
$this->assertSame('abc123 : Sheep', $data['transactions'][0]['description']);
|
||||
|
||||
$this->assertSame($card->getNumber(), $data['payer']['funding_instruments'][0]['credit_card']['number']);
|
||||
$this->assertSame($card->getBrand(), $data['payer']['funding_instruments'][0]['credit_card']['type']);
|
||||
$this->assertSame($card->getExpiryMonth(), $data['payer']['funding_instruments'][0]['credit_card']['expire_month']);
|
||||
$this->assertSame($card->getExpiryYear(), $data['payer']['funding_instruments'][0]['credit_card']['expire_year']);
|
||||
$this->assertSame($card->getCvv(), $data['payer']['funding_instruments'][0]['credit_card']['cvv2']);
|
||||
|
||||
$this->assertSame($card->getFirstName(), $data['payer']['funding_instruments'][0]['credit_card']['first_name']);
|
||||
$this->assertSame($card->getLastName(), $data['payer']['funding_instruments'][0]['credit_card']['last_name']);
|
||||
$this->assertSame($card->getAddress1(), $data['payer']['funding_instruments'][0]['credit_card']['billing_address']['line1']);
|
||||
$this->assertSame($card->getAddress2(), $data['payer']['funding_instruments'][0]['credit_card']['billing_address']['line2']);
|
||||
$this->assertSame($card->getCity(), $data['payer']['funding_instruments'][0]['credit_card']['billing_address']['city']);
|
||||
$this->assertSame($card->getState(), $data['payer']['funding_instruments'][0]['credit_card']['billing_address']['state']);
|
||||
$this->assertSame($card->getPostcode(), $data['payer']['funding_instruments'][0]['credit_card']['billing_address']['postal_code']);
|
||||
$this->assertSame($card->getCountry(), $data['payer']['funding_instruments'][0]['credit_card']['billing_address']['country_code']);
|
||||
}
|
||||
|
||||
public function testGetDataWithItems()
|
||||
{
|
||||
$this->request->setAmount('50.00');
|
||||
$this->request->setCurrency('USD');
|
||||
$this->request->setItems(array(
|
||||
array('name' => 'Floppy Disk', 'description' => 'MS-DOS', 'quantity' => 2, 'price' => 10),
|
||||
array('name' => 'CD-ROM', 'description' => 'Windows 95', 'quantity' => 1, 'price' => 40),
|
||||
));
|
||||
|
||||
$data = $this->request->getData();
|
||||
$transactionData = $data['transactions'][0];
|
||||
|
||||
$this->assertSame('Floppy Disk', $transactionData['item_list']['items'][0]['name']);
|
||||
$this->assertSame('MS-DOS', $transactionData['item_list']['items'][0]['description']);
|
||||
$this->assertSame(2, $transactionData['item_list']['items'][0]['quantity']);
|
||||
$this->assertSame('10.00', $transactionData['item_list']['items'][0]['price']);
|
||||
|
||||
$this->assertSame('CD-ROM', $transactionData['item_list']['items'][1]['name']);
|
||||
$this->assertSame('Windows 95', $transactionData['item_list']['items'][1]['description']);
|
||||
$this->assertSame(1, $transactionData['item_list']['items'][1]['quantity']);
|
||||
$this->assertSame('40.00', $transactionData['item_list']['items'][1]['price']);
|
||||
|
||||
$this->assertSame('50.00', $transactionData['amount']['total']);
|
||||
$this->assertSame('USD', $transactionData['amount']['currency']);
|
||||
}
|
||||
|
||||
public function testDescription()
|
||||
{
|
||||
$this->request->setTransactionId('');
|
||||
$this->request->setDescription('');
|
||||
$this->assertEmpty($this->request->getDescription());
|
||||
|
||||
$this->request->setTransactionId('');
|
||||
$this->request->setDescription('Sheep');
|
||||
$this->assertEquals('Sheep', $this->request->getDescription());
|
||||
|
||||
$this->request->setTransactionId('abc123');
|
||||
$this->request->setDescription('');
|
||||
$this->assertEquals('abc123', $this->request->getDescription());
|
||||
|
||||
$this->request->setTransactionId('abc123');
|
||||
$this->request->setDescription('Sheep');
|
||||
$this->assertEquals('abc123 : Sheep', $this->request->getDescription());
|
||||
}
|
||||
}
|
||||
26
vendor/omnipay/paypal/tests/Message/RestAuthorizeResponseTest.php
vendored
Normal file
26
vendor/omnipay/paypal/tests/Message/RestAuthorizeResponseTest.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
|
||||
use Omnipay\Tests\TestCase;
|
||||
|
||||
class RestAuthorizeResponseTest extends TestCase
|
||||
{
|
||||
public function testRestPurchaseWithoutCardSuccess()
|
||||
{
|
||||
$httpResponse = $this->getMockHttpResponse('RestPurchaseWithoutCardSuccess.txt');
|
||||
$data = json_decode($httpResponse->getBody()->getContents(), true);
|
||||
|
||||
$response = new RestAuthorizeResponse($this->getMockRequest(), $data, $httpResponse->getStatusCode());
|
||||
|
||||
$this->assertTrue($response->isSuccessful());
|
||||
$this->assertSame('PAY-3TJ47806DA028052TKTQGVYI', $response->getTransactionReference());
|
||||
$this->assertNull($response->getMessage());
|
||||
|
||||
$this->assertNull($response->getRedirectData());
|
||||
$this->assertSame('GET', $response->getRedirectMethod());
|
||||
$this->assertSame('https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-5KV58254GL528393N', $response->getRedirectUrl());
|
||||
}
|
||||
}
|
||||
30
vendor/omnipay/paypal/tests/Message/RestCancelSubscriptionRequestTest.php
vendored
Normal file
30
vendor/omnipay/paypal/tests/Message/RestCancelSubscriptionRequestTest.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Tests\TestCase;
|
||||
use Omnipay\PayPal\RestGateway;
|
||||
|
||||
class RestCancelSubscriptionRequestTest extends TestCase
|
||||
{
|
||||
/** @var \Omnipay\PayPal\Message\RestCancelSubscriptionRequest */
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$client = $this->getHttpClient();
|
||||
$request = $this->getHttpRequest();
|
||||
$this->request = new RestCancelSubscriptionRequest($client, $request);
|
||||
|
||||
$this->request->initialize(array(
|
||||
'transactionReference' => 'ABC-123',
|
||||
'description' => 'Cancel this subscription',
|
||||
));
|
||||
}
|
||||
|
||||
public function testGetData()
|
||||
{
|
||||
$data = $this->request->getData();
|
||||
$this->assertEquals('Cancel this subscription', $data['note']);
|
||||
}
|
||||
}
|
||||
37
vendor/omnipay/paypal/tests/Message/RestCompletePurchaseRequestTest.php
vendored
Normal file
37
vendor/omnipay/paypal/tests/Message/RestCompletePurchaseRequestTest.php
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
|
||||
use Omnipay\Tests\TestCase;
|
||||
|
||||
class RestCompletePurchaseRequestTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var RestCompletePurchaseRequest
|
||||
*/
|
||||
private $request;
|
||||
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$client = $this->getHttpClient();
|
||||
|
||||
$request = $this->getHttpRequest();
|
||||
$this->request = new RestCompletePurchaseRequest($client, $request);
|
||||
$this->request->initialize(array());
|
||||
}
|
||||
|
||||
public function testGetData()
|
||||
{
|
||||
$this->request->setTransactionReference('abc123');
|
||||
$this->request->setPayerId('Payer12345');
|
||||
|
||||
$data = $this->request->getData();
|
||||
|
||||
$this->assertSame('Payer12345', $data['payer_id']);
|
||||
}
|
||||
}
|
||||
29
vendor/omnipay/paypal/tests/Message/RestCompleteSubscriptionRequestTest.php
vendored
Normal file
29
vendor/omnipay/paypal/tests/Message/RestCompleteSubscriptionRequestTest.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Tests\TestCase;
|
||||
use Omnipay\PayPal\RestGateway;
|
||||
|
||||
class RestCompleteSubscriptionRequestTest extends TestCase
|
||||
{
|
||||
/** @var \Omnipay\PayPal\Message\RestCompleteSubscriptionRequest */
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$client = $this->getHttpClient();
|
||||
$request = $this->getHttpRequest();
|
||||
$this->request = new RestCompleteSubscriptionRequest($client, $request);
|
||||
|
||||
$this->request->initialize(array(
|
||||
'transactionReference' => 'ABC-123',
|
||||
));
|
||||
}
|
||||
|
||||
public function testGetData()
|
||||
{
|
||||
$data = $this->request->getData();
|
||||
$this->assertEquals(array(), $data);
|
||||
}
|
||||
}
|
||||
47
vendor/omnipay/paypal/tests/Message/RestCreateCardRequestTest.php
vendored
Normal file
47
vendor/omnipay/paypal/tests/Message/RestCreateCardRequestTest.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Common\CreditCard;
|
||||
use Omnipay\Tests\TestCase;
|
||||
|
||||
class RestCreateCardRequestTest extends TestCase
|
||||
{
|
||||
/** @var RestCreateCardRequest */
|
||||
protected $request;
|
||||
|
||||
/** @var CreditCard */
|
||||
protected $card;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->request = new RestCreateCardRequest($this->getHttpClient(), $this->getHttpRequest());
|
||||
|
||||
$card = $this->getValidCard();
|
||||
$this->card = new CreditCard($card);
|
||||
|
||||
$this->request->initialize(array('card' => $card));
|
||||
}
|
||||
|
||||
public function testGetData()
|
||||
{
|
||||
$card = $this->card;
|
||||
$data = $this->request->getData();
|
||||
|
||||
$this->assertSame($card->getNumber(), $data['number']);
|
||||
$this->assertSame($card->getBrand(), $data['type']);
|
||||
$this->assertSame($card->getExpiryMonth(), $data['expire_month']);
|
||||
$this->assertSame($card->getExpiryYear(), $data['expire_year']);
|
||||
$this->assertSame($card->getCvv(), $data['cvv2']);
|
||||
$this->assertSame($card->getFirstName(), $data['first_name']);
|
||||
$this->assertSame($card->getLastName(), $data['last_name']);
|
||||
$this->assertSame($card->getAddress1(), $data['billing_address']['line1']);
|
||||
$this->assertSame($card->getAddress2(), $data['billing_address']['line2']);
|
||||
$this->assertSame($card->getCity(), $data['billing_address']['city']);
|
||||
$this->assertSame($card->getState(), $data['billing_address']['state']);
|
||||
$this->assertSame($card->getPostcode(), $data['billing_address']['postal_code']);
|
||||
$this->assertSame($card->getCountry(), $data['billing_address']['country_code']);
|
||||
}
|
||||
}
|
||||
49
vendor/omnipay/paypal/tests/Message/RestCreatePlanRequestTest.php
vendored
Normal file
49
vendor/omnipay/paypal/tests/Message/RestCreatePlanRequestTest.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Tests\TestCase;
|
||||
use Omnipay\PayPal\RestGateway;
|
||||
|
||||
class RestCreatePlanRequestTest extends TestCase
|
||||
{
|
||||
/** @var \Omnipay\PayPal\Message\RestCreatePlanRequest */
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$client = $this->getHttpClient();
|
||||
$request = $this->getHttpRequest();
|
||||
$this->request = new RestCreatePlanRequest($client, $request);
|
||||
|
||||
$this->request->initialize(array(
|
||||
'name' => 'Super Duper Billing Plan',
|
||||
'description' => 'Test Billing Plan',
|
||||
'type' => RestGateway::BILLING_PLAN_TYPE_FIXED,
|
||||
'paymentDefinitions' => array(
|
||||
array(
|
||||
'name' => 'Monthly Payments',
|
||||
'type' => RestGateway::PAYMENT_REGULAR,
|
||||
'frequency' => RestGateway::BILLING_PLAN_FREQUENCY_MONTH,
|
||||
'frequency_interval' => 1,
|
||||
'cycles' => 12,
|
||||
'amount' => array(
|
||||
'value' => 10.00,
|
||||
'currency' => 'USD',
|
||||
)
|
||||
)
|
||||
),
|
||||
'merchantPreferences' => array(
|
||||
'name' => 'asdf',
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
public function testGetData()
|
||||
{
|
||||
$data = $this->request->getData();
|
||||
$this->assertEquals('Super Duper Billing Plan', $data['name']);
|
||||
$this->assertEquals(RestGateway::BILLING_PLAN_TYPE_FIXED, $data['type']);
|
||||
$this->assertEquals('Monthly Payments', $data['payment_definitions'][0]['name']);
|
||||
}
|
||||
}
|
||||
38
vendor/omnipay/paypal/tests/Message/RestCreateSubscriptionRequestTest.php
vendored
Normal file
38
vendor/omnipay/paypal/tests/Message/RestCreateSubscriptionRequestTest.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Tests\TestCase;
|
||||
use Omnipay\PayPal\RestGateway;
|
||||
|
||||
class RestCreateSubscriptionRequestTest extends TestCase
|
||||
{
|
||||
/** @var \Omnipay\PayPal\Message\RestCreateSubscriptionRequest */
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$client = $this->getHttpClient();
|
||||
$request = $this->getHttpRequest();
|
||||
$this->request = new RestCreateSubscriptionRequest($client, $request);
|
||||
|
||||
$this->request->initialize(array(
|
||||
'name' => 'Test Subscription',
|
||||
'description' => 'Test Billing Subscription',
|
||||
'startDate' => new \DateTime('now', new \DateTimeZone('UTC')),
|
||||
'planId' => 'ABC-123',
|
||||
'payerDetails' => array(
|
||||
'payment_method' => 'paypal',
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
public function testGetData()
|
||||
{
|
||||
$data = $this->request->getData();
|
||||
$this->assertEquals('Test Subscription', $data['name']);
|
||||
$this->assertEquals('Test Billing Subscription', $data['description']);
|
||||
$this->assertEquals('ABC-123', $data['plan']['id']);
|
||||
$this->assertEquals('paypal', $data['payer']['payment_method']);
|
||||
}
|
||||
}
|
||||
35
vendor/omnipay/paypal/tests/Message/RestDeleteCardRequestTest.php
vendored
Normal file
35
vendor/omnipay/paypal/tests/Message/RestDeleteCardRequestTest.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Common\CreditCard;
|
||||
use Omnipay\Tests\TestCase;
|
||||
|
||||
class RestDeleteCardRequestTest extends TestCase
|
||||
{
|
||||
/** @var RestDeleteCardRequest */
|
||||
private $request;
|
||||
|
||||
/** @var CreditCard */
|
||||
private $card;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->request = new RestDeleteCardRequest($this->getHttpClient(), $this->getHttpRequest());
|
||||
$this->request->initialize(array('cardReference' => 'CARD-TEST123'));
|
||||
}
|
||||
|
||||
public function testGetData()
|
||||
{
|
||||
$data = $this->request->getData();
|
||||
$this->assertTrue(is_array($data));
|
||||
$this->assertEmpty($data);
|
||||
}
|
||||
|
||||
public function testEndpoint()
|
||||
{
|
||||
$this->assertStringEndsWith('/vault/credit-cards/CARD-TEST123', $this->request->getEndpoint());
|
||||
}
|
||||
}
|
||||
24
vendor/omnipay/paypal/tests/Message/RestFetchPurchaseRequestTest.php
vendored
Normal file
24
vendor/omnipay/paypal/tests/Message/RestFetchPurchaseRequestTest.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Tests\TestCase;
|
||||
|
||||
class RestFetchPurchaseRequestTest extends TestCase
|
||||
{
|
||||
/** @var \Omnipay\PayPal\Message\RestFetchPurchaseRequest */
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$client = $this->getHttpClient();
|
||||
$request = $this->getHttpRequest();
|
||||
$this->request = new RestFetchPurchaseRequest($client, $request);
|
||||
}
|
||||
|
||||
public function testEndpoint()
|
||||
{
|
||||
$this->request->setTransactionReference('ABC-123');
|
||||
$this->assertStringEndsWith('/payments/payment/ABC-123', $this->request->getEndpoint());
|
||||
}
|
||||
}
|
||||
31
vendor/omnipay/paypal/tests/Message/RestFetchTransactionRequestTest.php
vendored
Normal file
31
vendor/omnipay/paypal/tests/Message/RestFetchTransactionRequestTest.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Tests\TestCase;
|
||||
|
||||
class RestFetchTransactionRequestTest extends TestCase
|
||||
{
|
||||
/** @var \Omnipay\PayPal\Message\RestFetchTransactionRequest */
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$client = $this->getHttpClient();
|
||||
$request = $this->getHttpRequest();
|
||||
$this->request = new RestFetchTransactionRequest($client, $request);
|
||||
}
|
||||
|
||||
public function testGetData()
|
||||
{
|
||||
$this->request->setTransactionReference('ABC-123');
|
||||
$data = $this->request->getData();
|
||||
$this->assertEquals(array(), $data);
|
||||
}
|
||||
|
||||
public function testEndpoint()
|
||||
{
|
||||
$this->request->setTransactionReference('ABC-123');
|
||||
$this->assertStringEndsWith('/payments/sale/ABC-123', $this->request->getEndpoint());
|
||||
}
|
||||
}
|
||||
33
vendor/omnipay/paypal/tests/Message/RestListPlanRequestTest.php
vendored
Normal file
33
vendor/omnipay/paypal/tests/Message/RestListPlanRequestTest.php
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Tests\TestCase;
|
||||
|
||||
class RestListPlanRequestTest extends TestCase
|
||||
{
|
||||
/** @var \Omnipay\PayPal\Message\RestListPlanRequest */
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$client = $this->getHttpClient();
|
||||
$request = $this->getHttpRequest();
|
||||
$this->request = new RestListPlanRequest($client, $request);
|
||||
}
|
||||
|
||||
public function testGetData()
|
||||
{
|
||||
$data = $this->request->getData();
|
||||
$this->assertArrayHasKey('page',$data);
|
||||
$this->assertArrayHasKey('status',$data);
|
||||
$this->assertArrayHasKey('page_size',$data);
|
||||
$this->assertArrayHasKey('total_required',$data);
|
||||
}
|
||||
|
||||
public function testEndpoint()
|
||||
{
|
||||
$this->assertStringEndsWith('/payments/billing-plans', $this->request->getEndpoint());
|
||||
}
|
||||
|
||||
}
|
||||
76
vendor/omnipay/paypal/tests/Message/RestPurchaseRequestTest.php
vendored
Normal file
76
vendor/omnipay/paypal/tests/Message/RestPurchaseRequestTest.php
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Common\CreditCard;
|
||||
use Omnipay\Tests\TestCase;
|
||||
|
||||
class RestPurchaseRequestTest extends TestCase
|
||||
{
|
||||
/** @var RestPurchaseRequest */
|
||||
private $request;
|
||||
|
||||
public function testGetData()
|
||||
{
|
||||
$card = new CreditCard($this->getValidCard());
|
||||
$card->setStartMonth(1);
|
||||
$card->setStartYear(2000);
|
||||
|
||||
$this->request = new RestPurchaseRequest($this->getHttpClient(), $this->getHttpRequest());
|
||||
$this->request->initialize(array(
|
||||
'amount' => '10.00',
|
||||
'currency' => 'USD',
|
||||
'card' => $card
|
||||
));
|
||||
|
||||
$this->request->setTransactionId('abc123');
|
||||
$this->request->setDescription('Sheep');
|
||||
$this->request->setClientIp('127.0.0.1');
|
||||
|
||||
$data = $this->request->getData();
|
||||
|
||||
$this->assertSame('sale', $data['intent']);
|
||||
$this->assertSame('credit_card', $data['payer']['payment_method']);
|
||||
$this->assertSame('10.00', $data['transactions'][0]['amount']['total']);
|
||||
$this->assertSame('USD', $data['transactions'][0]['amount']['currency']);
|
||||
$this->assertSame('abc123 : Sheep', $data['transactions'][0]['description']);
|
||||
|
||||
$this->assertSame($card->getNumber(), $data['payer']['funding_instruments'][0]['credit_card']['number']);
|
||||
$this->assertSame($card->getBrand(), $data['payer']['funding_instruments'][0]['credit_card']['type']);
|
||||
$this->assertSame($card->getExpiryMonth(), $data['payer']['funding_instruments'][0]['credit_card']['expire_month']);
|
||||
$this->assertSame($card->getExpiryYear(), $data['payer']['funding_instruments'][0]['credit_card']['expire_year']);
|
||||
$this->assertSame($card->getCvv(), $data['payer']['funding_instruments'][0]['credit_card']['cvv2']);
|
||||
|
||||
$this->assertSame($card->getFirstName(), $data['payer']['funding_instruments'][0]['credit_card']['first_name']);
|
||||
$this->assertSame($card->getLastName(), $data['payer']['funding_instruments'][0]['credit_card']['last_name']);
|
||||
$this->assertSame($card->getAddress1(), $data['payer']['funding_instruments'][0]['credit_card']['billing_address']['line1']);
|
||||
$this->assertSame($card->getAddress2(), $data['payer']['funding_instruments'][0]['credit_card']['billing_address']['line2']);
|
||||
$this->assertSame($card->getCity(), $data['payer']['funding_instruments'][0]['credit_card']['billing_address']['city']);
|
||||
$this->assertSame($card->getState(), $data['payer']['funding_instruments'][0]['credit_card']['billing_address']['state']);
|
||||
$this->assertSame($card->getPostcode(), $data['payer']['funding_instruments'][0]['credit_card']['billing_address']['postal_code']);
|
||||
$this->assertSame($card->getCountry(), $data['payer']['funding_instruments'][0]['credit_card']['billing_address']['country_code']);
|
||||
}
|
||||
|
||||
public function testGetDataWithCardRef()
|
||||
{
|
||||
$this->request = new RestPurchaseRequest($this->getHttpClient(), $this->getHttpRequest());
|
||||
$this->request->initialize(array(
|
||||
'amount' => '10.00',
|
||||
'currency' => 'USD',
|
||||
'cardReference' => 'CARD-123',
|
||||
));
|
||||
|
||||
$this->request->setTransactionId('abc123');
|
||||
$this->request->setDescription('Sheep');
|
||||
$this->request->setClientIp('127.0.0.1');
|
||||
|
||||
$data = $this->request->getData();
|
||||
|
||||
$this->assertSame('sale', $data['intent']);
|
||||
$this->assertSame('credit_card', $data['payer']['payment_method']);
|
||||
$this->assertSame('10.00', $data['transactions'][0]['amount']['total']);
|
||||
$this->assertSame('USD', $data['transactions'][0]['amount']['currency']);
|
||||
$this->assertSame('abc123 : Sheep', $data['transactions'][0]['description']);
|
||||
$this->assertSame('CARD-123', $data['payer']['funding_instruments'][0]['credit_card_token']['credit_card_id']);
|
||||
}
|
||||
}
|
||||
30
vendor/omnipay/paypal/tests/Message/RestReactivateSubscriptionRequestTest.php
vendored
Normal file
30
vendor/omnipay/paypal/tests/Message/RestReactivateSubscriptionRequestTest.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Tests\TestCase;
|
||||
use Omnipay\PayPal\RestGateway;
|
||||
|
||||
class RestReactivateSubscriptionRequestTest extends TestCase
|
||||
{
|
||||
/** @var \Omnipay\PayPal\Message\RestReactivateSubscriptionRequest */
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$client = $this->getHttpClient();
|
||||
$request = $this->getHttpRequest();
|
||||
$this->request = new RestReactivateSubscriptionRequest($client, $request);
|
||||
|
||||
$this->request->initialize(array(
|
||||
'transactionReference' => 'ABC-123',
|
||||
'description' => 'Reactivate this subscription',
|
||||
));
|
||||
}
|
||||
|
||||
public function testGetData()
|
||||
{
|
||||
$data = $this->request->getData();
|
||||
$this->assertEquals('Reactivate this subscription', $data['note']);
|
||||
}
|
||||
}
|
||||
89
vendor/omnipay/paypal/tests/Message/RestResponseTest.php
vendored
Normal file
89
vendor/omnipay/paypal/tests/Message/RestResponseTest.php
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Tests\TestCase;
|
||||
|
||||
class RestResponseTest extends TestCase
|
||||
{
|
||||
public function testPurchaseSuccess()
|
||||
{
|
||||
$httpResponse = $this->getMockHttpResponse('RestPurchaseSuccess.txt');
|
||||
$data = json_decode($httpResponse->getBody()->getContents(), true);
|
||||
$response = new RestResponse($this->getMockRequest(), $data, $httpResponse->getStatusCode());
|
||||
|
||||
$this->assertTrue($response->isSuccessful());
|
||||
$this->assertSame('44E89981F8714392Y', $response->getTransactionReference());
|
||||
$this->assertNull($response->getMessage());
|
||||
}
|
||||
|
||||
public function testPurchaseFailure()
|
||||
{
|
||||
$httpResponse = $this->getMockHttpResponse('RestPurchaseFailure.txt');
|
||||
$data = json_decode($httpResponse->getBody()->getContents(), true);
|
||||
$response = new RestResponse($this->getMockRequest(), $data, $httpResponse->getStatusCode());
|
||||
|
||||
$this->assertFalse($response->isSuccessful());
|
||||
$this->assertNull($response->getTransactionReference());
|
||||
$this->assertSame('Invalid request - see details', $response->getMessage());
|
||||
}
|
||||
|
||||
public function testCompletePurchaseSuccess()
|
||||
{
|
||||
$httpResponse = $this->getMockHttpResponse('RestCompletePurchaseSuccess.txt');
|
||||
$data = json_decode($httpResponse->getBody()->getContents(), true);
|
||||
|
||||
$response = new RestResponse($this->getMockRequest(), $data, $httpResponse->getStatusCode());
|
||||
|
||||
$this->assertTrue($response->isSuccessful());
|
||||
$this->assertSame('9EA05739TH369572R', $response->getTransactionReference());
|
||||
$this->assertNull($response->getMessage());
|
||||
}
|
||||
|
||||
public function testCompletePurchaseFailure()
|
||||
{
|
||||
$httpResponse = $this->getMockHttpResponse('RestCompletePurchaseFailure.txt');
|
||||
$data = json_decode($httpResponse->getBody()->getContents(), true);
|
||||
|
||||
$response = new RestResponse($this->getMockRequest(), $data, $httpResponse->getStatusCode());
|
||||
|
||||
$this->assertFalse($response->isSuccessful());
|
||||
$this->assertNull($response->getTransactionReference());
|
||||
$this->assertSame('This request is invalid due to the current state of the payment', $response->getMessage());
|
||||
}
|
||||
|
||||
public function testTokenFailure()
|
||||
{
|
||||
$httpResponse = $this->getMockHttpResponse('RestTokenFailure.txt');
|
||||
$data = json_decode($httpResponse->getBody()->getContents(), true);
|
||||
|
||||
$response = new RestResponse($this->getMockRequest(), $data, $httpResponse->getStatusCode());
|
||||
|
||||
$this->assertFalse($response->isSuccessful());
|
||||
$this->assertSame('Client secret does not match for this client', $response->getMessage());
|
||||
}
|
||||
|
||||
public function testAuthorizeSuccess()
|
||||
{
|
||||
$httpResponse = $this->getMockHttpResponse('RestAuthorizationSuccess.txt');
|
||||
$data = json_decode($httpResponse->getBody()->getContents(), true);
|
||||
|
||||
$response = new RestResponse($this->getMockRequest(), $data, $httpResponse->getStatusCode());
|
||||
|
||||
$this->assertTrue($response->isSuccessful());
|
||||
$this->assertSame('58N7596879166930B', $response->getTransactionReference());
|
||||
$this->assertNull($response->getMessage());
|
||||
}
|
||||
|
||||
public function testCreateCardSuccess()
|
||||
{
|
||||
$httpResponse = $this->getMockHttpResponse('RestCreateCardSuccess.txt');
|
||||
$data = json_decode($httpResponse->getBody()->getContents(), true);
|
||||
|
||||
$response = new RestResponse($this->getMockRequest(), $data, $httpResponse->getStatusCode());
|
||||
|
||||
$this->assertTrue($response->isSuccessful());
|
||||
$this->assertSame('CARD-70E78145XN686604FKO3L6OQ', $response->getCardReference());
|
||||
$this->assertNull($response->getMessage());
|
||||
}
|
||||
}
|
||||
37
vendor/omnipay/paypal/tests/Message/RestSearchTransactionRequestTest.php
vendored
Normal file
37
vendor/omnipay/paypal/tests/Message/RestSearchTransactionRequestTest.php
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Tests\TestCase;
|
||||
use Omnipay\PayPal\RestGateway;
|
||||
|
||||
class RestSearchTransactionRequestTest extends TestCase
|
||||
{
|
||||
/** @var \Omnipay\PayPal\Message\RestSearchTransactionRequest */
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$client = $this->getHttpClient();
|
||||
$request = $this->getHttpRequest();
|
||||
$this->request = new RestSearchTransactionRequest($client, $request);
|
||||
|
||||
$this->request->initialize(array(
|
||||
'agreementId' => 'ABC-123',
|
||||
'startDate' => '2015-09-01',
|
||||
'endDate' => '2015-09-30',
|
||||
));
|
||||
}
|
||||
|
||||
public function testGetData()
|
||||
{
|
||||
$data = $this->request->getData();
|
||||
$this->assertEquals('2015-09-01', $data['start_date']);
|
||||
$this->assertEquals('2015-09-30', $data['end_date']);
|
||||
}
|
||||
|
||||
public function testEndpoint()
|
||||
{
|
||||
$this->assertStringEndsWith('/payments/billing-agreements/ABC-123/transactions', $this->request->getEndpoint());
|
||||
}
|
||||
}
|
||||
30
vendor/omnipay/paypal/tests/Message/RestSuspendSubscriptionRequestTest.php
vendored
Normal file
30
vendor/omnipay/paypal/tests/Message/RestSuspendSubscriptionRequestTest.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Tests\TestCase;
|
||||
use Omnipay\PayPal\RestGateway;
|
||||
|
||||
class RestSuspendSubscriptionRequestTest extends TestCase
|
||||
{
|
||||
/** @var \Omnipay\PayPal\Message\RestSuspendSubscriptionRequest */
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$client = $this->getHttpClient();
|
||||
$request = $this->getHttpRequest();
|
||||
$this->request = new RestSuspendSubscriptionRequest($client, $request);
|
||||
|
||||
$this->request->initialize(array(
|
||||
'transactionReference' => 'ABC-123',
|
||||
'description' => 'Suspend this subscription',
|
||||
));
|
||||
}
|
||||
|
||||
public function testGetData()
|
||||
{
|
||||
$data = $this->request->getData();
|
||||
$this->assertEquals('Suspend this subscription', $data['note']);
|
||||
}
|
||||
}
|
||||
31
vendor/omnipay/paypal/tests/Message/RestUpdatePlanRequestTest.php
vendored
Normal file
31
vendor/omnipay/paypal/tests/Message/RestUpdatePlanRequestTest.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\PayPal\Message;
|
||||
|
||||
use Omnipay\Tests\TestCase;
|
||||
use Omnipay\PayPal\RestGateway;
|
||||
|
||||
class RestUpdatePlanRequestTest extends TestCase
|
||||
{
|
||||
/** @var \Omnipay\PayPal\Message\RestUpdatePlanRequest */
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$client = $this->getHttpClient();
|
||||
$request = $this->getHttpRequest();
|
||||
$this->request = new RestUpdatePlanRequest($client, $request);
|
||||
|
||||
$this->request->initialize(array(
|
||||
'transactionReference' => 'ABC-123',
|
||||
'state' => 'ACTIVE',
|
||||
));
|
||||
}
|
||||
|
||||
public function testGetData()
|
||||
{
|
||||
$data = $this->request->getData();
|
||||
$this->assertEquals('/', $data[0]['path']);
|
||||
$this->assertEquals('ACTIVE', $data[0]['value']['state']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user