Enabled Billing Plans and Agreements APIs

- Added API Classes, Samples, and Tests
- Updated Functional Tests
- Updated Documentation with new SDK Name
- Updated Few Samples to use newer nicer result page
This commit is contained in:
japatel
2014-10-31 10:16:13 -05:00
parent f55fd3d984
commit 4d481ad104
192 changed files with 13310 additions and 1045 deletions

View File

@@ -1,59 +1,108 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\Address;
/**
* Class Address
*
* @package PayPal\Test\Api
*/
class AddressTest extends \PHPUnit_Framework_TestCase
{
/** @var Address */
private $address;
public static $line1 = "3909 Witmer Road";
public static $line2 = "Niagara Falls";
public static $city = "Niagara Falls";
public static $state = "NY";
public static $postalCode = "14305";
public static $countryCode = "US";
public static $phone = "716-298-1822";
public static $type = "Billing";
public static function createAddress()
/**
* Gets Json String of Object Address
* @return string
*/
public static function getJson()
{
$addr = new Address();
$addr->setLine1(self::$line1);
$addr->setLine2(self::$line2);
$addr->setCity(self::$city);
$addr->setState(self::$state);
$addr->setPostalCode(self::$postalCode);
$addr->setCountryCode(self::$countryCode);
$addr->setPhone(self::$phone);
return $addr;
return '{"line1":"TestSample","line2":"TestSample","city":"TestSample","country_code":"TestSample","postal_code":"TestSample","state":"TestSample","phone":"TestSample"}';
}
public function setup()
/**
* Gets Object Instance with Json data filled in
* @return Address
*/
public static function getObject()
{
$this->address = self::createAddress();
return new Address(self::getJson());
}
public function testGetterSetter()
/**
* Tests for Serialization and Deserialization Issues
* @return Address
*/
public function testSerializationDeserialization()
{
$this->assertEquals(self::$line1, $this->address->getLine1());
$this->assertEquals(self::$line2, $this->address->getLine2());
$this->assertEquals(self::$city, $this->address->getCity());
$this->assertEquals(self::$state, $this->address->getState());
$this->assertEquals(self::$postalCode, $this->address->getPostalCode());
$this->assertEquals(self::$countryCode, $this->address->getCountryCode());
$this->assertEquals(self::$phone, $this->address->getPhone());
$obj = new Address(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getLine1());
$this->assertNotNull($obj->getLine2());
$this->assertNotNull($obj->getCity());
$this->assertNotNull($obj->getCountryCode());
$this->assertNotNull($obj->getPostalCode());
$this->assertNotNull($obj->getState());
$this->assertNotNull($obj->getPhone());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
public function testSerializeDeserialize()
/**
* @depends testSerializationDeserialization
* @param Address $obj
*/
public function testGetters($obj)
{
$a1 = $this->address;
$a2 = new Address();
$a2->fromJson($a1->toJson());
$this->assertEquals($a1, $a2);
$this->assertEquals($obj->getLine1(), "TestSample");
$this->assertEquals($obj->getLine2(), "TestSample");
$this->assertEquals($obj->getCity(), "TestSample");
$this->assertEquals($obj->getCountryCode(), "TestSample");
$this->assertEquals($obj->getPostalCode(), "TestSample");
$this->assertEquals($obj->getState(), "TestSample");
$this->assertEquals($obj->getPhone(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param Address $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getCountry_code(), "TestSample");
$this->assertEquals($obj->getPostal_code(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param Address $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Country_code
$obj->setCountryCode(null);
$this->assertNull($obj->getCountry_code());
$this->assertNull($obj->getCountryCode());
$this->assertSame($obj->getCountryCode(), $obj->getCountry_code());
$obj->setCountry_code("TestSample");
$this->assertEquals($obj->getCountry_code(), "TestSample");
// Check for Postal_code
$obj->setPostalCode(null);
$this->assertNull($obj->getPostal_code());
$this->assertNull($obj->getPostalCode());
$this->assertSame($obj->getPostalCode(), $obj->getPostal_code());
$obj->setPostal_code("TestSample");
$this->assertEquals($obj->getPostal_code(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,80 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\AgreementStateDescriptor;
/**
* Class AgreementStateDescriptor
*
* @package PayPal\Test\Api
*/
class AgreementStateDescriptorTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object AgreementStateDescriptor
* @return string
*/
public static function getJson()
{
return '{"note":"TestSample","amount":' .CurrencyTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return AgreementStateDescriptor
*/
public static function getObject()
{
return new AgreementStateDescriptor(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return AgreementStateDescriptor
*/
public function testSerializationDeserialization()
{
$obj = new AgreementStateDescriptor(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getNote());
$this->assertNotNull($obj->getAmount());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param AgreementStateDescriptor $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getNote(), "TestSample");
$this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param AgreementStateDescriptor $obj
*/
public function testDeprecatedGetters($obj)
{
}
/**
* @depends testSerializationDeserialization
* @param AgreementStateDescriptor $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,367 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\ResourceModel;
use PayPal\Validation\ArgumentValidator;
use PayPal\Api\AgreementTransactions;
use PayPal\Rest\ApiContext;
use PayPal\Transport\PPRestCall;
use PayPal\Api\Agreement;
/**
* Class Agreement
*
* @package PayPal\Test\Api
*/
class AgreementTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Agreement
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","state":"TestSample","name":"TestSample","description":"TestSample","start_date":"TestSample","payer":' .PayerTest::getJson() . ',"shipping_address":' .AddressTest::getJson() . ',"override_merchant_preferences":' .MerchantPreferencesTest::getJson() . ',"override_charge_models":' .OverrideChargeModelTest::getJson() . ',"plan":' .PlanTest::getJson() . ',"create_time":"TestSample","update_time":"TestSample","links":' .LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return Agreement
*/
public static function getObject()
{
return new Agreement(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Agreement
*/
public function testSerializationDeserialization()
{
$obj = new Agreement(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getState());
$this->assertNotNull($obj->getName());
$this->assertNotNull($obj->getDescription());
$this->assertNotNull($obj->getStartDate());
$this->assertNotNull($obj->getPayer());
$this->assertNotNull($obj->getShippingAddress());
$this->assertNotNull($obj->getOverrideMerchantPreferences());
$this->assertNotNull($obj->getOverrideChargeModels());
$this->assertNotNull($obj->getPlan());
$this->assertNotNull($obj->getCreateTime());
$this->assertNotNull($obj->getUpdateTime());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Agreement $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getState(), "TestSample");
$this->assertEquals($obj->getName(), "TestSample");
$this->assertEquals($obj->getDescription(), "TestSample");
$this->assertEquals($obj->getStartDate(), "TestSample");
$this->assertEquals($obj->getPayer(), PayerTest::getObject());
$this->assertEquals($obj->getShippingAddress(), AddressTest::getObject());
$this->assertEquals($obj->getOverrideMerchantPreferences(), MerchantPreferencesTest::getObject());
$this->assertEquals($obj->getOverrideChargeModels(), OverrideChargeModelTest::getObject());
$this->assertEquals($obj->getPlan(), PlanTest::getObject());
$this->assertEquals($obj->getCreateTime(), "TestSample");
$this->assertEquals($obj->getUpdateTime(), "TestSample");
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param Agreement $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getStart_date(), "TestSample");
$this->assertEquals($obj->getShipping_address(), AddressTest::getObject());
$this->assertEquals($obj->getOverride_merchant_preferences(), MerchantPreferencesTest::getObject());
$this->assertEquals($obj->getOverride_charge_models(), OverrideChargeModelTest::getObject());
$this->assertEquals($obj->getCreate_time(), "TestSample");
$this->assertEquals($obj->getUpdate_time(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param Agreement $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Start_date
$obj->setStartDate(null);
$this->assertNull($obj->getStart_date());
$this->assertNull($obj->getStartDate());
$this->assertSame($obj->getStartDate(), $obj->getStart_date());
$obj->setStart_date("TestSample");
$this->assertEquals($obj->getStart_date(), "TestSample");
// Check for Shipping_address
$obj->setShippingAddress(null);
$this->assertNull($obj->getShipping_address());
$this->assertNull($obj->getShippingAddress());
$this->assertSame($obj->getShippingAddress(), $obj->getShipping_address());
$obj->setShipping_address(AddressTest::getObject());
$this->assertEquals($obj->getShipping_address(), AddressTest::getObject());
// Check for Override_merchant_preferences
$obj->setOverrideMerchantPreferences(null);
$this->assertNull($obj->getOverride_merchant_preferences());
$this->assertNull($obj->getOverrideMerchantPreferences());
$this->assertSame($obj->getOverrideMerchantPreferences(), $obj->getOverride_merchant_preferences());
$obj->setOverride_merchant_preferences(MerchantPreferencesTest::getObject());
$this->assertEquals($obj->getOverride_merchant_preferences(), MerchantPreferencesTest::getObject());
// Check for Override_charge_models
$obj->setOverrideChargeModels(null);
$this->assertNull($obj->getOverride_charge_models());
$this->assertNull($obj->getOverrideChargeModels());
$this->assertSame($obj->getOverrideChargeModels(), $obj->getOverride_charge_models());
$obj->setOverride_charge_models(OverrideChargeModelTest::getObject());
$this->assertEquals($obj->getOverride_charge_models(), OverrideChargeModelTest::getObject());
// Check for Create_time
$obj->setCreateTime(null);
$this->assertNull($obj->getCreate_time());
$this->assertNull($obj->getCreateTime());
$this->assertSame($obj->getCreateTime(), $obj->getCreate_time());
$obj->setCreate_time("TestSample");
$this->assertEquals($obj->getCreate_time(), "TestSample");
// Check for Update_time
$obj->setUpdateTime(null);
$this->assertNull($obj->getUpdate_time());
$this->assertNull($obj->getUpdateTime());
$this->assertSame($obj->getUpdateTime(), $obj->getUpdate_time());
$obj->setUpdate_time("TestSample");
$this->assertEquals($obj->getUpdate_time(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testCreate($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$result = $obj->create($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testExecute($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$result = $obj->execute("123123", $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testGet($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
AgreementTest::getJson()
));
$result = $obj->get("agreementId", $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testUpdate($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$patchRequest = PatchRequestTest::getObject();
$result = $obj->update($patchRequest, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testSuspend($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$agreementStateDescriptor = AgreementStateDescriptorTest::getObject();
$result = $obj->suspend($agreementStateDescriptor, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testReActivate($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$agreementStateDescriptor = AgreementStateDescriptorTest::getObject();
$result = $obj->reActivate($agreementStateDescriptor, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testCancel($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$agreementStateDescriptor = AgreementStateDescriptorTest::getObject();
$result = $obj->cancel($agreementStateDescriptor, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testBillBalance($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$agreementStateDescriptor = AgreementStateDescriptorTest::getObject();
$result = $obj->billBalance($agreementStateDescriptor, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testSetBalance($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$currency = CurrencyTest::getObject();
$result = $obj->setBalance($currency, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Agreement $obj
*/
public function testTransactions($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
AgreementTransactionsTest::getJson()
));
$result = $obj->transactions("agreementId", $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
public function mockProvider()
{
$obj = self::getObject();
$mockApiContext = $this->getMockBuilder('ApiContext')
->disableOriginalConstructor()
->getMock();
return array(
array($obj, $mockApiContext),
array($obj, null)
);
}
}

View File

@@ -0,0 +1,168 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\AgreementTransaction;
/**
* Class AgreementTransaction
*
* @package PayPal\Test\Api
*/
class AgreementTransactionTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object AgreementTransaction
* @return string
*/
public static function getJson()
{
return '{"transaction_id":"TestSample","status":"TestSample","transaction_type":"TestSample","amount":' .CurrencyTest::getJson() . ',"fee_amount":' .CurrencyTest::getJson() . ',"net_amount":' .CurrencyTest::getJson() . ',"payer_email":"TestSample","payer_name":"TestSample","time_updated":"TestSample","time_zone":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return AgreementTransaction
*/
public static function getObject()
{
return new AgreementTransaction(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return AgreementTransaction
*/
public function testSerializationDeserialization()
{
$obj = new AgreementTransaction(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getTransactionId());
$this->assertNotNull($obj->getStatus());
$this->assertNotNull($obj->getTransactionType());
$this->assertNotNull($obj->getAmount());
$this->assertNotNull($obj->getFeeAmount());
$this->assertNotNull($obj->getNetAmount());
$this->assertNotNull($obj->getPayerEmail());
$this->assertNotNull($obj->getPayerName());
$this->assertNotNull($obj->getTimeUpdated());
$this->assertNotNull($obj->getTimeZone());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param AgreementTransaction $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getTransactionId(), "TestSample");
$this->assertEquals($obj->getStatus(), "TestSample");
$this->assertEquals($obj->getTransactionType(), "TestSample");
$this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
$this->assertEquals($obj->getFeeAmount(), CurrencyTest::getObject());
$this->assertEquals($obj->getNetAmount(), CurrencyTest::getObject());
$this->assertEquals($obj->getPayerEmail(), "TestSample");
$this->assertEquals($obj->getPayerName(), "TestSample");
$this->assertEquals($obj->getTimeUpdated(), "TestSample");
$this->assertEquals($obj->getTimeZone(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param AgreementTransaction $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getTransaction_id(), "TestSample");
$this->assertEquals($obj->getTransaction_type(), "TestSample");
$this->assertEquals($obj->getFee_amount(), CurrencyTest::getObject());
$this->assertEquals($obj->getNet_amount(), CurrencyTest::getObject());
$this->assertEquals($obj->getPayer_email(), "TestSample");
$this->assertEquals($obj->getPayer_name(), "TestSample");
$this->assertEquals($obj->getTime_updated(), "TestSample");
$this->assertEquals($obj->getTime_zone(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param AgreementTransaction $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Transaction_id
$obj->setTransactionId(null);
$this->assertNull($obj->getTransaction_id());
$this->assertNull($obj->getTransactionId());
$this->assertSame($obj->getTransactionId(), $obj->getTransaction_id());
$obj->setTransaction_id("TestSample");
$this->assertEquals($obj->getTransaction_id(), "TestSample");
// Check for Transaction_type
$obj->setTransactionType(null);
$this->assertNull($obj->getTransaction_type());
$this->assertNull($obj->getTransactionType());
$this->assertSame($obj->getTransactionType(), $obj->getTransaction_type());
$obj->setTransaction_type("TestSample");
$this->assertEquals($obj->getTransaction_type(), "TestSample");
// Check for Fee_amount
$obj->setFeeAmount(null);
$this->assertNull($obj->getFee_amount());
$this->assertNull($obj->getFeeAmount());
$this->assertSame($obj->getFeeAmount(), $obj->getFee_amount());
$obj->setFee_amount(CurrencyTest::getObject());
$this->assertEquals($obj->getFee_amount(), CurrencyTest::getObject());
// Check for Net_amount
$obj->setNetAmount(null);
$this->assertNull($obj->getNet_amount());
$this->assertNull($obj->getNetAmount());
$this->assertSame($obj->getNetAmount(), $obj->getNet_amount());
$obj->setNet_amount(CurrencyTest::getObject());
$this->assertEquals($obj->getNet_amount(), CurrencyTest::getObject());
// Check for Payer_email
$obj->setPayerEmail(null);
$this->assertNull($obj->getPayer_email());
$this->assertNull($obj->getPayerEmail());
$this->assertSame($obj->getPayerEmail(), $obj->getPayer_email());
$obj->setPayer_email("TestSample");
$this->assertEquals($obj->getPayer_email(), "TestSample");
// Check for Payer_name
$obj->setPayerName(null);
$this->assertNull($obj->getPayer_name());
$this->assertNull($obj->getPayerName());
$this->assertSame($obj->getPayerName(), $obj->getPayer_name());
$obj->setPayer_name("TestSample");
$this->assertEquals($obj->getPayer_name(), "TestSample");
// Check for Time_updated
$obj->setTimeUpdated(null);
$this->assertNull($obj->getTime_updated());
$this->assertNull($obj->getTimeUpdated());
$this->assertSame($obj->getTimeUpdated(), $obj->getTime_updated());
$obj->setTime_updated("TestSample");
$this->assertEquals($obj->getTime_updated(), "TestSample");
// Check for Time_zone
$obj->setTimeZone(null);
$this->assertNull($obj->getTime_zone());
$this->assertNull($obj->getTimeZone());
$this->assertSame($obj->getTimeZone(), $obj->getTime_zone());
$obj->setTime_zone("TestSample");
$this->assertEquals($obj->getTime_zone(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,87 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\AgreementTransactions;
/**
* Class AgreementTransactions
*
* @package PayPal\Test\Api
*/
class AgreementTransactionsTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object AgreementTransactions
* @return string
*/
public static function getJson()
{
return '{"agreement_transaction_list":' .AgreementTransactionTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return AgreementTransactions
*/
public static function getObject()
{
return new AgreementTransactions(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return AgreementTransactions
*/
public function testSerializationDeserialization()
{
$obj = new AgreementTransactions(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getAgreementTransactionList());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param AgreementTransactions $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getAgreementTransactionList(), AgreementTransactionTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param AgreementTransactions $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getAgreement_transaction_list(), AgreementTransactionTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param AgreementTransactions $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Agreement_transaction_list
$obj->setAgreementTransactionList(null);
$this->assertNull($obj->getAgreement_transaction_list());
$this->assertNull($obj->getAgreementTransactionList());
$this->assertSame($obj->getAgreementTransactionList(), $obj->getAgreement_transaction_list());
$obj->setAgreement_transaction_list(AgreementTransactionTest::getObject());
$this->assertEquals($obj->getAgreement_transaction_list(), AgreementTransactionTest::getObject());
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -41,7 +41,7 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase
$authorization->setClearingTime(self::$clearing_time);
$authorization->setAmount(AmountTest::createAmount());
$authorization->setLinks(array(LinksTest::createLinks()));
$authorization->setLinks(array(LinksTest::getObject()));
return $authorization;
}

View File

@@ -0,0 +1,404 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\ResourceModel;
use PayPal\Validation\ArgumentValidator;
use PayPal\Rest\ApiContext;
use PayPal\Transport\PPRestCall;
use PayPal\Api\BankAccount;
/**
* Class BankAccount
*
* @package PayPal\Test\Api
*/
class BankAccountTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object BankAccount
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","account_number":"TestSample","account_number_type":"TestSample","routing_number":"TestSample","account_type":"TestSample","account_name":"TestSample","check_type":"TestSample","auth_type":"TestSample","auth_capture_timestamp":"TestSample","bank_name":"TestSample","country_code":"TestSample","first_name":"TestSample","last_name":"TestSample","birth_date":"TestSample","billing_address":' .AddressTest::getJson() . ',"state":"TestSample","confirmation_status":"TestSample","payer_id":"TestSample","external_customer_id":"TestSample","merchant_id":"TestSample","create_time":"TestSample","update_time":"TestSample","valid_until":"TestSample","links":' .LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return BankAccount
*/
public static function getObject()
{
return new BankAccount(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return BankAccount
*/
public function testSerializationDeserialization()
{
$obj = new BankAccount(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getAccountNumber());
$this->assertNotNull($obj->getAccountNumberType());
$this->assertNotNull($obj->getRoutingNumber());
$this->assertNotNull($obj->getAccountType());
$this->assertNotNull($obj->getAccountName());
$this->assertNotNull($obj->getCheckType());
$this->assertNotNull($obj->getAuthType());
$this->assertNotNull($obj->getAuthCaptureTimestamp());
$this->assertNotNull($obj->getBankName());
$this->assertNotNull($obj->getCountryCode());
$this->assertNotNull($obj->getFirstName());
$this->assertNotNull($obj->getLastName());
$this->assertNotNull($obj->getBirthDate());
$this->assertNotNull($obj->getBillingAddress());
$this->assertNotNull($obj->getState());
$this->assertNotNull($obj->getConfirmationStatus());
$this->assertNotNull($obj->getPayerId());
$this->assertNotNull($obj->getExternalCustomerId());
$this->assertNotNull($obj->getMerchantId());
$this->assertNotNull($obj->getCreateTime());
$this->assertNotNull($obj->getUpdateTime());
$this->assertNotNull($obj->getValidUntil());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param BankAccount $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getAccountNumber(), "TestSample");
$this->assertEquals($obj->getAccountNumberType(), "TestSample");
$this->assertEquals($obj->getRoutingNumber(), "TestSample");
$this->assertEquals($obj->getAccountType(), "TestSample");
$this->assertEquals($obj->getAccountName(), "TestSample");
$this->assertEquals($obj->getCheckType(), "TestSample");
$this->assertEquals($obj->getAuthType(), "TestSample");
$this->assertEquals($obj->getAuthCaptureTimestamp(), "TestSample");
$this->assertEquals($obj->getBankName(), "TestSample");
$this->assertEquals($obj->getCountryCode(), "TestSample");
$this->assertEquals($obj->getFirstName(), "TestSample");
$this->assertEquals($obj->getLastName(), "TestSample");
$this->assertEquals($obj->getBirthDate(), "TestSample");
$this->assertEquals($obj->getBillingAddress(), AddressTest::getObject());
$this->assertEquals($obj->getState(), "TestSample");
$this->assertEquals($obj->getConfirmationStatus(), "TestSample");
$this->assertEquals($obj->getPayerId(), "TestSample");
$this->assertEquals($obj->getExternalCustomerId(), "TestSample");
$this->assertEquals($obj->getMerchantId(), "TestSample");
$this->assertEquals($obj->getCreateTime(), "TestSample");
$this->assertEquals($obj->getUpdateTime(), "TestSample");
$this->assertEquals($obj->getValidUntil(), "TestSample");
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param BankAccount $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getAccount_number(), "TestSample");
$this->assertEquals($obj->getAccount_number_type(), "TestSample");
$this->assertEquals($obj->getRouting_number(), "TestSample");
$this->assertEquals($obj->getAccount_type(), "TestSample");
$this->assertEquals($obj->getAccount_name(), "TestSample");
$this->assertEquals($obj->getCheck_type(), "TestSample");
$this->assertEquals($obj->getAuth_type(), "TestSample");
$this->assertEquals($obj->getAuth_capture_timestamp(), "TestSample");
$this->assertEquals($obj->getBank_name(), "TestSample");
$this->assertEquals($obj->getCountry_code(), "TestSample");
$this->assertEquals($obj->getFirst_name(), "TestSample");
$this->assertEquals($obj->getLast_name(), "TestSample");
$this->assertEquals($obj->getBirth_date(), "TestSample");
$this->assertEquals($obj->getBilling_address(), AddressTest::getObject());
$this->assertEquals($obj->getConfirmation_status(), "TestSample");
$this->assertEquals($obj->getPayer_id(), "TestSample");
$this->assertEquals($obj->getExternal_customer_id(), "TestSample");
$this->assertEquals($obj->getMerchant_id(), "TestSample");
$this->assertEquals($obj->getCreate_time(), "TestSample");
$this->assertEquals($obj->getUpdate_time(), "TestSample");
$this->assertEquals($obj->getValid_until(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param BankAccount $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Account_number
$obj->setAccountNumber(null);
$this->assertNull($obj->getAccount_number());
$this->assertNull($obj->getAccountNumber());
$this->assertSame($obj->getAccountNumber(), $obj->getAccount_number());
$obj->setAccount_number("TestSample");
$this->assertEquals($obj->getAccount_number(), "TestSample");
// Check for Account_number_type
$obj->setAccountNumberType(null);
$this->assertNull($obj->getAccount_number_type());
$this->assertNull($obj->getAccountNumberType());
$this->assertSame($obj->getAccountNumberType(), $obj->getAccount_number_type());
$obj->setAccount_number_type("TestSample");
$this->assertEquals($obj->getAccount_number_type(), "TestSample");
// Check for Routing_number
$obj->setRoutingNumber(null);
$this->assertNull($obj->getRouting_number());
$this->assertNull($obj->getRoutingNumber());
$this->assertSame($obj->getRoutingNumber(), $obj->getRouting_number());
$obj->setRouting_number("TestSample");
$this->assertEquals($obj->getRouting_number(), "TestSample");
// Check for Account_type
$obj->setAccountType(null);
$this->assertNull($obj->getAccount_type());
$this->assertNull($obj->getAccountType());
$this->assertSame($obj->getAccountType(), $obj->getAccount_type());
$obj->setAccount_type("TestSample");
$this->assertEquals($obj->getAccount_type(), "TestSample");
// Check for Account_name
$obj->setAccountName(null);
$this->assertNull($obj->getAccount_name());
$this->assertNull($obj->getAccountName());
$this->assertSame($obj->getAccountName(), $obj->getAccount_name());
$obj->setAccount_name("TestSample");
$this->assertEquals($obj->getAccount_name(), "TestSample");
// Check for Check_type
$obj->setCheckType(null);
$this->assertNull($obj->getCheck_type());
$this->assertNull($obj->getCheckType());
$this->assertSame($obj->getCheckType(), $obj->getCheck_type());
$obj->setCheck_type("TestSample");
$this->assertEquals($obj->getCheck_type(), "TestSample");
// Check for Auth_type
$obj->setAuthType(null);
$this->assertNull($obj->getAuth_type());
$this->assertNull($obj->getAuthType());
$this->assertSame($obj->getAuthType(), $obj->getAuth_type());
$obj->setAuth_type("TestSample");
$this->assertEquals($obj->getAuth_type(), "TestSample");
// Check for Auth_capture_timestamp
$obj->setAuthCaptureTimestamp(null);
$this->assertNull($obj->getAuth_capture_timestamp());
$this->assertNull($obj->getAuthCaptureTimestamp());
$this->assertSame($obj->getAuthCaptureTimestamp(), $obj->getAuth_capture_timestamp());
$obj->setAuth_capture_timestamp("TestSample");
$this->assertEquals($obj->getAuth_capture_timestamp(), "TestSample");
// Check for Bank_name
$obj->setBankName(null);
$this->assertNull($obj->getBank_name());
$this->assertNull($obj->getBankName());
$this->assertSame($obj->getBankName(), $obj->getBank_name());
$obj->setBank_name("TestSample");
$this->assertEquals($obj->getBank_name(), "TestSample");
// Check for Country_code
$obj->setCountryCode(null);
$this->assertNull($obj->getCountry_code());
$this->assertNull($obj->getCountryCode());
$this->assertSame($obj->getCountryCode(), $obj->getCountry_code());
$obj->setCountry_code("TestSample");
$this->assertEquals($obj->getCountry_code(), "TestSample");
// Check for First_name
$obj->setFirstName(null);
$this->assertNull($obj->getFirst_name());
$this->assertNull($obj->getFirstName());
$this->assertSame($obj->getFirstName(), $obj->getFirst_name());
$obj->setFirst_name("TestSample");
$this->assertEquals($obj->getFirst_name(), "TestSample");
// Check for Last_name
$obj->setLastName(null);
$this->assertNull($obj->getLast_name());
$this->assertNull($obj->getLastName());
$this->assertSame($obj->getLastName(), $obj->getLast_name());
$obj->setLast_name("TestSample");
$this->assertEquals($obj->getLast_name(), "TestSample");
// Check for Birth_date
$obj->setBirthDate(null);
$this->assertNull($obj->getBirth_date());
$this->assertNull($obj->getBirthDate());
$this->assertSame($obj->getBirthDate(), $obj->getBirth_date());
$obj->setBirth_date("TestSample");
$this->assertEquals($obj->getBirth_date(), "TestSample");
// Check for Billing_address
$obj->setBillingAddress(null);
$this->assertNull($obj->getBilling_address());
$this->assertNull($obj->getBillingAddress());
$this->assertSame($obj->getBillingAddress(), $obj->getBilling_address());
$obj->setBilling_address(AddressTest::getObject());
$this->assertEquals($obj->getBilling_address(), AddressTest::getObject());
// Check for Confirmation_status
$obj->setConfirmationStatus(null);
$this->assertNull($obj->getConfirmation_status());
$this->assertNull($obj->getConfirmationStatus());
$this->assertSame($obj->getConfirmationStatus(), $obj->getConfirmation_status());
$obj->setConfirmation_status("TestSample");
$this->assertEquals($obj->getConfirmation_status(), "TestSample");
// Check for Payer_id
$obj->setPayerId(null);
$this->assertNull($obj->getPayer_id());
$this->assertNull($obj->getPayerId());
$this->assertSame($obj->getPayerId(), $obj->getPayer_id());
$obj->setPayer_id("TestSample");
$this->assertEquals($obj->getPayer_id(), "TestSample");
// Check for External_customer_id
$obj->setExternalCustomerId(null);
$this->assertNull($obj->getExternal_customer_id());
$this->assertNull($obj->getExternalCustomerId());
$this->assertSame($obj->getExternalCustomerId(), $obj->getExternal_customer_id());
$obj->setExternal_customer_id("TestSample");
$this->assertEquals($obj->getExternal_customer_id(), "TestSample");
// Check for Merchant_id
$obj->setMerchantId(null);
$this->assertNull($obj->getMerchant_id());
$this->assertNull($obj->getMerchantId());
$this->assertSame($obj->getMerchantId(), $obj->getMerchant_id());
$obj->setMerchant_id("TestSample");
$this->assertEquals($obj->getMerchant_id(), "TestSample");
// Check for Create_time
$obj->setCreateTime(null);
$this->assertNull($obj->getCreate_time());
$this->assertNull($obj->getCreateTime());
$this->assertSame($obj->getCreateTime(), $obj->getCreate_time());
$obj->setCreate_time("TestSample");
$this->assertEquals($obj->getCreate_time(), "TestSample");
// Check for Update_time
$obj->setUpdateTime(null);
$this->assertNull($obj->getUpdate_time());
$this->assertNull($obj->getUpdateTime());
$this->assertSame($obj->getUpdateTime(), $obj->getUpdate_time());
$obj->setUpdate_time("TestSample");
$this->assertEquals($obj->getUpdate_time(), "TestSample");
// Check for Valid_until
$obj->setValidUntil(null);
$this->assertNull($obj->getValid_until());
$this->assertNull($obj->getValidUntil());
$this->assertSame($obj->getValidUntil(), $obj->getValid_until());
$obj->setValid_until("TestSample");
$this->assertEquals($obj->getValid_until(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
/**
* @dataProvider mockProvider
* @param BankAccount $obj
*/
public function testCreate($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$result = $obj->create($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param BankAccount $obj
*/
public function testGet($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
BankAccountTest::getJson()
));
$result = $obj->get("bankAccountId", $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param BankAccount $obj
*/
public function testDelete($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$result = $obj->delete($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param BankAccount $obj
*/
public function testUpdate($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$patchRequest = PatchRequestTest::getObject();
$result = $obj->update($patchRequest, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
public function mockProvider()
{
$obj = self::getObject();
$mockApiContext = $this->getMockBuilder('ApiContext')
->disableOriginalConstructor()
->getMock();
return array(
array($obj, $mockApiContext),
array($obj, null)
);
}
}

View File

@@ -0,0 +1,100 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\BankAccountsList;
/**
* Class BankAccountsList
*
* @package PayPal\Test\Api
*/
class BankAccountsListTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object BankAccountsList
* @return string
*/
public static function getJson()
{
return '{"bank-accounts":' .BankAccountTest::getJson() . ',"count":123,"next_id":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return BankAccountsList
*/
public static function getObject()
{
return new BankAccountsList(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return BankAccountsList
*/
public function testSerializationDeserialization()
{
$obj = new BankAccountsList(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getBankAccounts());
$this->assertNotNull($obj->getCount());
$this->assertNotNull($obj->getNextId());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param BankAccountsList $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getBankAccounts(), BankAccountTest::getObject());
$this->assertEquals($obj->getCount(), 123);
$this->assertEquals($obj->getNextId(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param BankAccountsList $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getBank_accounts(), BankAccountTest::getObject());
$this->assertEquals($obj->getNext_id(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param BankAccountsList $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Bank_accounts
$obj->setBankAccounts(null);
$this->assertNull($obj->getBank_accounts());
$this->assertNull($obj->getBankAccounts());
$this->assertSame($obj->getBankAccounts(), $obj->getBank_accounts());
$obj->setBank_accounts(BankAccountTest::getObject());
$this->assertEquals($obj->getBank_accounts(), BankAccountTest::getObject());
// Check for Next_id
$obj->setNextId(null);
$this->assertNull($obj->getNext_id());
$this->assertNull($obj->getNextId());
$this->assertSame($obj->getNextId(), $obj->getNext_id());
$obj->setNext_id("TestSample");
$this->assertEquals($obj->getNext_id(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,109 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\BankToken;
/**
* Class BankToken
*
* @package PayPal\Test\Api
*/
class BankTokenTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object BankToken
* @return string
*/
public static function getJson()
{
return '{"bank_id":"TestSample","external_customer_id":"TestSample","mandate_reference_number":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return BankToken
*/
public static function getObject()
{
return new BankToken(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return BankToken
*/
public function testSerializationDeserialization()
{
$obj = new BankToken(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getBankId());
$this->assertNotNull($obj->getExternalCustomerId());
$this->assertNotNull($obj->getMandateReferenceNumber());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param BankToken $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getBankId(), "TestSample");
$this->assertEquals($obj->getExternalCustomerId(), "TestSample");
$this->assertEquals($obj->getMandateReferenceNumber(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param BankToken $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getBank_id(), "TestSample");
$this->assertEquals($obj->getExternal_customer_id(), "TestSample");
$this->assertEquals($obj->getMandate_reference_number(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param BankToken $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Bank_id
$obj->setBankId(null);
$this->assertNull($obj->getBank_id());
$this->assertNull($obj->getBankId());
$this->assertSame($obj->getBankId(), $obj->getBank_id());
$obj->setBank_id("TestSample");
$this->assertEquals($obj->getBank_id(), "TestSample");
// Check for External_customer_id
$obj->setExternalCustomerId(null);
$this->assertNull($obj->getExternal_customer_id());
$this->assertNull($obj->getExternalCustomerId());
$this->assertSame($obj->getExternalCustomerId(), $obj->getExternal_customer_id());
$obj->setExternal_customer_id("TestSample");
$this->assertEquals($obj->getExternal_customer_id(), "TestSample");
// Check for Mandate_reference_number
$obj->setMandateReferenceNumber(null);
$this->assertNull($obj->getMandate_reference_number());
$this->assertNull($obj->getMandateReferenceNumber());
$this->assertSame($obj->getMandateReferenceNumber(), $obj->getMandate_reference_number());
$obj->setMandate_reference_number("TestSample");
$this->assertEquals($obj->getMandate_reference_number(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -5,6 +5,7 @@ use PayPal\Api\Capture;
use PayPal\Api\Refund;
use PayPal\Api\Authorization;
use PayPal\Api\Amount;
use PayPal\Exception\PPConnectionException;
use PayPal\Test\Constants;
class CaptureTest extends \PHPUnit_Framework_TestCase
@@ -35,7 +36,7 @@ class CaptureTest extends \PHPUnit_Framework_TestCase
$capture = self::createCapture();
$capture->setAmount(AmountTest::createAmount());
$capture->setLinks(array(LinksTest::createLinks()));
$capture->setLinks(array(LinksTest::getObject()));
$this->captures['full'] = $capture;
}
@@ -48,7 +49,6 @@ class CaptureTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(AmountTest::$currency, $this->captures['full']->getAmount()->getCurrency());
$links = $this->captures['full']->getLinks();
$this->assertEquals(LinksTest::$href, $links[0]->getHref());
}
public function testSerializeDeserialize()
@@ -98,4 +98,4 @@ class CaptureTest extends \PHPUnit_Framework_TestCase
}
}
}
}

View File

@@ -0,0 +1,82 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\ChargeModel;
/**
* Class ChargeModel
*
* @package PayPal\Test\Api
*/
class ChargeModelTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object ChargeModels
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","type":"TestSample","amount":' .CurrencyTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return ChargeModel
*/
public static function getObject()
{
return new ChargeModel(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return ChargeModel
*/
public function testSerializationDeserialization()
{
$obj = new ChargeModel(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getType());
$this->assertNotNull($obj->getAmount());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param ChargeModel $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getType(), "TestSample");
$this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param ChargeModel $obj
*/
public function testDeprecatedGetters($obj)
{
}
/**
* @depends testSerializationDeserialization
* @param ChargeModel $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -44,8 +44,8 @@ class CreditCardHistoryTest extends \PHPUnit_Framework_TestCase
{
$card = self::createCreditCard();
$card->setBillingAddress(AddressTest::createAddress());
$card->setLinks(array(LinksTest::createLinks()));
$card->setBillingAddress(AddressTest::getObject());
$card->setLinks(array(LinksTest::getObject()));
$this->cards['full'] = $card;
$card = self::createCreditCard();
@@ -73,4 +73,4 @@ class CreditCardHistoryTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($cardHistory, $cardHistoryCopy);
}
}
}

View File

@@ -0,0 +1,100 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\CreditCardList;
/**
* Class CreditCardList
*
* @package PayPal\Test\Api
*/
class CreditCardListTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object CreditCardList
* @return string
*/
public static function getJson()
{
return '{"credit-cards":' .CreditCardTest::getJson() . ',"count":123,"next_id":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return CreditCardList
*/
public static function getObject()
{
return new CreditCardList(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return CreditCardList
*/
public function testSerializationDeserialization()
{
$obj = new CreditCardList(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getCreditCards());
$this->assertNotNull($obj->getCount());
$this->assertNotNull($obj->getNextId());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param CreditCardList $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getCreditCards(), CreditCardTest::getObject());
$this->assertEquals($obj->getCount(), 123);
$this->assertEquals($obj->getNextId(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param CreditCardList $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getCredit_cards(), CreditCardTest::getObject());
$this->assertEquals($obj->getNext_id(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param CreditCardList $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Credit_cards
$obj->setCreditCards(null);
$this->assertNull($obj->getCredit_cards());
$this->assertNull($obj->getCreditCards());
$this->assertSame($obj->getCreditCards(), $obj->getCredit_cards());
$obj->setCredit_cards(CreditCardTest::getObject());
$this->assertEquals($obj->getCredit_cards(), CreditCardTest::getObject());
// Check for Next_id
$obj->setNextId(null);
$this->assertNull($obj->getNext_id());
$this->assertNull($obj->getNextId());
$this->assertSame($obj->getNextId(), $obj->getNext_id());
$obj->setNext_id("TestSample");
$this->assertEquals($obj->getNext_id(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -1,101 +1,277 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\Address;
use PayPal\Common\ResourceModel;
use PayPal\Validation\ArgumentValidator;
use PayPal\Rest\ApiContext;
use PayPal\Transport\PPRestCall;
use PayPal\Api\CreditCard;
use PayPal\Api\Links;
use PayPal\Test\Constants;
/**
* Class CreditCard
*
* @package PayPal\Test\Api
*/
class CreditCardTest extends \PHPUnit_Framework_TestCase
{
private $cards;
public static $id = "id";
public static $validUntil = "2013-02-28T00:00:00Z";
public static $state = "created";
public static $payerId = "payer-id";
public static $cardType = "visa";
public static $cardNumber = "4417119669820331";
public static $expireMonth = 11;
public static $expireYear = "2019";
public static $cvv = "012";
public static $firstName = "V";
public static $lastName = "C";
public static function createCreditCard()
/**
* Gets Json String of Object CreditCard
* @return string
*/
public static function getJson()
{
$card = new CreditCard();
$card->setType(self::$cardType);
$card->setNumber(self::$cardNumber);
$card->setExpireMonth(self::$expireMonth);
$card->setExpireYear(self::$expireYear);
$card->setCvv2(self::$cvv);
$card->setFirstName(self::$firstName);
$card->setLastName(self::$lastName);
return $card;
}
public function setup()
{
$card = self::createCreditCard();
$card->setBillingAddress(AddressTest::createAddress());
$card->setLinks(array(LinksTest::createLinks()));
$this->cards['full'] = $card;
$card = self::createCreditCard();
$this->cards['partial'] = $card;
}
public function testGetterSetters()
{
/** @var CreditCard $c */
$c = $this->cards['partial'];
$this->assertEquals(self::$cardType, $c->getType());
$this->assertEquals(self::$cardNumber, $c->getNumber());
$this->assertEquals(self::$expireMonth, $c->getExpireMonth());
$this->assertEquals(self::$expireYear, $c->getExpireYear());
$this->assertEquals(self::$cvv, $c->getCvv2());
$this->assertEquals(self::$firstName, $c->getFirstName());
$this->assertEquals(self::$lastName, $c->getLastName());
$c = $this->cards['full'];
$this->assertEquals(AddressTest::$line1, $c->getBillingAddress()->getLine1());
/** @var Links[] $link */
$link = $c->getLinks();
$this->assertEquals(LinksTest::$href, $link[0]->getHref());
}
public function testSerializeDeserialize()
{
/** @var CreditCard $c1 */
$c1 = $this->cards['full'];
$json = $c1->toJson();
$c2 = new CreditCard();
$c2->fromJson($json);
$this->assertEquals($c1, $c2);
return '{"id":"TestSample","number":"TestSample","type":"TestSample","expire_month":123,"expire_year":123,"cvv2":123,"first_name":"TestSample","last_name":"TestSample","billing_address":' .AddressTest::getJson() . ',"external_customer_id":"TestSample","state":"TestSample","valid_until":"TestSample","create_time":"TestSample","update_time":"TestSample"}';
}
/**
* @group integration
* Gets Object Instance with Json data filled in
* @return CreditCard
*/
public function testOperations()
public static function getObject()
{
/** @var CreditCard $c1 */
$c1 = $this->cards['full'];
$c1->create();
$this->assertNotNull($c1->getId());
$c2 = CreditCard::get($c1->getId());
$this->assertEquals($c1->getBillingAddress(), $c2->getBillingAddress());
$this->assertGreaterThan(0, count($c2->getLinks()));
$this->assertEquals(self::$cardType, $c2->getType());
$this->assertNotNull($c2->getState());
$this->assertEquals(true, $c2->delete());
return new CreditCard(self::getJson());
}
}
/**
* Tests for Serialization and Deserialization Issues
* @return CreditCard
*/
public function testSerializationDeserialization()
{
$obj = new CreditCard(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getNumber());
$this->assertNotNull($obj->getType());
$this->assertNotNull($obj->getExpireMonth());
$this->assertNotNull($obj->getExpireYear());
$this->assertNotNull($obj->getCvv2());
$this->assertNotNull($obj->getFirstName());
$this->assertNotNull($obj->getLastName());
$this->assertNotNull($obj->getBillingAddress());
$this->assertNotNull($obj->getExternalCustomerId());
$this->assertNotNull($obj->getState());
$this->assertNotNull($obj->getValidUntil());
$this->assertNotNull($obj->getCreateTime());
$this->assertNotNull($obj->getUpdateTime());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param CreditCard $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getNumber(), "TestSample");
$this->assertEquals($obj->getType(), "TestSample");
$this->assertEquals($obj->getExpireMonth(), 123);
$this->assertEquals($obj->getExpireYear(), 123);
$this->assertEquals($obj->getCvv2(), 123);
$this->assertEquals($obj->getFirstName(), "TestSample");
$this->assertEquals($obj->getLastName(), "TestSample");
$this->assertEquals($obj->getBillingAddress(), AddressTest::getObject());
$this->assertEquals($obj->getExternalCustomerId(), "TestSample");
$this->assertEquals($obj->getState(), "TestSample");
$this->assertEquals($obj->getValidUntil(), "TestSample");
$this->assertEquals($obj->getCreateTime(), "TestSample");
$this->assertEquals($obj->getUpdateTime(), "TestSample");
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param CreditCard $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getExpire_month(), 123);
$this->assertEquals($obj->getExpire_year(), 123);
$this->assertEquals($obj->getFirst_name(), "TestSample");
$this->assertEquals($obj->getLast_name(), "TestSample");
$this->assertEquals($obj->getBilling_address(), AddressTest::getObject());
$this->assertEquals($obj->getExternal_customer_id(), "TestSample");
$this->assertEquals($obj->getValid_until(), "TestSample");
$this->assertEquals($obj->getCreate_time(), "TestSample");
$this->assertEquals($obj->getUpdate_time(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param CreditCard $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Expire_month
$obj->setExpireMonth(null);
$this->assertNull($obj->getExpire_month());
$this->assertNull($obj->getExpireMonth());
$this->assertSame($obj->getExpireMonth(), $obj->getExpire_month());
$obj->setExpire_month(123);
$this->assertEquals($obj->getExpire_month(), 123);
// Check for Expire_year
$obj->setExpireYear(null);
$this->assertNull($obj->getExpire_year());
$this->assertNull($obj->getExpireYear());
$this->assertSame($obj->getExpireYear(), $obj->getExpire_year());
$obj->setExpire_year(123);
$this->assertEquals($obj->getExpire_year(), 123);
// Check for First_name
$obj->setFirstName(null);
$this->assertNull($obj->getFirst_name());
$this->assertNull($obj->getFirstName());
$this->assertSame($obj->getFirstName(), $obj->getFirst_name());
$obj->setFirst_name("TestSample");
$this->assertEquals($obj->getFirst_name(), "TestSample");
// Check for Last_name
$obj->setLastName(null);
$this->assertNull($obj->getLast_name());
$this->assertNull($obj->getLastName());
$this->assertSame($obj->getLastName(), $obj->getLast_name());
$obj->setLast_name("TestSample");
$this->assertEquals($obj->getLast_name(), "TestSample");
// Check for Billing_address
$obj->setBillingAddress(null);
$this->assertNull($obj->getBilling_address());
$this->assertNull($obj->getBillingAddress());
$this->assertSame($obj->getBillingAddress(), $obj->getBilling_address());
$obj->setBilling_address(AddressTest::getObject());
$this->assertEquals($obj->getBilling_address(), AddressTest::getObject());
// Check for External_customer_id
$obj->setExternalCustomerId(null);
$this->assertNull($obj->getExternal_customer_id());
$this->assertNull($obj->getExternalCustomerId());
$this->assertSame($obj->getExternalCustomerId(), $obj->getExternal_customer_id());
$obj->setExternal_customer_id("TestSample");
$this->assertEquals($obj->getExternal_customer_id(), "TestSample");
// Check for Valid_until
$obj->setValidUntil(null);
$this->assertNull($obj->getValid_until());
$this->assertNull($obj->getValidUntil());
$this->assertSame($obj->getValidUntil(), $obj->getValid_until());
$obj->setValid_until("TestSample");
$this->assertEquals($obj->getValid_until(), "TestSample");
// Check for Create_time
$obj->setCreateTime(null);
$this->assertNull($obj->getCreate_time());
$this->assertNull($obj->getCreateTime());
$this->assertSame($obj->getCreateTime(), $obj->getCreate_time());
$obj->setCreate_time("TestSample");
$this->assertEquals($obj->getCreate_time(), "TestSample");
// Check for Update_time
$obj->setUpdateTime(null);
$this->assertNull($obj->getUpdate_time());
$this->assertNull($obj->getUpdateTime());
$this->assertSame($obj->getUpdateTime(), $obj->getUpdate_time());
$obj->setUpdate_time("TestSample");
$this->assertEquals($obj->getUpdate_time(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
/**
* @dataProvider mockProvider
* @param CreditCard $obj
*/
public function testCreate($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$result = $obj->create($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param CreditCard $obj
*/
public function testGet($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
CreditCardTest::getJson()
));
$result = $obj->get("creditCardId", $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param CreditCard $obj
*/
public function testDelete($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$result = $obj->delete($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param CreditCard $obj
*/
public function testUpdate($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$result = $obj->update($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
public function mockProvider()
{
$obj = self::getObject();
$mockApiContext = $this->getMockBuilder('ApiContext')
->disableOriginalConstructor()
->getMock();
return array(
array($obj, $mockApiContext),
array($obj, null)
);
}
}

View File

@@ -1,43 +1,124 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\CreditCardToken;
use PayPal\Test\Constants;
/**
* Class CreditCardToken
*
* @package PayPal\Test\Api
*/
class CreditCardTokenTest extends \PHPUnit_Framework_TestCase
{
private $ccToken;
public static $payerId = "PAYER-123";
public static $creditCardId = "CC-123";
public static function createCreditCardToken()
/**
* Gets Json String of Object CreditCardToken
* @return string
*/
public static function getJson()
{
$ccToken = new CreditCardToken();
$ccToken->setPayerId(self::$payerId);
$ccToken->setCreditCardId(self::$creditCardId);
return $ccToken;
return '{"credit_card_id":"TestSample","payer_id":"TestSample","last4":"TestSample","type":"TestSample","expire_month":123,"expire_year":123}';
}
public function setup()
/**
* Gets Object Instance with Json data filled in
* @return CreditCardToken
*/
public static function getObject()
{
$this->ccToken = self::createCreditCardToken();
return new CreditCardToken(self::getJson());
}
public function testGetterSetter()
/**
* Tests for Serialization and Deserialization Issues
* @return CreditCardToken
*/
public function testSerializationDeserialization()
{
$this->assertEquals(self::$payerId, $this->ccToken->getPayerId());
$this->assertEquals(self::$creditCardId, $this->ccToken->getCreditCardId());
$obj = new CreditCardToken(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getCreditCardId());
$this->assertNotNull($obj->getPayerId());
$this->assertNotNull($obj->getLast4());
$this->assertNotNull($obj->getType());
$this->assertNotNull($obj->getExpireMonth());
$this->assertNotNull($obj->getExpireYear());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
public function testSerializeDeserialize()
/**
* @depends testSerializationDeserialization
* @param CreditCardToken $obj
*/
public function testGetters($obj)
{
$t1 = $this->ccToken;
$t2 = new CreditCardToken();
$t2->fromJson($t1->toJson());
$this->assertEquals($t1, $t2);
$this->assertEquals($obj->getCreditCardId(), "TestSample");
$this->assertEquals($obj->getPayerId(), "TestSample");
$this->assertEquals($obj->getLast4(), "TestSample");
$this->assertEquals($obj->getType(), "TestSample");
$this->assertEquals($obj->getExpireMonth(), 123);
$this->assertEquals($obj->getExpireYear(), 123);
}
}
/**
* @depends testSerializationDeserialization
* @param CreditCardToken $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getCredit_card_id(), "TestSample");
$this->assertEquals($obj->getPayer_id(), "TestSample");
$this->assertEquals($obj->getExpire_month(), 123);
$this->assertEquals($obj->getExpire_year(), 123);
}
/**
* @depends testSerializationDeserialization
* @param CreditCardToken $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Credit_card_id
$obj->setCreditCardId(null);
$this->assertNull($obj->getCredit_card_id());
$this->assertNull($obj->getCreditCardId());
$this->assertSame($obj->getCreditCardId(), $obj->getCredit_card_id());
$obj->setCredit_card_id("TestSample");
$this->assertEquals($obj->getCredit_card_id(), "TestSample");
// Check for Payer_id
$obj->setPayerId(null);
$this->assertNull($obj->getPayer_id());
$this->assertNull($obj->getPayerId());
$this->assertSame($obj->getPayerId(), $obj->getPayer_id());
$obj->setPayer_id("TestSample");
$this->assertEquals($obj->getPayer_id(), "TestSample");
// Check for Expire_month
$obj->setExpireMonth(null);
$this->assertNull($obj->getExpire_month());
$this->assertNull($obj->getExpireMonth());
$this->assertSame($obj->getExpireMonth(), $obj->getExpire_month());
$obj->setExpire_month(123);
$this->assertEquals($obj->getExpire_month(), 123);
// Check for Expire_year
$obj->setExpireYear(null);
$this->assertNull($obj->getExpire_year());
$this->assertNull($obj->getExpireYear());
$this->assertSame($obj->getExpireYear(), $obj->getExpire_year());
$obj->setExpire_year(123);
$this->assertEquals($obj->getExpire_year(), 123);
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,82 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\Credit;
/**
* Class Credit
*
* @package PayPal\Test\Api
*/
class CreditTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Credit
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","type":"TestSample","terms":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return Credit
*/
public static function getObject()
{
return new Credit(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Credit
*/
public function testSerializationDeserialization()
{
$obj = new Credit(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getType());
$this->assertNotNull($obj->getTerms());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Credit $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getType(), "TestSample");
$this->assertEquals($obj->getTerms(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param Credit $obj
*/
public function testDeprecatedGetters($obj)
{
}
/**
* @depends testSerializationDeserialization
* @param Credit $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,80 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\Currency;
/**
* Class Currency
*
* @package PayPal\Test\Api
*/
class CurrencyTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Currency
* @return string
*/
public static function getJson()
{
return '{"currency":"TestSample","value":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return Currency
*/
public static function getObject()
{
return new Currency(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Currency
*/
public function testSerializationDeserialization()
{
$obj = new Currency(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getCurrency());
$this->assertNotNull($obj->getValue());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Currency $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getCurrency(), "TestSample");
$this->assertEquals($obj->getValue(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param Currency $obj
*/
public function testDeprecatedGetters($obj)
{
}
/**
* @depends testSerializationDeserialization
* @param Currency $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,87 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\ExtendedBankAccount;
/**
* Class ExtendedBankAccount
*
* @package PayPal\Test\Api
*/
class ExtendedBankAccountTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object ExtendedBankAccount
* @return string
*/
public static function getJson()
{
return '{"mandate_reference_number":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return ExtendedBankAccount
*/
public static function getObject()
{
return new ExtendedBankAccount(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return ExtendedBankAccount
*/
public function testSerializationDeserialization()
{
$obj = new ExtendedBankAccount(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getMandateReferenceNumber());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param ExtendedBankAccount $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getMandateReferenceNumber(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param ExtendedBankAccount $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getMandate_reference_number(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param ExtendedBankAccount $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Mandate_reference_number
$obj->setMandateReferenceNumber(null);
$this->assertNull($obj->getMandate_reference_number());
$this->assertNull($obj->getMandateReferenceNumber());
$this->assertSame($obj->getMandateReferenceNumber(), $obj->getMandate_reference_number());
$obj->setMandate_reference_number("TestSample");
$this->assertEquals($obj->getMandate_reference_number(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -2,40 +2,143 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\FundingInstrument;
use PayPal\Test\Constants;
/**
* Class FundingInstrument
*
* @package PayPal\Test\Api
*/
class FundingInstrumentTest extends \PHPUnit_Framework_TestCase
{
private $fi;
public static function createFundingInstrument()
/**
* Gets Json String of Object FundingInstrument
* @return string
*/
public static function getJson()
{
$fi = new FundingInstrument();
$fi->setCreditCard(CreditCardTest::createCreditCard());
$fi->setCreditCardToken(CreditCardTokenTest::createCreditCardToken());
return $fi;
return '{"credit_card":' .CreditCardTest::getJson() . ',"credit_card_token":' .CreditCardTokenTest::getJson() . ',"payment_card":' .PaymentCardTest::getJson() . ',"payment_card_token":' .PaymentCardTokenTest::getJson() . ',"bank_account":' .ExtendedBankAccountTest::getJson() . ',"bank_account_token":' .BankTokenTest::getJson() . ',"credit":' .CreditTest::getJson() . '}';
}
public function setup()
/**
* Gets Object Instance with Json data filled in
* @return FundingInstrument
*/
public static function getObject()
{
$this->fi = self::createFundingInstrument();
return new FundingInstrument(self::getJson());
}
public function testGetterSetter()
/**
* Tests for Serialization and Deserialization Issues
* @return FundingInstrument
*/
public function testSerializationDeserialization()
{
$this->assertEquals(CreditCardTest::$cardNumber, $this->fi->getCreditCard()->getNumber());
$this->assertEquals(CreditCardTokenTest::$creditCardId,
$this->fi->getCreditCardToken()->getCreditCardId());
$obj = new FundingInstrument(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getCreditCard());
$this->assertNotNull($obj->getCreditCardToken());
$this->assertNotNull($obj->getPaymentCard());
$this->assertNotNull($obj->getPaymentCardToken());
$this->assertNotNull($obj->getBankAccount());
$this->assertNotNull($obj->getBankAccountToken());
$this->assertNotNull($obj->getCredit());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
public function testSerializeDeserialize()
/**
* @depends testSerializationDeserialization
* @param FundingInstrument $obj
*/
public function testGetters($obj)
{
$fi1 = $this->fi;
$fi2 = new FundingInstrument();
$fi2->fromJson($fi1->toJson());
$this->assertEquals($fi1, $fi2);
$this->assertEquals($obj->getCreditCard(), CreditCardTest::getObject());
$this->assertEquals($obj->getCreditCardToken(), CreditCardTokenTest::getObject());
$this->assertEquals($obj->getPaymentCard(), PaymentCardTest::getObject());
$this->assertEquals($obj->getPaymentCardToken(), PaymentCardTokenTest::getObject());
$this->assertEquals($obj->getBankAccount(), ExtendedBankAccountTest::getObject());
$this->assertEquals($obj->getBankAccountToken(), BankTokenTest::getObject());
$this->assertEquals($obj->getCredit(), CreditTest::getObject());
}
}
/**
* @depends testSerializationDeserialization
* @param FundingInstrument $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getCredit_card(), CreditCardTest::getObject());
$this->assertEquals($obj->getCredit_card_token(), CreditCardTokenTest::getObject());
$this->assertEquals($obj->getPayment_card(), PaymentCardTest::getObject());
$this->assertEquals($obj->getPayment_card_token(), PaymentCardTokenTest::getObject());
$this->assertEquals($obj->getBank_account(), ExtendedBankAccountTest::getObject());
$this->assertEquals($obj->getBank_account_token(), BankTokenTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param FundingInstrument $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Credit_card
$obj->setCreditCard(null);
$this->assertNull($obj->getCredit_card());
$this->assertNull($obj->getCreditCard());
$this->assertSame($obj->getCreditCard(), $obj->getCredit_card());
$obj->setCredit_card(CreditCardTest::getObject());
$this->assertEquals($obj->getCredit_card(), CreditCardTest::getObject());
// Check for Credit_card_token
$obj->setCreditCardToken(null);
$this->assertNull($obj->getCredit_card_token());
$this->assertNull($obj->getCreditCardToken());
$this->assertSame($obj->getCreditCardToken(), $obj->getCredit_card_token());
$obj->setCredit_card_token(CreditCardTokenTest::getObject());
$this->assertEquals($obj->getCredit_card_token(), CreditCardTokenTest::getObject());
// Check for Payment_card
$obj->setPaymentCard(null);
$this->assertNull($obj->getPayment_card());
$this->assertNull($obj->getPaymentCard());
$this->assertSame($obj->getPaymentCard(), $obj->getPayment_card());
$obj->setPayment_card(PaymentCardTest::getObject());
$this->assertEquals($obj->getPayment_card(), PaymentCardTest::getObject());
// Check for Payment_card_token
$obj->setPaymentCardToken(null);
$this->assertNull($obj->getPayment_card_token());
$this->assertNull($obj->getPaymentCardToken());
$this->assertSame($obj->getPaymentCardToken(), $obj->getPayment_card_token());
$obj->setPayment_card_token(PaymentCardTokenTest::getObject());
$this->assertEquals($obj->getPayment_card_token(), PaymentCardTokenTest::getObject());
// Check for Bank_account
$obj->setBankAccount(null);
$this->assertNull($obj->getBank_account());
$this->assertNull($obj->getBankAccount());
$this->assertSame($obj->getBankAccount(), $obj->getBank_account());
$obj->setBank_account(ExtendedBankAccountTest::getObject());
$this->assertEquals($obj->getBank_account(), ExtendedBankAccountTest::getObject());
// Check for Bank_account_token
$obj->setBankAccountToken(null);
$this->assertNull($obj->getBank_account_token());
$this->assertNull($obj->getBankAccountToken());
$this->assertSame($obj->getBankAccountToken(), $obj->getBank_account_token());
$obj->setBank_account_token(BankTokenTest::getObject());
$this->assertEquals($obj->getBank_account_token(), BankTokenTest::getObject());
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,88 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\HyperSchema;
/**
* Class HyperSchema
*
* @package PayPal\Test\Api
*/
class HyperSchemaTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object HyperSchema
* @return string
*/
public static function getJson()
{
return '{"fragmentResolution":"TestSample","readonly":true,"contentEncoding":"TestSample","pathStart":"TestSample","mediaType":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return HyperSchema
*/
public static function getObject()
{
return new HyperSchema(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return HyperSchema
*/
public function testSerializationDeserialization()
{
$obj = new HyperSchema(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getLinks());
$this->assertNotNull($obj->getFragmentResolution());
$this->assertNotNull($obj->getReadonly());
$this->assertNotNull($obj->getContentEncoding());
$this->assertNotNull($obj->getPathStart());
$this->assertNotNull($obj->getMediaType());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param HyperSchema $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
$this->assertEquals($obj->getFragmentResolution(), "TestSample");
$this->assertEquals($obj->getReadonly(), true);
$this->assertEquals($obj->getContentEncoding(), "TestSample");
$this->assertEquals($obj->getPathStart(), "TestSample");
$this->assertEquals($obj->getMediaType(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param HyperSchema $obj
*/
public function testDeprecatedGetters($obj)
{
}
/**
* @depends testSerializationDeserialization
* @param HyperSchema $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -24,7 +24,7 @@ class ItemListTest extends \PHPUnit_Framework_TestCase
$itemList = new ItemList();
$itemList->setItems(array($item));
$itemList->setShippingAddress(ShippingAddressTest::createAddress());
$itemList->setShippingAddress(ShippingAddressTest::getObject());
return $itemList;
}
@@ -38,7 +38,7 @@ class ItemListTest extends \PHPUnit_Framework_TestCase
{
$items = $this->items->getItems();
$this->assertEquals(ItemTest::createItem(), $items[0]);
$this->assertEquals(ShippingAddressTest::createAddress(), $this->items->getShippingAddress());
$this->assertEquals(ShippingAddressTest::getObject(), $this->items->getShippingAddress());
}
public function testSerializeDeserialize()

View File

@@ -2,44 +2,87 @@
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\Links;
use PayPal\Test\Constants;
/**
* Class Links
*
* @package PayPal\Test\Api
*/
class LinksTest extends \PHPUnit_Framework_TestCase
{
private $links;
public static $href = "USD";
public static $rel = "1.12";
public static $method = "1.12";
public static function createLinks()
/**
* Gets Json String of Object Links
* @return string
*/
public static function getJson()
{
$links = new Links();
$links->setHref(self::$href);
$links->setRel(self::$rel);
$links->setMethod(self::$method);
return $links;
return '{"href":"TestSample","rel":"TestSample","targetSchema":' .HyperSchemaTest::getJson() . ',"method":"TestSample","enctype":"TestSample","schema":' .HyperSchemaTest::getJson() . '}';
}
public function setup()
/**
* Gets Object Instance with Json data filled in
* @return Links
*/
public static function getObject()
{
$this->links = self::createLinks();
return new Links(self::getJson());
}
public function testGetterSetters()
/**
* Tests for Serialization and Deserialization Issues
* @return Links
*/
public function testSerializationDeserialization()
{
$this->assertEquals(self::$href, $this->links->getHref());
$this->assertEquals(self::$rel, $this->links->getRel());
$this->assertEquals(self::$method, $this->links->getMethod());
$obj = new Links(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getHref());
$this->assertNotNull($obj->getRel());
$this->assertNotNull($obj->getTargetSchema());
$this->assertNotNull($obj->getMethod());
$this->assertNotNull($obj->getEnctype());
$this->assertNotNull($obj->getSchema());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
public function testSerializeDeserialize()
/**
* @depends testSerializationDeserialization
* @param Links $obj
*/
public function testGetters($obj)
{
$link2 = new Links();
$link2->fromJson($this->links->toJSON());
$this->assertEquals($this->links, $link2);
$this->assertEquals($obj->getHref(), "TestSample");
$this->assertEquals($obj->getRel(), "TestSample");
$this->assertEquals($obj->getTargetSchema(), HyperSchemaTest::getObject());
$this->assertEquals($obj->getMethod(), "TestSample");
$this->assertEquals($obj->getEnctype(), "TestSample");
$this->assertEquals($obj->getSchema(), HyperSchemaTest::getObject());
}
}
/**
* @depends testSerializationDeserialization
* @param Links $obj
*/
public function testDeprecatedGetters($obj)
{
}
/**
* @depends testSerializationDeserialization
* @param Links $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,198 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\MerchantPreferences;
/**
* Class MerchantPreferences
*
* @package PayPal\Test\Api
*/
class MerchantPreferencesTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object MerchantPreferences
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","setup_fee":' .CurrencyTest::getJson() . ',"cancel_url":"http://www.google.com","return_url":"http://www.google.com","notify_url":"http://www.google.com","max_fail_attempts":"TestSample","auto_bill_amount":"TestSample","initial_fail_amount_action":"TestSample","accepted_payment_type":"TestSample","char_set":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return MerchantPreferences
*/
public static function getObject()
{
return new MerchantPreferences(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return MerchantPreferences
*/
public function testSerializationDeserialization()
{
$obj = new MerchantPreferences(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getSetupFee());
$this->assertNotNull($obj->getCancelUrl());
$this->assertNotNull($obj->getReturnUrl());
$this->assertNotNull($obj->getNotifyUrl());
$this->assertNotNull($obj->getMaxFailAttempts());
$this->assertNotNull($obj->getAutoBillAmount());
$this->assertNotNull($obj->getInitialFailAmountAction());
$this->assertNotNull($obj->getAcceptedPaymentType());
$this->assertNotNull($obj->getCharSet());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param MerchantPreferences $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getSetupFee(), CurrencyTest::getObject());
$this->assertEquals($obj->getCancelUrl(), "http://www.google.com");
$this->assertEquals($obj->getReturnUrl(), "http://www.google.com");
$this->assertEquals($obj->getNotifyUrl(), "http://www.google.com");
$this->assertEquals($obj->getMaxFailAttempts(), "TestSample");
$this->assertEquals($obj->getAutoBillAmount(), "TestSample");
$this->assertEquals($obj->getInitialFailAmountAction(), "TestSample");
$this->assertEquals($obj->getAcceptedPaymentType(), "TestSample");
$this->assertEquals($obj->getCharSet(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param MerchantPreferences $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getSetup_fee(), CurrencyTest::getObject());
$this->assertEquals($obj->getCancel_url(), "http://www.google.com");
$this->assertEquals($obj->getReturn_url(), "http://www.google.com");
$this->assertEquals($obj->getNotify_url(), "http://www.google.com");
$this->assertEquals($obj->getMax_fail_attempts(), "TestSample");
$this->assertEquals($obj->getAuto_bill_amount(), "TestSample");
$this->assertEquals($obj->getInitial_fail_amount_action(), "TestSample");
$this->assertEquals($obj->getAccepted_payment_type(), "TestSample");
$this->assertEquals($obj->getChar_set(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param MerchantPreferences $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Setup_fee
$obj->setSetupFee(null);
$this->assertNull($obj->getSetup_fee());
$this->assertNull($obj->getSetupFee());
$this->assertSame($obj->getSetupFee(), $obj->getSetup_fee());
$obj->setSetup_fee(CurrencyTest::getObject());
$this->assertEquals($obj->getSetup_fee(), CurrencyTest::getObject());
// Check for Max_fail_attempts
$obj->setMaxFailAttempts(null);
$this->assertNull($obj->getMax_fail_attempts());
$this->assertNull($obj->getMaxFailAttempts());
$this->assertSame($obj->getMaxFailAttempts(), $obj->getMax_fail_attempts());
$obj->setMax_fail_attempts("TestSample");
$this->assertEquals($obj->getMax_fail_attempts(), "TestSample");
// Check for Auto_bill_amount
$obj->setAutoBillAmount(null);
$this->assertNull($obj->getAuto_bill_amount());
$this->assertNull($obj->getAutoBillAmount());
$this->assertSame($obj->getAutoBillAmount(), $obj->getAuto_bill_amount());
$obj->setAuto_bill_amount("TestSample");
$this->assertEquals($obj->getAuto_bill_amount(), "TestSample");
// Check for Initial_fail_amount_action
$obj->setInitialFailAmountAction(null);
$this->assertNull($obj->getInitial_fail_amount_action());
$this->assertNull($obj->getInitialFailAmountAction());
$this->assertSame($obj->getInitialFailAmountAction(), $obj->getInitial_fail_amount_action());
$obj->setInitial_fail_amount_action("TestSample");
$this->assertEquals($obj->getInitial_fail_amount_action(), "TestSample");
// Check for Accepted_payment_type
$obj->setAcceptedPaymentType(null);
$this->assertNull($obj->getAccepted_payment_type());
$this->assertNull($obj->getAcceptedPaymentType());
$this->assertSame($obj->getAcceptedPaymentType(), $obj->getAccepted_payment_type());
$obj->setAccepted_payment_type("TestSample");
$this->assertEquals($obj->getAccepted_payment_type(), "TestSample");
// Check for Char_set
$obj->setCharSet(null);
$this->assertNull($obj->getChar_set());
$this->assertNull($obj->getCharSet());
$this->assertSame($obj->getCharSet(), $obj->getChar_set());
$obj->setChar_set("TestSample");
$this->assertEquals($obj->getChar_set(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage CancelUrl is not a fully qualified URL
*/
public function testUrlValidationForCancelUrl()
{
$obj = new MerchantPreferences();
$obj->setCancelUrl(null);
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage ReturnUrl is not a fully qualified URL
*/
public function testUrlValidationForReturnUrl()
{
$obj = new MerchantPreferences();
$obj->setReturnUrl(null);
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage NotifyUrl is not a fully qualified URL
*/
public function testUrlValidationForNotifyUrl()
{
$obj = new MerchantPreferences();
$obj->setNotifyUrl(null);
}
public function testUrlValidationForCancelUrlDeprecated()
{
$obj = new MerchantPreferences();
$obj->setCancel_url(null);
$this->assertNull($obj->getCancel_url());
}
public function testUrlValidationForReturnUrlDeprecated()
{
$obj = new MerchantPreferences();
$obj->setReturn_url(null);
$this->assertNull($obj->getReturn_url());
}
public function testUrlValidationForNotifyUrlDeprecated()
{
$obj = new MerchantPreferences();
$obj->setNotify_url(null);
$this->assertNull($obj->getNotify_url());
}
}

View File

@@ -0,0 +1,89 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\OverrideChargeModel;
/**
* Class OverrideChargeModel
*
* @package PayPal\Test\Api
*/
class OverrideChargeModelTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object OverrideChargeModel
* @return string
*/
public static function getJson()
{
return '{"charge_id":"TestSample","amount":' .CurrencyTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return OverrideChargeModel
*/
public static function getObject()
{
return new OverrideChargeModel(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return OverrideChargeModel
*/
public function testSerializationDeserialization()
{
$obj = new OverrideChargeModel(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getChargeId());
$this->assertNotNull($obj->getAmount());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param OverrideChargeModel $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getChargeId(), "TestSample");
$this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param OverrideChargeModel $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getCharge_id(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param OverrideChargeModel $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Charge_id
$obj->setChargeId(null);
$this->assertNull($obj->getCharge_id());
$this->assertNull($obj->getChargeId());
$this->assertSame($obj->getChargeId(), $obj->getCharge_id());
$obj->setCharge_id("TestSample");
$this->assertEquals($obj->getCharge_id(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,77 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\PatchRequest;
/**
* Class PatchRequest
*
* @package PayPal\Test\Api
*/
class PatchRequestTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PatchRequest
* @return string
*/
public static function getJson()
{
return '{"patches":' .PatchTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return PatchRequest
*/
public static function getObject()
{
return new PatchRequest(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return PatchRequest
*/
public function testSerializationDeserialization()
{
$obj = new PatchRequest(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getPatches());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PatchRequest $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getPatches(), PatchTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param PatchRequest $obj
*/
public function testDeprecatedGetters($obj)
{
}
/**
* @depends testSerializationDeserialization
* @param PatchRequest $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -18,7 +18,7 @@ class PatchTest extends \PHPUnit_Framework_TestCase
*/
public static function getJson()
{
return json_encode(json_decode('{"op":"TestSample","path":"TestSample","value":"TestSampleObject","from":"TestSample"}'));
return '{"op":"TestSample","path":"TestSample","value":"TestSampleObject","from":"TestSample"}';
}
/**

View File

@@ -1,55 +1,201 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\PayerInfo;
use PayPal\Test\Constants;
/**
* Class PayerInfo
*
* @package PayPal\Test\Api
*/
class PayerInfoTest extends \PHPUnit_Framework_TestCase
{
private $payerInfo;
public static $email = "test@paypal.com";
public static $firstName = "first";
public static $lastName = "last";
public static $phone = "408-1234-5687";
public static $payerId = "PAYER-1234";
public static function createPayerInfo()
/**
* Gets Json String of Object PayerInfo
* @return string
*/
public static function getJson()
{
$payerInfo = new PayerInfo();
$payerInfo->setEmail(self::$email);
$payerInfo->setFirstName(self::$firstName);
$payerInfo->setLastName(self::$lastName);
$payerInfo->setPhone(self::$phone);
$payerInfo->setPayerId(self::$payerId);
$payerInfo->setShippingAddress(ShippingAddressTest::createAddress());
return $payerInfo;
return '{"email":"TestSample","external_remember_me_id":"TestSample","buyer_account_number":"TestSample","first_name":"TestSample","last_name":"TestSample","payer_id":"TestSample","phone":"TestSample","phone_type":"TestSample","birth_date":"TestSample","tax_id":"TestSample","tax_id_type":"TestSample","billing_address":' .AddressTest::getJson() . ',"shipping_address":' .ShippingAddressTest::getJson() . '}';
}
public function setup()
/**
* Gets Object Instance with Json data filled in
* @return PayerInfo
*/
public static function getObject()
{
$this->payerInfo = self::createPayerInfo();
return new PayerInfo(self::getJson());
}
public function testGetterSetter()
/**
* Tests for Serialization and Deserialization Issues
* @return PayerInfo
*/
public function testSerializationDeserialization()
{
$this->assertEquals(self::$email, $this->payerInfo->getEmail());
$this->assertEquals(self::$firstName, $this->payerInfo->getFirstName());
$this->assertEquals(self::$lastName, $this->payerInfo->getLastName());
$this->assertEquals(self::$phone, $this->payerInfo->getPhone());
$this->assertEquals(self::$payerId, $this->payerInfo->getPayerId());
$this->assertEquals(ShippingAddressTest::$line1, $this->payerInfo->getShippingAddress()->getLine1());
$obj = new PayerInfo(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getEmail());
$this->assertNotNull($obj->getExternalRememberMeId());
$this->assertNotNull($obj->getBuyerAccountNumber());
$this->assertNotNull($obj->getFirstName());
$this->assertNotNull($obj->getLastName());
$this->assertNotNull($obj->getPayerId());
$this->assertNotNull($obj->getPhone());
$this->assertNotNull($obj->getPhoneType());
$this->assertNotNull($obj->getBirthDate());
$this->assertNotNull($obj->getTaxId());
$this->assertNotNull($obj->getTaxIdType());
$this->assertNotNull($obj->getBillingAddress());
$this->assertNotNull($obj->getShippingAddress());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
public function testSerializeDeserialize()
/**
* @depends testSerializationDeserialization
* @param PayerInfo $obj
*/
public function testGetters($obj)
{
$p1 = $this->payerInfo;
$p2 = new PayerInfo();
$p2->fromJson($p1->toJson());
$this->assertEquals($p1, $p2);
$this->assertEquals($obj->getEmail(), "TestSample");
$this->assertEquals($obj->getExternalRememberMeId(), "TestSample");
$this->assertEquals($obj->getBuyerAccountNumber(), "TestSample");
$this->assertEquals($obj->getFirstName(), "TestSample");
$this->assertEquals($obj->getLastName(), "TestSample");
$this->assertEquals($obj->getPayerId(), "TestSample");
$this->assertEquals($obj->getPhone(), "TestSample");
$this->assertEquals($obj->getPhoneType(), "TestSample");
$this->assertEquals($obj->getBirthDate(), "TestSample");
$this->assertEquals($obj->getTaxId(), "TestSample");
$this->assertEquals($obj->getTaxIdType(), "TestSample");
$this->assertEquals($obj->getBillingAddress(), AddressTest::getObject());
$this->assertEquals($obj->getShippingAddress(), ShippingAddressTest::getObject());
}
}
/**
* @depends testSerializationDeserialization
* @param PayerInfo $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getExternal_remember_me_id(), "TestSample");
$this->assertEquals($obj->getBuyer_account_number(), "TestSample");
$this->assertEquals($obj->getFirst_name(), "TestSample");
$this->assertEquals($obj->getLast_name(), "TestSample");
$this->assertEquals($obj->getPayer_id(), "TestSample");
$this->assertEquals($obj->getPhone_type(), "TestSample");
$this->assertEquals($obj->getBirth_date(), "TestSample");
$this->assertEquals($obj->getTax_id(), "TestSample");
$this->assertEquals($obj->getTax_id_type(), "TestSample");
$this->assertEquals($obj->getBilling_address(), AddressTest::getObject());
$this->assertEquals($obj->getShipping_address(), ShippingAddressTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param PayerInfo $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for External_remember_me_id
$obj->setExternalRememberMeId(null);
$this->assertNull($obj->getExternal_remember_me_id());
$this->assertNull($obj->getExternalRememberMeId());
$this->assertSame($obj->getExternalRememberMeId(), $obj->getExternal_remember_me_id());
$obj->setExternal_remember_me_id("TestSample");
$this->assertEquals($obj->getExternal_remember_me_id(), "TestSample");
// Check for Buyer_account_number
$obj->setBuyerAccountNumber(null);
$this->assertNull($obj->getBuyer_account_number());
$this->assertNull($obj->getBuyerAccountNumber());
$this->assertSame($obj->getBuyerAccountNumber(), $obj->getBuyer_account_number());
$obj->setBuyer_account_number("TestSample");
$this->assertEquals($obj->getBuyer_account_number(), "TestSample");
// Check for First_name
$obj->setFirstName(null);
$this->assertNull($obj->getFirst_name());
$this->assertNull($obj->getFirstName());
$this->assertSame($obj->getFirstName(), $obj->getFirst_name());
$obj->setFirst_name("TestSample");
$this->assertEquals($obj->getFirst_name(), "TestSample");
// Check for Last_name
$obj->setLastName(null);
$this->assertNull($obj->getLast_name());
$this->assertNull($obj->getLastName());
$this->assertSame($obj->getLastName(), $obj->getLast_name());
$obj->setLast_name("TestSample");
$this->assertEquals($obj->getLast_name(), "TestSample");
// Check for Payer_id
$obj->setPayerId(null);
$this->assertNull($obj->getPayer_id());
$this->assertNull($obj->getPayerId());
$this->assertSame($obj->getPayerId(), $obj->getPayer_id());
$obj->setPayer_id("TestSample");
$this->assertEquals($obj->getPayer_id(), "TestSample");
// Check for Phone_type
$obj->setPhoneType(null);
$this->assertNull($obj->getPhone_type());
$this->assertNull($obj->getPhoneType());
$this->assertSame($obj->getPhoneType(), $obj->getPhone_type());
$obj->setPhone_type("TestSample");
$this->assertEquals($obj->getPhone_type(), "TestSample");
// Check for Birth_date
$obj->setBirthDate(null);
$this->assertNull($obj->getBirth_date());
$this->assertNull($obj->getBirthDate());
$this->assertSame($obj->getBirthDate(), $obj->getBirth_date());
$obj->setBirth_date("TestSample");
$this->assertEquals($obj->getBirth_date(), "TestSample");
// Check for Tax_id
$obj->setTaxId(null);
$this->assertNull($obj->getTax_id());
$this->assertNull($obj->getTaxId());
$this->assertSame($obj->getTaxId(), $obj->getTax_id());
$obj->setTax_id("TestSample");
$this->assertEquals($obj->getTax_id(), "TestSample");
// Check for Tax_id_type
$obj->setTaxIdType(null);
$this->assertNull($obj->getTax_id_type());
$this->assertNull($obj->getTaxIdType());
$this->assertSame($obj->getTaxIdType(), $obj->getTax_id_type());
$obj->setTax_id_type("TestSample");
$this->assertEquals($obj->getTax_id_type(), "TestSample");
// Check for Billing_address
$obj->setBillingAddress(null);
$this->assertNull($obj->getBilling_address());
$this->assertNull($obj->getBillingAddress());
$this->assertSame($obj->getBillingAddress(), $obj->getBilling_address());
$obj->setBilling_address(AddressTest::getObject());
$this->assertEquals($obj->getBilling_address(), AddressTest::getObject());
// Check for Shipping_address
$obj->setShippingAddress(null);
$this->assertNull($obj->getShipping_address());
$this->assertNull($obj->getShippingAddress());
$this->assertSame($obj->getShippingAddress(), $obj->getShipping_address());
$obj->setShipping_address(ShippingAddressTest::getObject());
$this->assertEquals($obj->getShipping_address(), ShippingAddressTest::getObject());
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -2,49 +2,121 @@
namespace PayPal\Test\Api;
use PayPal\Api\FundingInstrument;
use PayPal\Common\PPModel;
use PayPal\Api\Payer;
use PayPal\Test\Constants;
/**
* Class Payer
*
* @package PayPal\Test\Api
*/
class PayerTest extends \PHPUnit_Framework_TestCase
{
private $payer;
private static $paymentMethod = "credit_card";
public static function createPayer()
/**
* Gets Json String of Object Payer
* @return string
*/
public static function getJson()
{
$payer = new Payer();
$payer->setPaymentMethod(self::$paymentMethod);
$payer->setPayerInfo(PayerInfoTest::createPayerInfo());
$payer->setFundingInstruments(array(FundingInstrumentTest::createFundingInstrument()));
return $payer;
return '{"payment_method":"TestSample","status":"TestSample","funding_instruments":' .FundingInstrumentTest::getJson() . ',"funding_option_id":"TestSample","payer_info":' .PayerInfoTest::getJson() . '}';
}
public function setup()
/**
* Gets Object Instance with Json data filled in
* @return Payer
*/
public static function getObject()
{
$this->payer = self::createPayer();
return new Payer(self::getJson());
}
public function testGetterSetter()
{
$this->assertEquals(self::$paymentMethod, $this->payer->getPaymentMethod());
$this->assertEquals(PayerInfoTest::$email, $this->payer->getPayerInfo()->getEmail());
$fi = $this->payer->getFundingInstruments();
$this->assertEquals(CreditCardTokenTest::$creditCardId, $fi[0]->getCreditCardToken()->getCreditCardId());
/**
* Tests for Serialization and Deserialization Issues
* @return Payer
*/
public function testSerializationDeserialization()
{
$obj = new Payer(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getPaymentMethod());
$this->assertNotNull($obj->getStatus());
$this->assertNotNull($obj->getFundingInstruments());
$this->assertNotNull($obj->getFundingOptionId());
$this->assertNotNull($obj->getPayerInfo());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
public function testSerializeDeserialize()
/**
* @depends testSerializationDeserialization
* @param Payer $obj
*/
public function testGetters($obj)
{
$p1 = $this->payer;
$p2 = new Payer();
$p2->fromJson($p1->toJson());
$this->assertEquals($p1, $p2);
$this->assertEquals($obj->getPaymentMethod(), "TestSample");
$this->assertEquals($obj->getStatus(), "TestSample");
$this->assertEquals($obj->getFundingInstruments(), FundingInstrumentTest::getObject());
$this->assertEquals($obj->getFundingOptionId(), "TestSample");
$this->assertEquals($obj->getPayerInfo(), PayerInfoTest::getObject());
}
}
/**
* @depends testSerializationDeserialization
* @param Payer $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getPayment_method(), "TestSample");
$this->assertEquals($obj->getFunding_instruments(), FundingInstrumentTest::getObject());
$this->assertEquals($obj->getFunding_option_id(), "TestSample");
$this->assertEquals($obj->getPayer_info(), PayerInfoTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param Payer $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Payment_method
$obj->setPaymentMethod(null);
$this->assertNull($obj->getPayment_method());
$this->assertNull($obj->getPaymentMethod());
$this->assertSame($obj->getPaymentMethod(), $obj->getPayment_method());
$obj->setPayment_method("TestSample");
$this->assertEquals($obj->getPayment_method(), "TestSample");
// Check for Funding_instruments
$obj->setFundingInstruments(null);
$this->assertNull($obj->getFunding_instruments());
$this->assertNull($obj->getFundingInstruments());
$this->assertSame($obj->getFundingInstruments(), $obj->getFunding_instruments());
$obj->setFunding_instruments(FundingInstrumentTest::getObject());
$this->assertEquals($obj->getFunding_instruments(), FundingInstrumentTest::getObject());
// Check for Funding_option_id
$obj->setFundingOptionId(null);
$this->assertNull($obj->getFunding_option_id());
$this->assertNull($obj->getFundingOptionId());
$this->assertSame($obj->getFundingOptionId(), $obj->getFunding_option_id());
$obj->setFunding_option_id("TestSample");
$this->assertEquals($obj->getFunding_option_id(), "TestSample");
// Check for Payer_info
$obj->setPayerInfo(null);
$this->assertNull($obj->getPayer_info());
$this->assertNull($obj->getPayerInfo());
$this->assertSame($obj->getPayerInfo(), $obj->getPayer_info());
$obj->setPayer_info(PayerInfoTest::getObject());
$this->assertEquals($obj->getPayer_info(), PayerInfoTest::getObject());
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,187 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\PaymentCard;
/**
* Class PaymentCard
*
* @package PayPal\Test\Api
*/
class PaymentCardTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PaymentCard
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","number":"TestSample","type":"TestSample","expire_month":123,"expire_year":123,"start_month":123,"start_year":123,"cvv2":123,"first_name":"TestSample","last_name":"TestSample","billing_address":' .AddressTest::getJson() . ',"external_customer_id":"TestSample","status":"TestSample","valid_until":"TestSample","links":' .LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return PaymentCard
*/
public static function getObject()
{
return new PaymentCard(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return PaymentCard
*/
public function testSerializationDeserialization()
{
$obj = new PaymentCard(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getNumber());
$this->assertNotNull($obj->getType());
$this->assertNotNull($obj->getExpireMonth());
$this->assertNotNull($obj->getExpireYear());
$this->assertNotNull($obj->getStartMonth());
$this->assertNotNull($obj->getStartYear());
$this->assertNotNull($obj->getCvv2());
$this->assertNotNull($obj->getFirstName());
$this->assertNotNull($obj->getLastName());
$this->assertNotNull($obj->getBillingAddress());
$this->assertNotNull($obj->getExternalCustomerId());
$this->assertNotNull($obj->getStatus());
$this->assertNotNull($obj->getValidUntil());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PaymentCard $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getNumber(), "TestSample");
$this->assertEquals($obj->getType(), "TestSample");
$this->assertEquals($obj->getExpireMonth(), 123);
$this->assertEquals($obj->getExpireYear(), 123);
$this->assertEquals($obj->getStartMonth(), 123);
$this->assertEquals($obj->getStartYear(), 123);
$this->assertEquals($obj->getCvv2(), 123);
$this->assertEquals($obj->getFirstName(), "TestSample");
$this->assertEquals($obj->getLastName(), "TestSample");
$this->assertEquals($obj->getBillingAddress(), AddressTest::getObject());
$this->assertEquals($obj->getExternalCustomerId(), "TestSample");
$this->assertEquals($obj->getStatus(), "TestSample");
$this->assertEquals($obj->getValidUntil(), "TestSample");
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param PaymentCard $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getExpire_month(), 123);
$this->assertEquals($obj->getExpire_year(), 123);
$this->assertEquals($obj->getStart_month(), 123);
$this->assertEquals($obj->getStart_year(), 123);
$this->assertEquals($obj->getFirst_name(), "TestSample");
$this->assertEquals($obj->getLast_name(), "TestSample");
$this->assertEquals($obj->getBilling_address(), AddressTest::getObject());
$this->assertEquals($obj->getExternal_customer_id(), "TestSample");
$this->assertEquals($obj->getValid_until(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param PaymentCard $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Expire_month
$obj->setExpireMonth(null);
$this->assertNull($obj->getExpire_month());
$this->assertNull($obj->getExpireMonth());
$this->assertSame($obj->getExpireMonth(), $obj->getExpire_month());
$obj->setExpire_month(123);
$this->assertEquals($obj->getExpire_month(), 123);
// Check for Expire_year
$obj->setExpireYear(null);
$this->assertNull($obj->getExpire_year());
$this->assertNull($obj->getExpireYear());
$this->assertSame($obj->getExpireYear(), $obj->getExpire_year());
$obj->setExpire_year(123);
$this->assertEquals($obj->getExpire_year(), 123);
// Check for Start_month
$obj->setStartMonth(null);
$this->assertNull($obj->getStart_month());
$this->assertNull($obj->getStartMonth());
$this->assertSame($obj->getStartMonth(), $obj->getStart_month());
$obj->setStart_month(123);
$this->assertEquals($obj->getStart_month(), 123);
// Check for Start_year
$obj->setStartYear(null);
$this->assertNull($obj->getStart_year());
$this->assertNull($obj->getStartYear());
$this->assertSame($obj->getStartYear(), $obj->getStart_year());
$obj->setStart_year(123);
$this->assertEquals($obj->getStart_year(), 123);
// Check for First_name
$obj->setFirstName(null);
$this->assertNull($obj->getFirst_name());
$this->assertNull($obj->getFirstName());
$this->assertSame($obj->getFirstName(), $obj->getFirst_name());
$obj->setFirst_name("TestSample");
$this->assertEquals($obj->getFirst_name(), "TestSample");
// Check for Last_name
$obj->setLastName(null);
$this->assertNull($obj->getLast_name());
$this->assertNull($obj->getLastName());
$this->assertSame($obj->getLastName(), $obj->getLast_name());
$obj->setLast_name("TestSample");
$this->assertEquals($obj->getLast_name(), "TestSample");
// Check for Billing_address
$obj->setBillingAddress(null);
$this->assertNull($obj->getBilling_address());
$this->assertNull($obj->getBillingAddress());
$this->assertSame($obj->getBillingAddress(), $obj->getBilling_address());
$obj->setBilling_address(AddressTest::getObject());
$this->assertEquals($obj->getBilling_address(), AddressTest::getObject());
// Check for External_customer_id
$obj->setExternalCustomerId(null);
$this->assertNull($obj->getExternal_customer_id());
$this->assertNull($obj->getExternalCustomerId());
$this->assertSame($obj->getExternalCustomerId(), $obj->getExternal_customer_id());
$obj->setExternal_customer_id("TestSample");
$this->assertEquals($obj->getExternal_customer_id(), "TestSample");
// Check for Valid_until
$obj->setValidUntil(null);
$this->assertNull($obj->getValid_until());
$this->assertNull($obj->getValidUntil());
$this->assertSame($obj->getValidUntil(), $obj->getValid_until());
$obj->setValid_until("TestSample");
$this->assertEquals($obj->getValid_until(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,124 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\PaymentCardToken;
/**
* Class PaymentCardToken
*
* @package PayPal\Test\Api
*/
class PaymentCardTokenTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PaymentCardToken
* @return string
*/
public static function getJson()
{
return '{"payment_card_id":"TestSample","external_customer_id":"TestSample","last4":"TestSample","type":"TestSample","expire_month":123,"expire_year":123}';
}
/**
* Gets Object Instance with Json data filled in
* @return PaymentCardToken
*/
public static function getObject()
{
return new PaymentCardToken(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return PaymentCardToken
*/
public function testSerializationDeserialization()
{
$obj = new PaymentCardToken(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getPaymentCardId());
$this->assertNotNull($obj->getExternalCustomerId());
$this->assertNotNull($obj->getLast4());
$this->assertNotNull($obj->getType());
$this->assertNotNull($obj->getExpireMonth());
$this->assertNotNull($obj->getExpireYear());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PaymentCardToken $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getPaymentCardId(), "TestSample");
$this->assertEquals($obj->getExternalCustomerId(), "TestSample");
$this->assertEquals($obj->getLast4(), "TestSample");
$this->assertEquals($obj->getType(), "TestSample");
$this->assertEquals($obj->getExpireMonth(), 123);
$this->assertEquals($obj->getExpireYear(), 123);
}
/**
* @depends testSerializationDeserialization
* @param PaymentCardToken $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getPayment_card_id(), "TestSample");
$this->assertEquals($obj->getExternal_customer_id(), "TestSample");
$this->assertEquals($obj->getExpire_month(), 123);
$this->assertEquals($obj->getExpire_year(), 123);
}
/**
* @depends testSerializationDeserialization
* @param PaymentCardToken $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Payment_card_id
$obj->setPaymentCardId(null);
$this->assertNull($obj->getPayment_card_id());
$this->assertNull($obj->getPaymentCardId());
$this->assertSame($obj->getPaymentCardId(), $obj->getPayment_card_id());
$obj->setPayment_card_id("TestSample");
$this->assertEquals($obj->getPayment_card_id(), "TestSample");
// Check for External_customer_id
$obj->setExternalCustomerId(null);
$this->assertNull($obj->getExternal_customer_id());
$this->assertNull($obj->getExternalCustomerId());
$this->assertSame($obj->getExternalCustomerId(), $obj->getExternal_customer_id());
$obj->setExternal_customer_id("TestSample");
$this->assertEquals($obj->getExternal_customer_id(), "TestSample");
// Check for Expire_month
$obj->setExpireMonth(null);
$this->assertNull($obj->getExpire_month());
$this->assertNull($obj->getExpireMonth());
$this->assertSame($obj->getExpireMonth(), $obj->getExpire_month());
$obj->setExpire_month(123);
$this->assertEquals($obj->getExpire_month(), 123);
// Check for Expire_year
$obj->setExpireYear(null);
$this->assertNull($obj->getExpire_year());
$this->assertNull($obj->getExpireYear());
$this->assertSame($obj->getExpireYear(), $obj->getExpire_year());
$obj->setExpire_year(123);
$this->assertEquals($obj->getExpire_year(), 123);
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,110 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\PaymentDefinition;
/**
* Class PaymentDefinition
*
* @package PayPal\Test\Api
*/
class PaymentDefinitionTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PaymentDefinition
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","name":"TestSample","type":"TestSample","frequency_interval":"TestSample","frequency":"TestSample","cycles":"TestSample","amount":' .CurrencyTest::getJson() . ',"charge_models":' .ChargeModelTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return PaymentDefinition
*/
public static function getObject()
{
return new PaymentDefinition(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return PaymentDefinition
*/
public function testSerializationDeserialization()
{
$obj = new PaymentDefinition(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getName());
$this->assertNotNull($obj->getType());
$this->assertNotNull($obj->getFrequencyInterval());
$this->assertNotNull($obj->getFrequency());
$this->assertNotNull($obj->getCycles());
$this->assertNotNull($obj->getAmount());
$this->assertNotNull($obj->getChargeModels());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PaymentDefinition $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getName(), "TestSample");
$this->assertEquals($obj->getType(), "TestSample");
$this->assertEquals($obj->getFrequencyInterval(), "TestSample");
$this->assertEquals($obj->getFrequency(), "TestSample");
$this->assertEquals($obj->getCycles(), "TestSample");
$this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
$this->assertEquals($obj->getChargeModels(), ChargeModelTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param PaymentDefinition $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getFrequency_interval(), "TestSample");
$this->assertEquals($obj->getCharge_models(), ChargeModelTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param PaymentDefinition $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Frequency_interval
$obj->setFrequencyInterval(null);
$this->assertNull($obj->getFrequency_interval());
$this->assertNull($obj->getFrequencyInterval());
$this->assertSame($obj->getFrequencyInterval(), $obj->getFrequency_interval());
$obj->setFrequency_interval("TestSample");
$this->assertEquals($obj->getFrequency_interval(), "TestSample");
// Check for Charge_models
$obj->setChargeModels(null);
$this->assertNull($obj->getCharge_models());
$this->assertNull($obj->getChargeModels());
$this->assertSame($obj->getChargeModels(), $obj->getCharge_models());
$obj->setCharge_models(ChargeModelTest::getObject());
$this->assertEquals($obj->getCharge_models(), ChargeModelTest::getObject());
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -26,7 +26,7 @@ class PaymentTest extends \PHPUnit_Framework_TestCase
$payment = new Payment();
$payment->setIntent("sale");
$payment->setRedirectUrls($redirectUrls);
$payment->setPayer(PayerTest::createPayer());
$payment->setPayer(PayerTest::getObject());
$payment->setTransactions(array(TransactionTest::createTransaction()));
return $payment;
@@ -35,7 +35,7 @@ class PaymentTest extends \PHPUnit_Framework_TestCase
public static function createNewPayment()
{
$funding = FundingInstrumentTest::createFundingInstrument();
$funding = FundingInstrumentTest::getObject();
$funding->credit_card_token = null;
$payer = new Payer();
@@ -72,24 +72,6 @@ class PaymentTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($p2, $this->payments['full']);
}
/**
* @group integration
*/
public function testOperations()
{
$p1 = $this->payments['new'];
$p1->create();
$this->assertNotNull($p1->getId());
$p2 = Payment::get($p1->getId());
$this->assertNotNull($p2);
$paymentHistory = Payment::all(array('count' => '10'));
$this->assertNotNull($paymentHistory);
}
/**
* @group integration
*

View File

@@ -0,0 +1,102 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\PlanList;
/**
* Class PlanList
*
* @package PayPal\Test\Api
*/
class PlanListTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object PlanList
* @return string
*/
public static function getJson()
{
return '{"plans":' .PlanTest::getJson() . ',"total_items":"TestSample","total_pages":"TestSample","links":' .LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return PlanList
*/
public static function getObject()
{
return new PlanList(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return PlanList
*/
public function testSerializationDeserialization()
{
$obj = new PlanList(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getPlans());
$this->assertNotNull($obj->getTotalItems());
$this->assertNotNull($obj->getTotalPages());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param PlanList $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getPlans(), PlanTest::getObject());
$this->assertEquals($obj->getTotalItems(), "TestSample");
$this->assertEquals($obj->getTotalPages(), "TestSample");
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param PlanList $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getTotal_items(), "TestSample");
$this->assertEquals($obj->getTotal_pages(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param PlanList $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Total_items
$obj->setTotalItems(null);
$this->assertNull($obj->getTotal_items());
$this->assertNull($obj->getTotalItems());
$this->assertSame($obj->getTotalItems(), $obj->getTotal_items());
$obj->setTotal_items("TestSample");
$this->assertEquals($obj->getTotal_items(), "TestSample");
// Check for Total_pages
$obj->setTotalPages(null);
$this->assertNull($obj->getTotal_pages());
$this->assertNull($obj->getTotalPages());
$this->assertSame($obj->getTotalPages(), $obj->getTotal_pages());
$obj->setTotal_pages("TestSample");
$this->assertEquals($obj->getTotal_pages(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,227 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\ResourceModel;
use PayPal\Validation\ArgumentValidator;
use PayPal\Api\PlanList;
use PayPal\Rest\ApiContext;
use PayPal\Transport\PPRestCall;
use PayPal\Api\Plan;
/**
* Class Plan
*
* @package PayPal\Test\Api
*/
class PlanTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Plan
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","name":"TestSample","description":"TestSample","type":"TestSample","state":"TestSample","create_time":"TestSample","update_time":"TestSample","payment_definitions":' .PaymentDefinitionTest::getJson() . ',"terms":' .TermsTest::getJson() . ',"merchant_preferences":' .MerchantPreferencesTest::getJson() . ',"links":' .LinksTest::getJson() . '}';
}
/**
* Gets Object Instance with Json data filled in
* @return Plan
*/
public static function getObject()
{
return new Plan(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Plan
*/
public function testSerializationDeserialization()
{
$obj = new Plan(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getName());
$this->assertNotNull($obj->getDescription());
$this->assertNotNull($obj->getType());
$this->assertNotNull($obj->getState());
$this->assertNotNull($obj->getCreateTime());
$this->assertNotNull($obj->getUpdateTime());
$this->assertNotNull($obj->getPaymentDefinitions());
$this->assertNotNull($obj->getTerms());
$this->assertNotNull($obj->getMerchantPreferences());
$this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Plan $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getName(), "TestSample");
$this->assertEquals($obj->getDescription(), "TestSample");
$this->assertEquals($obj->getType(), "TestSample");
$this->assertEquals($obj->getState(), "TestSample");
$this->assertEquals($obj->getCreateTime(), "TestSample");
$this->assertEquals($obj->getUpdateTime(), "TestSample");
$this->assertEquals($obj->getPaymentDefinitions(), PaymentDefinitionTest::getObject());
$this->assertEquals($obj->getTerms(), TermsTest::getObject());
$this->assertEquals($obj->getMerchantPreferences(), MerchantPreferencesTest::getObject());
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param Plan $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getCreate_time(), "TestSample");
$this->assertEquals($obj->getUpdate_time(), "TestSample");
$this->assertEquals($obj->getPayment_definitions(), PaymentDefinitionTest::getObject());
$this->assertEquals($obj->getMerchant_preferences(), MerchantPreferencesTest::getObject());
}
/**
* @depends testSerializationDeserialization
* @param Plan $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Create_time
$obj->setCreateTime(null);
$this->assertNull($obj->getCreate_time());
$this->assertNull($obj->getCreateTime());
$this->assertSame($obj->getCreateTime(), $obj->getCreate_time());
$obj->setCreate_time("TestSample");
$this->assertEquals($obj->getCreate_time(), "TestSample");
// Check for Update_time
$obj->setUpdateTime(null);
$this->assertNull($obj->getUpdate_time());
$this->assertNull($obj->getUpdateTime());
$this->assertSame($obj->getUpdateTime(), $obj->getUpdate_time());
$obj->setUpdate_time("TestSample");
$this->assertEquals($obj->getUpdate_time(), "TestSample");
// Check for Payment_definitions
$obj->setPaymentDefinitions(null);
$this->assertNull($obj->getPayment_definitions());
$this->assertNull($obj->getPaymentDefinitions());
$this->assertSame($obj->getPaymentDefinitions(), $obj->getPayment_definitions());
$obj->setPayment_definitions(PaymentDefinitionTest::getObject());
$this->assertEquals($obj->getPayment_definitions(), PaymentDefinitionTest::getObject());
// Check for Merchant_preferences
$obj->setMerchantPreferences(null);
$this->assertNull($obj->getMerchant_preferences());
$this->assertNull($obj->getMerchantPreferences());
$this->assertSame($obj->getMerchantPreferences(), $obj->getMerchant_preferences());
$obj->setMerchant_preferences(MerchantPreferencesTest::getObject());
$this->assertEquals($obj->getMerchant_preferences(), MerchantPreferencesTest::getObject());
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
/**
* @dataProvider mockProvider
* @param Plan $obj
*/
public function testGet($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
PlanTest::getJson()
));
$result = $obj->get("planId", $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Plan $obj
*/
public function testCreate($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
self::getJson()
));
$result = $obj->create($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Plan $obj
*/
public function testUpdate($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
true
));
$patchRequest = PatchRequestTest::getObject();
$result = $obj->update($patchRequest, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @dataProvider mockProvider
* @param Plan $obj
*/
public function testList($obj, $mockApiContext)
{
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
PlanListTest::getJson()
));
$params = ParamsTest::getObject();
$result = $obj->all($params, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result);
}
public function mockProvider()
{
$obj = self::getObject();
$mockApiContext = $this->getMockBuilder('ApiContext')
->disableOriginalConstructor()
->getMock();
return array(
array($obj, $mockApiContext),
array($obj, null)
);
}
}

View File

@@ -21,7 +21,7 @@ class RefundTest extends \PHPUnit_Framework_TestCase
$refund->setAmount(AmountTest::createAmount());
$refund->setCaptureId(self::$captureId);
$refund->setId(self::$id);
$refund->setLinks(array(LinksTest::createLinks()));
$refund->setLinks(array(LinksTest::getObject()));
$refund->setParentPayment(self::$parentPayment);
return $refund;
@@ -40,7 +40,6 @@ class RefundTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(self::$parentPayment, $this->refund->getParentPayment());
$this->assertEquals(AmountTest::$currency, $this->refund->getAmount()->getCurrency());
$links = $this->refund->getLinks();
$this->assertEquals(LinksTest::$href, $links[0]->getHref());
}
public function testSerializeDeserialize()
@@ -57,4 +56,4 @@ class RefundTest extends \PHPUnit_Framework_TestCase
{
}
}
}

View File

@@ -55,33 +55,4 @@ class SaleTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($s1, $s2);
}
/**
* @group integration
*/
public function testOperations()
{
try {
$payment = PaymentTest::createNewPayment();
$payment->create();
$transactions = $payment->getTransactions();
$resources = $transactions[0]->getRelatedResources();
$saleId = $resources[0]->getSale()->getId();
$sale = Sale::get($saleId);
$this->assertNotNull($sale);
$refund = new Refund();
$refund->setAmount(AmountTest::createAmount());
$sale->refund($refund);
$this->setExpectedException('\InvalidArgumentException');
$sale->refund(NULL);
} catch (PPConnectionException $ex) {
$this->markTestSkipped(
'Tests failing because of intermittent failures in Paypal Sandbox environment.' . $ex->getMessage()
);
}
}
}
}

View File

@@ -1,61 +1,100 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\ShippingAddress;
use PayPal\Test\Constants;
/**
* Class ShippingAddress
*
* @package PayPal\Test\Api
*/
class ShippingAddressTest extends \PHPUnit_Framework_TestCase
{
private $address;
public static $line1 = "3909 Witmer Road";
public static $line2 = "Niagara Falls";
public static $city = "Niagara Falls";
public static $state = "NY";
public static $postalCode = "14305";
public static $countryCode = "US";
public static $phone = "716-298-1822";
public static $recipientName = "TestUser";
public static function createAddress()
/**
* Gets Json String of Object ShippingAddress
* @return string
*/
public static function getJson()
{
$addr = new ShippingAddress();
$addr->setLine1(self::$line1);
$addr->setLine2(self::$line2);
$addr->setCity(self::$city);
$addr->setState(self::$state);
$addr->setPostalCode(self::$postalCode);
$addr->setCountryCode(self::$countryCode);
$addr->setPhone(self::$phone);
$addr->setRecipientName(self::$recipientName);
return $addr;
return '{"id":"TestSample","recipient_name":"TestSample","default_address":true}';
}
public function setup()
/**
* Gets Object Instance with Json data filled in
* @return ShippingAddress
*/
public static function getObject()
{
$this->address = self::createAddress();
return new ShippingAddress(self::getJson());
}
public function testGetterSetter()
/**
* Tests for Serialization and Deserialization Issues
* @return ShippingAddress
*/
public function testSerializationDeserialization()
{
$this->assertEquals(self::$line1, $this->address->getLine1());
$this->assertEquals(self::$line2, $this->address->getLine2());
$this->assertEquals(self::$city, $this->address->getCity());
$this->assertEquals(self::$state, $this->address->getState());
$this->assertEquals(self::$postalCode, $this->address->getPostalCode());
$this->assertEquals(self::$countryCode, $this->address->getCountryCode());
$this->assertEquals(self::$phone, $this->address->getPhone());
$this->assertEquals(self::$recipientName, $this->address->getRecipientName());
$obj = new ShippingAddress(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getRecipientName());
$this->assertNotNull($obj->getDefaultAddress());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
public function testSerializeDeserialize()
/**
* @depends testSerializationDeserialization
* @param ShippingAddress $obj
*/
public function testGetters($obj)
{
$a1 = $this->address;
$a2 = new ShippingAddress();
$a2->fromJson($a1->toJson());
$this->assertEquals($a1, $a2);
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getRecipientName(), "TestSample");
$this->assertEquals($obj->getDefaultAddress(), true);
}
}
/**
* @depends testSerializationDeserialization
* @param ShippingAddress $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getRecipient_name(), "TestSample");
$this->assertEquals($obj->getDefault_address(), true);
}
/**
* @depends testSerializationDeserialization
* @param ShippingAddress $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Recipient_name
$obj->setRecipientName(null);
$this->assertNull($obj->getRecipient_name());
$this->assertNull($obj->getRecipientName());
$this->assertSame($obj->getRecipientName(), $obj->getRecipient_name());
$obj->setRecipient_name("TestSample");
$this->assertEquals($obj->getRecipient_name(), "TestSample");
// Check for Default_address
$obj->setDefaultAddress(null);
$this->assertNull($obj->getDefault_address());
$this->assertNull($obj->getDefaultAddress());
$this->assertSame($obj->getDefaultAddress(), $obj->getDefault_address());
$obj->setDefault_address(true);
$this->assertEquals($obj->getDefault_address(), true);
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,115 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Common\PPModel;
use PayPal\Api\Terms;
/**
* Class Terms
*
* @package PayPal\Test\Api
*/
class TermsTest extends \PHPUnit_Framework_TestCase
{
/**
* Gets Json String of Object Terms
* @return string
*/
public static function getJson()
{
return '{"id":"TestSample","type":"TestSample","max_billing_amount":' .CurrencyTest::getJson() . ',"occurrences":"TestSample","amount_range":' .CurrencyTest::getJson() . ',"buyer_editable":"TestSample"}';
}
/**
* Gets Object Instance with Json data filled in
* @return Terms
*/
public static function getObject()
{
return new Terms(self::getJson());
}
/**
* Tests for Serialization and Deserialization Issues
* @return Terms
*/
public function testSerializationDeserialization()
{
$obj = new Terms(self::getJson());
$this->assertNotNull($obj);
$this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getType());
$this->assertNotNull($obj->getMaxBillingAmount());
$this->assertNotNull($obj->getOccurrences());
$this->assertNotNull($obj->getAmountRange());
$this->assertNotNull($obj->getBuyerEditable());
$this->assertEquals(self::getJson(), $obj->toJson());
return $obj;
}
/**
* @depends testSerializationDeserialization
* @param Terms $obj
*/
public function testGetters($obj)
{
$this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getType(), "TestSample");
$this->assertEquals($obj->getMaxBillingAmount(), CurrencyTest::getObject());
$this->assertEquals($obj->getOccurrences(), "TestSample");
$this->assertEquals($obj->getAmountRange(), CurrencyTest::getObject());
$this->assertEquals($obj->getBuyerEditable(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param Terms $obj
*/
public function testDeprecatedGetters($obj)
{
$this->assertEquals($obj->getMax_billing_amount(), CurrencyTest::getObject());
$this->assertEquals($obj->getAmount_range(), CurrencyTest::getObject());
$this->assertEquals($obj->getBuyer_editable(), "TestSample");
}
/**
* @depends testSerializationDeserialization
* @param Terms $obj
*/
public function testDeprecatedSetterNormalGetter($obj)
{
// Check for Max_billing_amount
$obj->setMaxBillingAmount(null);
$this->assertNull($obj->getMax_billing_amount());
$this->assertNull($obj->getMaxBillingAmount());
$this->assertSame($obj->getMaxBillingAmount(), $obj->getMax_billing_amount());
$obj->setMax_billing_amount(CurrencyTest::getObject());
$this->assertEquals($obj->getMax_billing_amount(), CurrencyTest::getObject());
// Check for Amount_range
$obj->setAmountRange(null);
$this->assertNull($obj->getAmount_range());
$this->assertNull($obj->getAmountRange());
$this->assertSame($obj->getAmountRange(), $obj->getAmount_range());
$obj->setAmount_range(CurrencyTest::getObject());
$this->assertEquals($obj->getAmount_range(), CurrencyTest::getObject());
// Check for Buyer_editable
$obj->setBuyerEditable(null);
$this->assertNull($obj->getBuyer_editable());
$this->assertNull($obj->getBuyerEditable());
$this->assertSame($obj->getBuyerEditable(), $obj->getBuyer_editable());
$obj->setBuyer_editable("TestSample");
$this->assertEquals($obj->getBuyer_editable(), "TestSample");
//Test All Deprecated Getters and Normal Getters
$this->testDeprecatedGetters($obj);
$this->testGetters($obj);
}
}

View File

@@ -0,0 +1,246 @@
<?php
namespace PayPal\Test\Functional\Api;
use PayPal\Api\Agreement;
use PayPal\Api\AgreementStateDescriptor;
use PayPal\Api\Currency;
use PayPal\Api\Patch;
use PayPal\Api\PatchRequest;
use PayPal\Api\Plan;
use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext;
use PayPal\Rest\IResource;
use PayPal\Api\CreateProfileResponse;
use PayPal\Transport\PPRestCall;
use PayPal\Api\WebProfile;
/**
* Class Billing Agreements
*
* @package PayPal\Test\Api
*/
class BillingAgreementsFunctionalTest extends \PHPUnit_Framework_TestCase
{
public $operation;
public $response;
public $mode = 'mock';
public $mockPPRestCall;
public function setUp()
{
$className = $this->getClassName();
$testName = $this->getName();
$this->setupTest($className, $testName);
}
public function setupTest($className, $testName)
{
$operationString = file_get_contents(__DIR__ . "/../resources/$className/$testName.json");
$this->operation = json_decode($operationString, true);
$this->response = true;
if (array_key_exists('body', $this->operation['response'])) {
$this->response = json_encode($this->operation['response']['body']);
}
$this->mode = getenv('REST_MODE') ? getenv('REST_MODE') : 'mock';
if ($this->mode != 'sandbox') {
// Mock PPRest Caller if mode set to mock
$this->mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$this->mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
$this->response
));
}
}
/**
* Returns just the classname of the test you are executing. It removes the namespaces.
* @return string
*/
public function getClassName()
{
return join('', array_slice(explode('\\', get_class($this)), -1));
}
/**
* @return Agreement
*/
public function testCreatePayPalAgreement()
{
$plan = BillingPlansFunctionalTest::getPlan();
$request = $this->operation['request']['body'];
$agreement = new Agreement($request);
// Update the Schema to use a working Plan
$agreement->getPlan()->setId($plan->getId());
$result = $agreement->create(null, $this->mockPPRestCall);
$this->assertNotNull($result);
return $result;
}
/**
* @depends testCreatePayPalAgreement
* @param $agreement Agreement
* @return Agreement
*/
public function testExecute($agreement)
{
if ($this->mode == 'sandbox') {
$this->markTestSkipped('Not executable on sandbox environment. Needs human interaction');
}
$links = $agreement->getLinks();
$url = parse_url($links[0]->getHref(), 6);
parse_str($url, $result);
$paymentToken = $result['token'];
$this->assertNotNull($paymentToken);
$this->assertNotEmpty($paymentToken);
$result = $agreement->execute($paymentToken, null, $this->mockPPRestCall);
return $result;
}
/**
* @return Agreement
*/
public function testCreateCCAgreement()
{
$plan = BillingPlansFunctionalTest::getPlan();
$request = $this->operation['request']['body'];
$agreement = new Agreement($request);
// Update the Schema to use a working Plan
$agreement->getPlan()->setId($plan->getId());
$result = $agreement->create(null, $this->mockPPRestCall);
$this->assertNotNull($result);
return $result;
}
/**
* @depends testCreateCCAgreement
* @param $agreement Agreement
* @return Plan
*/
public function testGet($agreement)
{
$result = Agreement::get($agreement->getId(), null, $this->mockPPRestCall);
$this->assertNotNull($result);
$this->assertEquals($agreement->getId(), $result->getId());
return $result;
}
/**
* @depends testGet
* @param $agreement Agreement
*/
public function testUpdate($agreement)
{
/** @var Patch[] $request */
$request = $this->operation['request']['body'][0];
$patch = new Patch();
$patch->setOp($request['op']);
$patch->setPath($request['path']);
$patch->setValue($request['value']);
$patches = array();
$patches[] = $patch;
$patchRequest = new PatchRequest();
$patchRequest->setPatches($patches);
$result = $agreement->update($patchRequest, null, $this->mockPPRestCall);
$this->assertTrue($result);
}
/**
* @depends testGet
* @param $agreement Agreement
* @return Agreement
*/
public function testSetBalance($agreement)
{
$this->markTestSkipped('Skipped as the fix is on the way.');
$currency = new Currency($this->operation['request']['body']);
$result = $agreement->setBalance($currency, null, $this->mockPPRestCall);
$this->assertTrue($result);
return $agreement;
}
/**
* @depends testGet
* @param $agreement Agreement
* @return Agreement
*/
public function testBillBalance($agreement)
{
$this->markTestSkipped('Skipped as the fix is on the way.');
$agreementStateDescriptor = new AgreementStateDescriptor($this->operation['request']['body']);
$result = $agreement->billBalance($agreementStateDescriptor, null, $this->mockPPRestCall);
$this->assertTrue($result);
return $agreement;
}
/**
* @depends testGet
* @param $agreement Agreement
* @return Agreement
*/
public function testGetTransactions($agreement)
{
$this->markTestSkipped('Skipped as the fix is on the way.');
$result = Agreement::transactions($agreement->getId(), null, $this->mockPPRestCall);
$this->assertNotNull($result);
}
/**
* @depends testGet
* @param $agreement Agreement
* @return Agreement
*/
public function testSuspend($agreement)
{
$agreementStateDescriptor = new AgreementStateDescriptor($this->operation['request']['body']);
$result = $agreement->suspend($agreementStateDescriptor, null, $this->mockPPRestCall);
$this->setupTest($this->getClassName(), 'testGetSuspended');
$get = $this->testGet($agreement);
$this->assertTrue($result);
$this->assertEquals('Suspended', $get->getState());
return $get;
}
/**
* @depends testSuspend
* @param $agreement Agreement
* @return Agreement
*/
public function testReactivate($agreement)
{
$agreementStateDescriptor = new AgreementStateDescriptor($this->operation['request']['body']);
$result = $agreement->reActivate($agreementStateDescriptor, null, $this->mockPPRestCall);
$this->assertTrue($result);
$this->setupTest($this->getClassName(), 'testGet');
$get = $this->testGet($agreement);
$this->assertEquals('Active', $get->getState());
return $get;
}
/**
* @depends testReactivate
* @param $agreement Agreement
* @return Agreement
*/
public function testCancel($agreement)
{
$agreementStateDescriptor = new AgreementStateDescriptor($this->operation['request']['body']);
$result = $agreement->cancel($agreementStateDescriptor, null, $this->mockPPRestCall);
$this->assertTrue($result);
$this->setupTest($this->getClassName(), 'testGetCancelled');
$get = $this->testGet($agreement);
$this->assertEquals('Cancelled', $get->getState());
return $get;
}
}

View File

@@ -0,0 +1,217 @@
<?php
namespace PayPal\Test\Functional\Api;
use PayPal\Api\Patch;
use PayPal\Api\PatchRequest;
use PayPal\Api\Plan;
use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext;
use PayPal\Rest\IResource;
use PayPal\Api\CreateProfileResponse;
use PayPal\Transport\PPRestCall;
use PayPal\Api\WebProfile;
/**
* Class Billing Plans
*
* @package PayPal\Test\Api
*/
class BillingPlansFunctionalTest extends \PHPUnit_Framework_TestCase
{
public static $obj;
public $operation;
public $response;
public $mode = 'mock';
public $mockPPRestCall;
public function setUp()
{
$className = $this->getClassName();
$testName = $this->getName();
$this->setupTest($className, $testName);
}
public function setupTest($className, $testName)
{
$operationString = file_get_contents(__DIR__ . "/../resources/$className/$testName.json");
$this->operation = json_decode($operationString, true);
$this->response = true;
if (array_key_exists('body', $this->operation['response'])) {
$this->response = json_encode($this->operation['response']['body']);
}
$this->mode = getenv('REST_MODE') ? getenv('REST_MODE') : 'mock';
if ($this->mode != 'sandbox') {
// Mock PPRest Caller if mode set to mock
$this->mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$this->mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
$this->response
));
}
}
/**
* Helper function to get a Plan object in Active State
*
* @return Plan
*/
public static function getPlan()
{
if (!self::$obj) {
$test = new self();
// Creates a Plan
$test->setupTest($test->getClassName(), 'testCreate');
self::$obj = $test->testCreate();
// Updates the Status to Active
$test->setupTest($test->getClassName(), 'testUpdateChangingState');
self::$obj = $test->testUpdateChangingState(self::$obj);
}
return self::$obj;
}
/**
* Returns just the classname of the test you are executing. It removes the namespaces.
* @return string
*/
public function getClassName()
{
return join('', array_slice(explode('\\', get_class($this)), -1));
}
public function testCreate()
{
$request = $this->operation['request']['body'];
$obj = new Plan($request);
$result = $obj->create(null, $this->mockPPRestCall);
$this->assertNotNull($result);
self::$obj = $result;
return $result;
}
public function testCreateWithNOChargeModel()
{
$request = $this->operation['request']['body'];
$obj = new Plan($request);
$result = $obj->create(null, $this->mockPPRestCall);
$this->assertNotNull($result);
return $result;
}
/**
* @depends testCreate
* @param $plan Plan
* @return Plan
*/
public function testGet($plan)
{
$result = Plan::get($plan->getId(), null, $this->mockPPRestCall);
$this->assertNotNull($result);
$this->assertEquals($plan->getId(), $result->getId());
$this->assertEquals($plan, $result, "", 0, 10, true);
return $result;
}
/**
* @depends testGet
* @param $plan Plan
*/
public function testGetList($plan)
{
$result = Plan::all(array('page_size' => '20', 'total_required' => 'yes'), null, $this->mockPPRestCall);
$this->assertNotNull($result);
$totalPages = $result->getTotalPages();
$found = false;
$foundObject = null;
do {
foreach ($result->getPlans() as $obj) {
if ($obj->getId() == $plan->getId()) {
$found = true;
$foundObject = $obj;
break;
}
}
if (!$found) {
$result = Plan::all(array('page' => --$totalPages, 'page_size' => '20', 'total_required' => 'yes'), null, $this->mockPPRestCall);
}
} while ($totalPages > 0 && $found == false);
$this->assertTrue($found, "The Created Plan was not found in the get list");
$this->assertEquals($plan->getId(), $foundObject->getId());
}
/**
* @depends testGet
* @param $plan Plan
*/
public function testUpdateChangingMerchantPreferences($plan)
{
/** @var Patch[] $request */
$request = $this->operation['request']['body'][0];
$patch = new Patch();
$patch->setOp($request['op']);
$patch->setPath($request['path']);
$patch->setValue($request['value']);
$patches = array();
$patches[] = $patch;
$patchRequest = new PatchRequest();
$patchRequest->setPatches($patches);
$result = $plan->update($patchRequest, null, $this->mockPPRestCall);
$this->assertTrue($result);
}
/**
* @depends testGet
* @param $plan Plan
*/
public function testUpdateChangingPD($plan)
{
/** @var Patch[] $request */
$request = $this->operation['request']['body'][0];
$patch = new Patch();
$patch->setOp($request['op']);
$paymentDefinitions = $plan->getPaymentDefinitions();
$patch->setPath('/payment-definitions/' . $paymentDefinitions[0]->getId());
$patch->setValue($request['value']);
$patches = array();
$patches[] = $patch;
$patchRequest = new PatchRequest();
$patchRequest->setPatches($patches);
$result = $plan->update($patchRequest, null, $this->mockPPRestCall);
$this->assertTrue($result);
}
/**
* @depends testGet
* @param $plan Plan
* @return Plan
*/
public function testUpdateChangingState($plan)
{
/** @var Patch[] $request */
$request = $this->operation['request']['body'][0];
$patch = new Patch();
$patch->setOp($request['op']);
$patch->setPath($request['path']);
$patch->setValue($request['value']);
$patches = array();
$patches[] = $patch;
$patchRequest = new PatchRequest();
$patchRequest->setPatches($patches);
$result = $plan->update($patchRequest, null, $this->mockPPRestCall);
$this->assertTrue($result);
return Plan::get($plan->getId(), null, $this->mockPPRestCall);
}
}

View File

@@ -0,0 +1,146 @@
<?php
namespace PayPal\Test\Functional\Api;
use PayPal\Api\Amount;
use PayPal\Api\Patch;
use PayPal\Api\PatchRequest;
use PayPal\Api\Payment;
use PayPal\Api\PaymentExecution;
use PayPal\Api\Refund;
use PayPal\Api\Sale;
use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext;
use PayPal\Rest\IResource;
use PayPal\Api\CreateProfileResponse;
use PayPal\Transport\PPRestCall;
use PayPal\Api\WebProfile;
/**
* Class WebProfile
*
* @package PayPal\Test\Api
*/
class PaymentsFunctionalTest extends \PHPUnit_Framework_TestCase
{
public $operation;
public $response;
public $mode = 'mock';
public $mockPPRestCall;
public function setUp()
{
$className = $this->getClassName();
$testName = $this->getName();
$operationString = file_get_contents(__DIR__ . "/../resources/$className/$testName.json");
$this->operation = json_decode($operationString, true);
$this->response = true;
if (array_key_exists('body', $this->operation['response'])) {
$this->response = json_encode($this->operation['response']['body']);
}
$this->mode = getenv('REST_MODE') ? getenv('REST_MODE') : 'mock';
if ($this->mode != 'sandbox') {
// Mock PPRest Caller if mode set to mock
$this->mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PPRestCall')
->disableOriginalConstructor()
->getMock();
$this->mockPPRestCall->expects($this->any())
->method('execute')
->will($this->returnValue(
$this->response
));
}
}
/**
* Returns just the classname of the test you are executing. It removes the namespaces.
* @return string
*/
public function getClassName()
{
return join('', array_slice(explode('\\', get_class($this)), -1));
}
public function testCreate()
{
$request = $this->operation['request']['body'];
$obj = new Payment($request);
$result = $obj->create(null, $this->mockPPRestCall);
$this->assertNotNull($result);
return $result;
}
public function testCreateWallet()
{
$request = $this->operation['request']['body'];
$obj = new Payment($request);
$result = $obj->create(null, $this->mockPPRestCall);
$this->assertNotNull($result);
return $result;
}
/**
* @depends testCreate
* @param $payment Payment
* @return Payment
*/
public function testGet($payment)
{
$result = Payment::get($payment->getId(), null, $this->mockPPRestCall);
$this->assertNotNull($result);
$this->assertEquals($payment->getId(), $result->getId());
$this->assertEquals($payment, $result, "", 0, 10, true);
return $result;
}
/**
* @depends testGet
* @param $payment Payment
* @return Sale
*/
public function testGetSale($payment)
{
$transactions = $payment->getTransactions();
$transaction = $transactions[0];
$relatedResources = $transaction->getRelatedResources();
$resource = $relatedResources[0];
$result = Sale::get($resource->getSale()->getId(), null, $this->mockPPRestCall);
$this->assertNotNull($result);
$this->assertEquals($resource->getSale()->getId(), $result->getId());
return $result;
}
/**
* @depends testGetSale
* @param $sale Sale
* @return Sale
*/
public function testRefundSale($sale)
{
$refund = new Refund($this->operation['request']['body']);
$result = $sale->refund($refund, null, $this->mockPPRestCall);
$this->assertNotNull($result);
$this->assertEquals('completed', $result->getState());
$this->assertEquals($sale->getId(), $result->getSaleId());
$this->assertEquals($sale->getParentPayment(), $result->getParentPayment());
}
/**
* @depends testGet
* @param $payment Payment
* @return Payment
*/
public function testExecute($payment)
{
if ($this->mode == 'sandbox') {
$this->markTestSkipped('Not executable on sandbox environment. Needs human interaction');
}
}
}

View File

@@ -1,6 +1,6 @@
<?php
namespace PayPal\Test\Api;
namespace PayPal\Test\Functional\Api;
use PayPal\Api\Patch;
use PayPal\Common\PPModel;

View File

@@ -0,0 +1,34 @@
{
"description" : "Bill an outstanding amount for an agreement by passing the ID of the agreement to the request URI. In addition, pass an agreement_state_descriptor object in the request JSON that includes a note about the reason for changing the state of the agreement and the amount and currency for the agreement.",
"title" : "bill-balance",
"runnable" : true,
"operationId" : "agreement.bill-balance",
"user" : {
"scopes" : [ "https://uri.paypal.com/services/subscriptions"]
},
"credentials" : {
"oauth": {
"path" : "/v1/oauth/token",
"clientId":"",
"clientSecret":""
}
},
"request" : {
"path" : "v1/payments/billing-agreements/{Agreement-Id}/bill-balance",
"method" : "POST",
"headers" : {},
"body" :
{
"note":"Billing Balance Amount",
"amount": {
"value" : "100",
"currency" : "USD"
}
}
},
"response" : {
"status" : "204 No Content",
"headers" : {},
"body" : {}
}
}

View File

@@ -0,0 +1,30 @@
{
"description" : "This operation cancels the agreement",
"title" : "Cancel agreement",
"runnable" : true,
"operationId" : "agreement.cancel",
"user" : {
"scopes" : [ "https://uri.paypal.com/services/subscriptions"]
},
"credentials" : {
"oauth": {
"path" : "/v1/oauth/token",
"clientId":"",
"clientSecret":""
}
},
"request" : {
"path" : "v1/payments/billing-agreements/{Agreement-Id}/cancel",
"method" : "POST",
"headers" : {},
"body" :
{
"note": "Cancelling the profile"
}
},
"response" : {
"status" : "204 No Content",
"headers" : {},
"body" : {}
}
}

View File

@@ -0,0 +1,69 @@
{
"description": "This operation creates agreement having Credit card as payment option",
"title": "Agreement created using credit card",
"runnable": true,
"operationId": "agreement.create",
"user": {
"scopes": ["https://uri.paypal.com/services/subscriptions"]
},
"credentials": {
"oauth": {
"path": "/v1/oauth/token",
"clientId": "",
"clientSecret": ""
}
},
"request": {
"path": "v1/payments/billing-agreements/",
"method": "POST",
"headers": {},
"body": {
"name": "DPRP",
"description": "Payment with credit Card ",
"start_date": "2015-06-17T9:45:04Z",
"plan": {
"id": "P-1WJ68935LL406420PUTENA2I"
},
"shipping_address": {
"line1": "111 First Street",
"city": "Saratoga",
"state": "CA",
"postal_code": "95070",
"country_code": "US"
},
"payer": {
"payment_method": "credit_card",
"payer_info": {
"email": "jaypatel512-facilitator@hotmail.com"
},
"funding_instruments": [
{
"credit_card": {
"type": "visa",
"number": "4417119669820331",
"expire_month": "12",
"expire_year": "2017",
"cvv2": "128"
}
}
]
}
}
},
"response": {
"status": "200 OK",
"headers": {},
"body": {
"id": "I-V8SSE9WLJGY6",
"links": [
{
"href": "https://stage2p2163.qa.paypal.com/v1/payments/billing-agreements/I-V8SSE9WLJGY6",
"rel": "self",
"method": "GET"
}
]
}
}
}

View File

@@ -0,0 +1,141 @@
{
"description": "This operation creates agreement having PayPal as payment option",
"title": "Agreement created having PayPal as payment option",
"runnable": true,
"operationId": "agreement.create",
"user": {
"scopes": ["https://uri.paypal.com/services/subscriptions"]
},
"credentials": {
"oauth": {
"path": "/v1/oauth/token",
"clientId": "",
"clientSecret": ""
}
},
"request": {
"path": "v1/payments/billing-agreements/",
"method": "POST",
"headers": {},
"body": {
"name": "Base Agreement",
"description": "Basic agreement",
"start_date": "2015-06-17T9:45:04Z",
"plan": {
"id": "P-1WJ68935LL406420PUTENA2I"
},
"payer": {
"payment_method": "paypal"
},
"shipping_address": {
"line1": "111 First Street",
"city": "Saratoga",
"state": "CA",
"postal_code": "95070",
"country_code": "US"
}
}
},
"response": {
"status": "201 Created",
"headers": {},
"body": {
"name": "Base Agreement",
"description": "Basic agreement",
"plan": {
"id": "P-1WJ68935LL406420PUTENA2I",
"state": "ACTIVE",
"name": "Fast Speed Plan",
"description": "Bathinda",
"type": "INFINITE",
"payment_definitions": [
{
"id": "PD-9WG6983719571780GUTENA2I",
"name": "Payment Definition-1",
"type": "REGULAR",
"frequency": "Day",
"amount": {
"currency": "GBP",
"value": "10"
},
"charge_models": [
{
"id": "CHM-8373958130821962WUTENA2Q",
"type": "SHIPPING",
"amount": {
"currency": "GBP",
"value": "1"
}
},
{
"id": "CHM-2937144979861454NUTENA2Q",
"type": "TAX",
"amount": {
"currency": "GBP",
"value": "2"
}
}
],
"cycles": "0",
"frequency_interval": "1"
},
{
"id": "PD-89M493313S710490TUTENA2Q",
"name": "Payment Definition-1",
"type": "TRIAL",
"frequency": "Month",
"amount": {
"currency": "GBP",
"value": "100"
},
"charge_models": [
{
"id": "CHM-78K47820SS4923826UTENA2Q",
"type": "SHIPPING",
"amount": {
"currency": "GBP",
"value": "10"
}
},
{
"id": "CHM-9M366179U7339472RUTENA2Q",
"type": "TAX",
"amount": {
"currency": "GBP",
"value": "12"
}
}
],
"cycles": "5",
"frequency_interval": "2"
}
],
"merchant_preferences": {
"setup_fee": {
"currency": "GBP",
"value": "1234"
},
"max_fail_attempts": "21",
"return_url": "http://www.paypal.com",
"cancel_url": "http://www.yahoo.com",
"auto_bill_amount": "YES",
"initial_fail_amount_action": "CONTINUE"
}
},
"links": [
{
"href": "https://stage2p2163.qa.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-32P34986EV202211E",
"rel": "approval_url",
"method": "REDIRECT"
},
{
"href": "https://stage2p2163.qa.paypal.com/v1/payments/billing-agreements/EC-32P34986EV202211E/agreement-execute",
"rel": "execute",
"method": "POST"
}
],
"start_date": "2114-06-17T9:45:04Z"
}
}
}

View File

@@ -0,0 +1,170 @@
{
"description" : "This operation creates agreement having PayPal as payment option",
"title" : "Agreement created having PayPal as payment option",
"runnable" : true,
"operationId" : "agreement.create",
"user" : {
"scopes" : [ "https://uri.paypal.com/services/subscriptions"]
},
"credentials" : {
"oauth": {
"path" : "/v1/oauth/token",
"clientId":"",
"clientSecret":""
}
},
"request" : {
"path" : "v1/payments/billing-agreements/",
"method" : "POST",
"headers" : {},
"body" :
{
"name":"Override Agreement",
"description": "Agreement where merchant preferences and charge model is overridden",
"start_date" : "2014-06-17T03:05:05Z",
"payer":{
"payment_method":"paypal",
"payer_info":
{
"email":"kkarunanidhi-per1@paypal.com"
}
},
"plan":{
"id":"P-1WJ68935LL406420PUTENA2I"
},
"shipping_address":{
"line1":"Hotel Staybridge",
"line2":"Crooke Street",
"city":"San Jose",
"state":"CA",
"postal_code":"95112",
"country_code":"US"
},
"override_merchant_preferences":{
"setup_fee": {
"value" : "3",
"currency" : "GBP"
},
"return_url":"http://indiatimes.com",
"cancel_url":"http://rediff.com",
"auto_bill_amount": "YES",
"initial_fail_amount_action": "CONTINUE",
"max_fail_attempts": "11"
},
"override_charge_models":[
{
"charge_id": "CHM-8373958130821962WUTENA2Q",
"amount": {
"value" :"1",
"currency" : "GBP"
}
}
]
}
},
"response" : {
"status" : "201 Created",
"headers" : {},
"body" :
{
"name": "Override Agreement",
"description": "Agreement where merchant preferences and charge model is overridden",
"plan": {
"id": "P-1WJ68935LL406420PUTENA2I",
"state": "ACTIVE",
"name": "Fast Speed Plan",
"description": "Vanilla plan",
"type": "INFINITE",
"payment_definitions": [
{
"id": "PD-9WG6983719571780GUTENA2I",
"name": "Payment Definition-1",
"type": "REGULAR",
"frequency": "Day",
"amount": {
"currency": "GBP",
"value": "10"
},
"charge_models": [
{
"id": "CHM-8373958130821962WUTENA2Q",
"type": "SHIPPING",
"amount": {
"currency": "GBP",
"value": "1"
}
},
{
"id": "CHM-2937144979861454NUTENA2Q",
"type": "TAX",
"amount": {
"currency": "GBP",
"value": "2"
}
}
],
"cycles": "0",
"frequency_interval": "1"
},
{
"id": "PD-89M493313S710490TUTENA2Q",
"name": "Payment Definition-1",
"type": "TRIAL",
"frequency": "Month",
"amount": {
"currency": "GBP",
"value": "100"
},
"charge_models": [
{
"id": "CHM-78K47820SS4923826UTENA2Q",
"type": "SHIPPING",
"amount": {
"currency": "GBP",
"value": "10"
}
},
{
"id": "CHM-9M366179U7339472RUTENA2Q",
"type": "TAX",
"amount": {
"currency": "GBP",
"value": "12"
}
}
],
"cycles": "5",
"frequency_interval": "2"
}
],
"merchant_preferences": {
"setup_fee": {
"currency": "GBP",
"value": "3"
},
"max_fail_attempts": "11",
"return_url": "http://indiatimes.com",
"cancel_url": "http://rediff.com",
"auto_bill_amount": "YES",
"initial_fail_amount_action": "CONTINUE"
}
},
"links": [
{
"href": "https://stage2p2163.qa.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-83C745436S346813F",
"rel": "approval_url",
"method": "REDIRECT"
},
{
"href": "https://stage2p2163.qa.paypal.com/v1/payments/billing-agreements/EC-83C745436S346813F/agreement-execute",
"rel": "execute",
"method": "POST"
}
],
"start_date": "2014-06-17T03:05:05Z"
}
}
}

View File

@@ -0,0 +1,37 @@
{
"description" : "Create PayPal agreement after buyer approval",
"title" : "Agreement creation",
"runnable" : true,
"operationId" : "agreement.execute",
"user" : {
"scopes" : ["https://uri.paypal.com/services/subscriptions" ]
},
"credentials" : {
"oauth": {
"path" : "/v1/oauth/token",
"clientId":"",
"clientSecret":""
}
},
"request" : {
"path" : "v1/payments/billing-agreements/EC-6CT996018D989343F/agreement-execute",
"method" : "POST",
"headers" : {},
"body" : {}
},
"response" : {
"status" : "200 OK",
"headers" : {},
"body" :
{
"id": "I-5D3XDN2D5FH1",
"links": [
{
"href": "https://stage2p2163.qa.paypal.com/v1/payments/billing-agreements/I-5D3XDN2D5FH1",
"rel": "self",
"method": "GET"
}
]
}
}
}

View File

@@ -0,0 +1,140 @@
{
"description": "This operation fetches details of the agreement",
"title": "Fetch agreement details",
"runnable": true,
"operationId": "agreement.get",
"user": {
"scopes": ["https://uri.paypal.com/services/subscriptions"]
},
"credentials": {
"oauth": {
"path": "/v1/oauth/token",
"clientId": "",
"clientSecret": ""
}
},
"request": {
"path": "v1/payments/billing-agreements/I-5D3XDN2D5FH1",
"method": "GET",
"headers": {},
"body": {}
},
"response": {
"status": "200 OK",
"headers": {},
"body": {
"id": "I-V8SSE9WLJGY6",
"state": "Active",
"description": "Payment with credit Card ",
"plan": {
"payment_definitions": [
{
"type": "TRIAL",
"frequency": "Week",
"amount": {
"currency": "USD",
"value": "9.19"
},
"cycles": "2",
"charge_models": [
{
"type": "TAX",
"amount": {
"currency": "USD",
"value": "2.00"
}
},
{
"type": "SHIPPING",
"amount": {
"currency": "USD",
"value": "1.00"
}
}
],
"frequency_interval": "5"
},
{
"type": "REGULAR",
"frequency": "Month",
"amount": {
"currency": "USD",
"value": "100.00"
},
"cycles": "12",
"charge_models": [
{
"type": "TAX",
"amount": {
"currency": "USD",
"value": "12.00"
}
},
{
"type": "SHIPPING",
"amount": {
"currency": "USD",
"value": "10.00"
}
}
],
"frequency_interval": "2"
}
],
"merchant_preferences": {
"setup_fee": {
"currency": "USD",
"value": "1.00"
},
"max_fail_attempts": "0",
"auto_bill_amount": "YES"
}
},
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-XTN3V7NY6KG7/suspend",
"rel": "suspend",
"method": "POST"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-XTN3V7NY6KG7/re-activate",
"rel": "re_activate",
"method": "POST"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-XTN3V7NY6KG7/cancel",
"rel": "cancel",
"method": "POST"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-XTN3V7NY6KG7/bill-balance",
"rel": "self",
"method": "POST"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-XTN3V7NY6KG7/set-balance",
"rel": "self",
"method": "POST"
}
],
"start_date": "2015-06-17T16:45:04Z",
"agreement_details": {
"outstanding_balance": {
"currency": "USD",
"value": "200.00"
},
"cycles_remaining": "2",
"cycles_completed": "0",
"next_billing_date": "2015-06-17T10:00:00Z",
"last_payment_date": "2014-10-28T22:48:56Z",
"last_payment_amount": {
"currency": "USD",
"value": "1.00"
},
"final_payment_date": "2017-06-26T10:00:00Z",
"failed_payment_count": "0"
}
}
}
}

View File

@@ -0,0 +1,140 @@
{
"description": "This operation fetches details of the agreement",
"title": "Fetch agreement details",
"runnable": true,
"operationId": "agreement.get",
"user": {
"scopes": ["https://uri.paypal.com/services/subscriptions"]
},
"credentials": {
"oauth": {
"path": "/v1/oauth/token",
"clientId": "",
"clientSecret": ""
}
},
"request": {
"path": "v1/payments/billing-agreements/I-5D3XDN2D5FH1",
"method": "GET",
"headers": {},
"body": {}
},
"response": {
"status": "200 OK",
"headers": {},
"body": {
"id": "I-V8SSE9WLJGY6",
"state": "Cancelled",
"description": "Payment with credit Card ",
"plan": {
"payment_definitions": [
{
"type": "TRIAL",
"frequency": "Week",
"amount": {
"currency": "USD",
"value": "9.19"
},
"cycles": "2",
"charge_models": [
{
"type": "TAX",
"amount": {
"currency": "USD",
"value": "2.00"
}
},
{
"type": "SHIPPING",
"amount": {
"currency": "USD",
"value": "1.00"
}
}
],
"frequency_interval": "5"
},
{
"type": "REGULAR",
"frequency": "Month",
"amount": {
"currency": "USD",
"value": "100.00"
},
"cycles": "12",
"charge_models": [
{
"type": "TAX",
"amount": {
"currency": "USD",
"value": "12.00"
}
},
{
"type": "SHIPPING",
"amount": {
"currency": "USD",
"value": "10.00"
}
}
],
"frequency_interval": "2"
}
],
"merchant_preferences": {
"setup_fee": {
"currency": "USD",
"value": "1.00"
},
"max_fail_attempts": "0",
"auto_bill_amount": "YES"
}
},
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-XTN3V7NY6KG7/suspend",
"rel": "suspend",
"method": "POST"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-XTN3V7NY6KG7/re-activate",
"rel": "re_activate",
"method": "POST"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-XTN3V7NY6KG7/cancel",
"rel": "cancel",
"method": "POST"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-XTN3V7NY6KG7/bill-balance",
"rel": "self",
"method": "POST"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-XTN3V7NY6KG7/set-balance",
"rel": "self",
"method": "POST"
}
],
"start_date": "2015-06-17T16:45:04Z",
"agreement_details": {
"outstanding_balance": {
"currency": "USD",
"value": "0.00"
},
"cycles_remaining": "2",
"cycles_completed": "0",
"next_billing_date": "2015-06-17T10:00:00Z",
"last_payment_date": "2014-10-28T22:48:56Z",
"last_payment_amount": {
"currency": "USD",
"value": "1.00"
},
"final_payment_date": "2017-06-26T10:00:00Z",
"failed_payment_count": "0"
}
}
}
}

View File

@@ -0,0 +1,140 @@
{
"description": "This operation fetches details of the agreement",
"title": "Fetch agreement details",
"runnable": true,
"operationId": "agreement.get",
"user": {
"scopes": ["https://uri.paypal.com/services/subscriptions"]
},
"credentials": {
"oauth": {
"path": "/v1/oauth/token",
"clientId": "",
"clientSecret": ""
}
},
"request": {
"path": "v1/payments/billing-agreements/I-5D3XDN2D5FH1",
"method": "GET",
"headers": {},
"body": {}
},
"response": {
"status": "200 OK",
"headers": {},
"body": {
"id": "I-V8SSE9WLJGY6",
"state": "Suspended",
"description": "Payment with credit Card ",
"plan": {
"payment_definitions": [
{
"type": "TRIAL",
"frequency": "Week",
"amount": {
"currency": "USD",
"value": "9.19"
},
"cycles": "2",
"charge_models": [
{
"type": "TAX",
"amount": {
"currency": "USD",
"value": "2.00"
}
},
{
"type": "SHIPPING",
"amount": {
"currency": "USD",
"value": "1.00"
}
}
],
"frequency_interval": "5"
},
{
"type": "REGULAR",
"frequency": "Month",
"amount": {
"currency": "USD",
"value": "100.00"
},
"cycles": "12",
"charge_models": [
{
"type": "TAX",
"amount": {
"currency": "USD",
"value": "12.00"
}
},
{
"type": "SHIPPING",
"amount": {
"currency": "USD",
"value": "10.00"
}
}
],
"frequency_interval": "2"
}
],
"merchant_preferences": {
"setup_fee": {
"currency": "USD",
"value": "1.00"
},
"max_fail_attempts": "0",
"auto_bill_amount": "YES"
}
},
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-XTN3V7NY6KG7/suspend",
"rel": "suspend",
"method": "POST"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-XTN3V7NY6KG7/re-activate",
"rel": "re_activate",
"method": "POST"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-XTN3V7NY6KG7/cancel",
"rel": "cancel",
"method": "POST"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-XTN3V7NY6KG7/bill-balance",
"rel": "self",
"method": "POST"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-XTN3V7NY6KG7/set-balance",
"rel": "self",
"method": "POST"
}
],
"start_date": "2015-06-17T16:45:04Z",
"agreement_details": {
"outstanding_balance": {
"currency": "USD",
"value": "0.00"
},
"cycles_remaining": "2",
"cycles_completed": "0",
"next_billing_date": "2015-06-17T10:00:00Z",
"last_payment_date": "2014-10-28T22:48:56Z",
"last_payment_amount": {
"currency": "USD",
"value": "1.00"
},
"final_payment_date": "2017-06-26T10:00:00Z",
"failed_payment_count": "0"
}
}
}
}

View File

@@ -0,0 +1,67 @@
{
"description" : "This operation lists the transactions for the agreement",
"title" : "Transaction listing of agreement",
"runnable" : true,
"operationId" : "agreement.transactions",
"user" : {
"scopes" : [ "https://uri.paypal.com/services/subscriptions"]
},
"credentials" : {
"oauth": {
"path" : "/v1/oauth/token",
"clientId":"",
"clientSecret":""
}
},
"request" : {
"path" : "v1/payments/billing-agreements/{Agreement-Id}/transaction?start-date=yyyy-mm-dd&end-date=yyyy-mm-dd",
"method" : "GET",
"headers" : {},
"body" : {}
},
"response" : {
"status" : "200 OK",
"headers" : {},
"body" :
{
"agreement_transaction_list": [
{
"transaction_id": "I-V8SSE9WLJGY6",
"status": "Created",
"transaction_type": "Recurring Payment",
"payer_email": "",
"payer_name": " ",
"time_stamp": "2014-06-16T13:46:53Z",
"time_zone": "GMT"
},
{
"transaction_id": "I-V8SSE9WLJGY6",
"status": "Suspended",
"transaction_type": "Recurring Payment",
"payer_email": "",
"payer_name": " ",
"time_stamp": "2014-06-16T13:52:26Z",
"time_zone": "GMT"
},
{
"transaction_id": "I-V8SSE9WLJGY6",
"status": "Reactivated",
"transaction_type": "Recurring Payment",
"payer_email": "",
"payer_name": " ",
"time_stamp": "2014-06-16T14:00:23Z",
"time_zone": "GMT"
},
{
"transaction_id": "I-V8SSE9WLJGY6",
"status": "Canceled",
"transaction_type": "Recurring Payment",
"payer_email": "",
"payer_name": " ",
"time_stamp": "2014-06-16T14:02:54Z",
"time_zone": "GMT"
}
]
}
}
}

View File

@@ -0,0 +1,30 @@
{
"description" : "This operation activates the suspended agreement",
"title" : "Reactivate agreement",
"runnable" : true,
"operationId" : "agreement.re-activate",
"user" : {
"scopes" : [ "https://uri.paypal.com/services/subscriptions"]
},
"credentials" : {
"oauth": {
"path" : "/v1/oauth/token",
"clientId":"",
"clientSecret":""
}
},
"request" : {
"path" : "v1/payments/billing-agreements/{Agreement-Id}/re-activate",
"method" : "POST",
"headers" : {},
"body" :
{
"note": "Reactivating the profile"
}
},
"response" : {
"status" : "204 No Content",
"headers" : {},
"body" : {}
}
}

View File

@@ -0,0 +1,31 @@
{
"description" : "Set the balance for an agreement by passing the ID of the agreement to the request URI. In addition, pass a common_currency object in the request JSON that specifies the currency type and value of the balance.",
"title" : "set-balance",
"runnable" : true,
"operationId" : "agreement.set-balance",
"user" : {
"scopes" : [ "https://uri.paypal.com/services/subscriptions"]
},
"credentials" : {
"oauth": {
"path" : "/v1/oauth/token",
"clientId":"",
"clientSecret":""
}
},
"request" : {
"path" : "v1/payments/billing-agreements/{Agreement-Id}/set-balance",
"method" : "POST",
"headers" : {},
"body" :
{
"value" : "200",
"currency" : "USD"
}
},
"response" : {
"status" : "204 No Content",
"headers" : {},
"body" : {}
}
}

View File

@@ -0,0 +1,30 @@
{
"description" : "This operation suspends the agreement",
"title" : "Suspend agreement",
"runnable" : true,
"operationId" : "agreement.suspend",
"user" : {
"scopes" : [ "https://uri.paypal.com/services/subscriptions"]
},
"credentials" : {
"oauth": {
"path" : "/v1/oauth/token",
"clientId":"",
"clientSecret":""
}
},
"request" : {
"path" : "v1/payments/billing-agreements/{Agreement-Id}/suspend",
"method" : "POST",
"headers" : {},
"body" :
{
"note": "Suspending the profile"
}
},
"response" : {
"status" : "204 No Content",
"headers" : {},
"body" : {}
}
}

View File

@@ -0,0 +1,46 @@
{
"description": "This operation updates agreement",
"title": "Update agreement",
"runnable": true,
"operationId": "agreement.update",
"user": {
"scopes": ["https://uri.paypal.com/services/subscriptions"]
},
"credentials": {
"oauth": {
"path": "/v1/oauth/token",
"clientId": "",
"clientSecret": ""
}
},
"request": {
"path": "v1/payments/billing-agreements/{Agreement-Id}",
"method": "PATCH",
"headers": {},
"body": [
{
"op": "replace",
"path": "/",
"value": {
"description": "Updated description",
"start_date": "2024-06-18T10:00:00Z",
"shipping_address":{
"line1":"Hotel Blue Diamond",
"line2":"Church Street",
"city":"San Jose",
"state":"CA",
"postal_code":"95112",
"country_code":"US"
}
}
}
]
},
"response": {
"status": "200 OK",
"headers": {},
"body": {}
}
}

View File

@@ -0,0 +1,186 @@
{
"description": "This operation creates a billing plan having a regular and trial billing period",
"title": "Billing Plan with regular and trial billing period",
"runnable": true,
"operationId": "plan.create",
"user": {
"scopes": ["https://uri.paypal.com/services/subscriptions"]
},
"credentials": {
"oauth": {
"path": "/v1/oauth/token",
"clientId": "",
"clientSecret": ""
}
},
"request": {
"path": "v1/payments/billing-plans/",
"method": "POST",
"headers": {},
"body": {
"name": "Sample Plan",
"description": "Plan with regular and trial",
"type": "fixed",
"payment_definitions": [
{
"name": "Regular Payment Definition",
"type": "REGULAR",
"frequency": "MONTH",
"frequency_interval": "2",
"amount": {
"value": "100",
"currency": "USD"
},
"cycles": "12",
"charge_models": [
{
"type": "SHIPPING",
"amount": {
"value": "10",
"currency": "USD"
}
},
{
"type": "TAX",
"amount": {
"value": "12",
"currency": "USD"
}
}
]
},
{
"name": "Trial Payment Definition",
"type": "trial",
"frequency": "week",
"frequency_interval": "5",
"amount": {
"value": "9.19",
"currency": "USD"
},
"cycles": "2",
"charge_models": [
{
"type": "SHIPPING",
"amount": {
"value": "1",
"currency": "USD"
}
},
{
"type": "TAX",
"amount": {
"value": "2",
"currency": "USD"
}
}
]
}
],
"merchant_preferences": {
"setup_fee": {
"value": "1",
"currency": "USD"
},
"return_url": "http://www.paypal.com",
"cancel_url": "http://www.yahoo.com",
"auto_bill_amount": "YES",
"initial_fail_amount_action": "CONTINUE",
"max_fail_attempts": "0"
}
}
},
"response": {
"status": "201 Created",
"headers": {},
"body": {
"id": "P-7DC96732KA7763723UOPKETA",
"state": "CREATED",
"name": "Sample Plan",
"description": "Plan with regular and trial",
"type": "FIXED",
"payment_definitions": [
{
"id": "PD-0MF87809KK310750TUOPKETA",
"name": "Regular Payment Definition",
"type": "REGULAR",
"frequency": "Month",
"amount": {
"currency": "USD",
"value": "100"
},
"charge_models": [
{
"id": "CHM-89H01708244053321UOPKETA",
"type": "SHIPPING",
"amount": {
"currency": "USD",
"value": "10"
}
},
{
"id": "CHM-1V202179WT9709019UOPKETA",
"type": "TAX",
"amount": {
"currency": "USD",
"value": "12"
}
}
],
"cycles": "12",
"frequency_interval": "2"
},
{
"id": "PD-03223056L66578712UOPKETA",
"name": "Trial Payment Definition",
"type": "TRIAL",
"frequency": "Week",
"amount": {
"currency": "USD",
"value": "9.19"
},
"charge_models": [
{
"id": "CHM-7XN63093LF858372XUOPKETA",
"type": "SHIPPING",
"amount": {
"currency": "USD",
"value": "1"
}
},
{
"id": "CHM-6JY06508UT8026625UOPKETA",
"type": "TAX",
"amount": {
"currency": "USD",
"value": "2"
}
}
],
"cycles": "2",
"frequency_interval": "5"
}
],
"merchant_preferences": {
"setup_fee": {
"currency": "USD",
"value": "1"
},
"max_fail_attempts": "0",
"return_url": "http://www.paypal.com",
"cancel_url": "http://www.yahoo.com",
"auto_bill_amount": "YES",
"initial_fail_amount_action": "CONTINUE"
},
"create_time": "2014-06-16T07:40:20.940Z",
"update_time": "2014-06-16T07:40:20.940Z",
"links": [
{
"href": "https://localhost:12379/v1/payments/billing-plans/P-7DC96732KA7763723UOPKETA",
"rel": "self",
"method": "GET"
}
]
}
}
}

View File

@@ -0,0 +1,93 @@
{
"description" : "This operation creates a billing plan with no charge models and minimal merchant preferences",
"title" : "Billing Plan with no charge model and minimal merchant preferences",
"runnable" : true,
"operationId" : "plan.create",
"user" : {
"scopes" : ["https://uri.paypal.com/services/subscriptions" ]
},
"credentials" : {
"oauth": {
"path" : "/v1/oauth/token",
"clientId":"",
"clientSecret":""
}
},
"request" : {
"path" : "v1/payments/billing-plans/",
"method" :"POST",
"headers" : {},
"body" :
{
"name":"Plan with minimal merchant pref",
"description":"Plan with one payment definition,minimal merchant preferences and no charge models",
"type":"fixed",
"payment_definitions":[
{
"name":"Payment Definition-1",
"type":"REGULAR",
"frequency":"MONTH",
"frequency_interval":"2",
"amount": {
"value" : "100",
"currency" : "USD"
},
"cycles":"12"
}
],
"merchant_preferences":{
"return_url":"http://www.paypal.com",
"cancel_url":"http://www.yahoo.com"
}
}
},
"response" : {
"status" : "201 Created",
"headers" : {},
"body" :
{
"id": "P-1TV69435N82273154UPWDU4I",
"state": "CREATED",
"name": "Plan with minimal merchant pref",
"description": "Plan with one payment definition,minimal merchant preferences and no charge models",
"type": "FIXED",
"payment_definitions": [
{
"id": "PD-62U12008P21526502UPWDU4I",
"name": "Payment Definition-1",
"type": "REGULAR",
"frequency": "Month",
"amount": {
"currency": "USD",
"value": "100"
},
"charge_models": [],
"cycles": "12",
"frequency_interval": "2"
}
],
"merchant_preferences": {
"setup_fee": {
"currency": "USD",
"value": "0"
},
"max_fail_attempts": "0",
"return_url": "http://www.paypal.com",
"cancel_url": "http://www.yahoo.com",
"auto_bill_amount": "NO",
"initial_fail_amount_action": "CONTINUE"
},
"create_time": "2014-06-16T09:05:06.161Z",
"update_time": "2014-06-16T09:05:06.161Z",
"links": [
{
"href": "https://localhost:12379/v1/payments/billing-plans/P-1TV69435N82273154UPWDU4I",
"rel": "self",
"method": "GET"
}
]
}
}
}

View File

@@ -0,0 +1,116 @@
{
"description" : "This operation fetches billing plan details cooresponding to the id.",
"title" : "Fetch billing plan details",
"runnable" : true,
"operationId" : "plan.get",
"user" : {
"scopes" : [ "https://uri.paypal.com/services/subscriptions"]
},
"credentials" : {
"oauth": {
"path" : "/v1/oauth/token",
"clientId":"",
"clientSecret":""
}
},
"request" : {
"path" : "v1/payments/billing-plans/P-7DC96732KA7763723UOPKETA",
"method" : "GET",
"headers" : {},
"body" : {}
},
"response" : {
"status" : "200 OK",
"headers" : {},
"body" :
{
"id": "P-7DC96732KA7763723UOPKETA",
"state": "CREATED",
"name": "Sample Plan",
"description": "Plan with regular and trial",
"type": "FIXED",
"payment_definitions": [
{
"id": "PD-03223056L66578712UOPKETA",
"name": "Trial Payment Definition",
"type": "TRIAL",
"frequency": "Week",
"amount": {
"currency": "USD",
"value": "9.19"
},
"charge_models": [
{
"id": "CHM-6JY06508UT8026625UOPKETA",
"type": "TAX",
"amount": {
"currency": "USD",
"value": "2"
}
},
{
"id": "CHM-7XN63093LF858372XUOPKETA",
"type": "SHIPPING",
"amount": {
"currency": "USD",
"value": "1"
}
}
],
"cycles": "2",
"frequency_interval": "5"
},
{
"id": "PD-0MF87809KK310750TUOPKETA",
"name": "Regular Payment Definition",
"type": "REGULAR",
"frequency": "Month",
"amount": {
"currency": "USD",
"value": "100"
},
"charge_models": [
{
"id": "CHM-1V202179WT9709019UOPKETA",
"type": "TAX",
"amount": {
"currency": "USD",
"value": "12"
}
},
{
"id": "CHM-89H01708244053321UOPKETA",
"type": "SHIPPING",
"amount": {
"currency": "USD",
"value": "10"
}
}
],
"cycles": "12",
"frequency_interval": "2"
}
],
"merchant_preferences": {
"setup_fee": {
"currency": "USD",
"value": "1"
},
"max_fail_attempts": "0",
"return_url": "http://www.paypal.com",
"cancel_url": "http://www.yahoo.com",
"auto_bill_amount": "YES",
"initial_fail_amount_action": "CONTINUE"
},
"create_time": "2014-06-16T07:40:20.940Z",
"update_time": "2014-06-16T07:40:20.940Z",
"links": [
{
"href": "https://localhost:12379/v1/payments/billing-plans/P-7DC96732KA7763723UOPKETA",
"rel": "self",
"method": "GET"
}
]
}
}
}

View File

@@ -0,0 +1,87 @@
{
"description" : "This operation fetches billing plan list",
"title" : "Billing Plan list",
"runnable" : true,
"operationId" : "plans",
"user" : {
"scopes" : ["https://uri.paypal.com/services/subscriptions" ]
},
"credentials" : {
"oauth": {
"path" : "/v1/oauth/token",
"clientId":"",
"clientSecret":""
}
},
"request" : {
"path" : "v1/payments/billing-plans?page_size=3&status=ACTIVE&page_size=2&page=1&total_required=yes",
"method" : "GET",
"headers" : {},
"body" : {}
},
"response" : {
"status" : "200 OK",
"headers" : {},
"body" :
{
"total_items": "166",
"total_pages": "83",
"plans": [
{
"id": "P-7DC96732KA7763723UOPKETA",
"state": "ACTIVE",
"name": "Testing1-Regular3",
"description": "Create Plan for Regular",
"type": "FIXED",
"create_time": "2014-08-22T04:41:52.836Z",
"update_time": "2014-08-22T04:41:53.169Z",
"links": [
{
"href": "https://stage2p1353.qa.paypal.com/v1/payments/billing-plans/P-6EM196669U062173D7QCVDRA",
"rel": "self",
"method": "GET"
}
]
},
{
"id": "P-83567698LH138572V7QCVZJY",
"state": "ACTIVE",
"name": "Testing1-Regular4",
"description": "Create Plan for Regular",
"type": "INFINITE",
"create_time": "2014-08-22T04:41:55.623Z",
"update_time": "2014-08-22T04:41:56.055Z",
"links": [
{
"href": "https://stage2p1353.qa.paypal.com/v1/payments/billing-plans/P-83567698LH138572V7QCVZJY",
"rel": "self",
"method": "GET"
}
]
}
],
"links": [
{
"href": "https://stage2p1353.qa.paypal.com/v1/payments/billing-plans?page_size=2&page=1&start=3&status=active",
"rel": "start",
"method": "GET"
},
{
"href": "https://stage2p1353.qa.paypal.com/v1/payments/billing-plans?page_size=2&page=0&status=active",
"rel": "previous_page",
"method": "GET"
},
{
"href": "https://stage2p1353.qa.paypal.com/v1/payments/billing-plans?page_size=2&page=2&status=active",
"rel": "next_page",
"method": "GET"
},
{
"href": "https://stage2p1353.qa.paypal.com/v1/payments/billing-plans?page_size=2&page=82&status=active",
"rel": "last",
"method": "GET"
}
]
}
}
}

View File

@@ -0,0 +1,40 @@
{
"description" : "Patch operation for changing merchant preferences values",
"title" : "Patch Operation for changing merchant preferences",
"runnable" : true,
"operationId" : "plan.update",
"user" : {
"scopes" : [ "https://uri.paypal.com/services/subscriptions"]
},
"credentials" : {
"oauth": {
"path" : "/v1/oauth/token",
"clientId":"",
"clientSecret":""
}
},
"request" : {
"path" : "v1/payments/billing-plans/{PLAN-ID}/",
"method" : "PATCH",
"headers" : {},
"body" :
[
{
"op":"replace",
"path":"/merchant-preferences",
"value" : {
"cancel_url":"http://www.cancel.com",
"setup_fee": {
"value" :"5",
"currency" : "USD"
}
}
}
]
},
"response" : {
"status" : "200 OK",
"headers" : {},
"body" : { }
}
}

View File

@@ -0,0 +1,41 @@
{
"description" : "Patch operation for changing payment definition values",
"title" : "Patch operation for payment definition",
"runnable" : true,
"operationId" : "plan.update",
"user" : {
"scopes" : [ "https://uri.paypal.com/services/subscriptions"]
},
"credentials" : {
"oauth": {
"path" : "/v1/oauth/token",
"clientId":"",
"clientSecret":""
}
},
"request" : {
"path" : "v1/payments/billing-plans/{PLAN-ID}/",
"method" : "PATCH",
"headers" : {},
"body" :
[
{
"op":"replace",
"path":"/payment-definitions/PD-4816080302132415WUQBT7WA",
"value" : {
"name": "Updated Payment Definition",
"frequency": "Day",
"amount": {
"currency": "USD",
"value": "1"
}
}
}
]
},
"response" : {
"status" : "200 OK",
"headers" : {},
"body" : { }
}
}

View File

@@ -0,0 +1,39 @@
{
"description" : "This operation changes the state of billing plan to active if its in created state.",
"title" : "Patch Request for changing state",
"runnable" : true,
"operationId" : "plan.update",
"user" : {
"scopes" : ["https://uri.paypal.com/services/subscriptions" ]
},
"credentials" : {
"oauth": {
"path" : "/v1/oauth/token",
"clientId":"",
"clientSecret":""
}
},
"request" : {
"path" : "v1/payments/billing-plans/{PLAN-ID}/",
"method" : "PATCH",
"headers" : {},
"body" :
[
{
"op":"replace",
"path":"/",
"value":{
"state":"ACTIVE"
}
}
]
},
"response" : {
"status" : "200 OK",
"headers" : {},
"body" : { }
}
}

View File

@@ -0,0 +1,148 @@
{
"description": "Creates a payment resource.",
"title": "payment",
"runnable": true,
"operationId": "payment.create",
"user": {
"scopes": [ ]
},
"credentials": {
"oauth": {
"clientId": "",
"clientSecret": "",
"path": ""
},
"login": { },
"openIdConnect": { }
},
"request": {
"headers": { },
"body": {
"intent": "sale",
"payer": {
"payment_method": "credit_card",
"funding_instruments": [
{
"credit_card": {
"number": "4417119669820331",
"type": "visa",
"expire_month": 11,
"expire_year": 2018,
"cvv2": "874",
"first_name": "Betsy",
"last_name": "Buyer",
"billing_address": {
"line1": "111 First Street",
"city": "Saratoga",
"state": "CA",
"postal_code": "95070",
"country_code": "US"
}
}
}
]
},
"transactions": [
{
"amount": {
"total": "7.47",
"currency": "USD",
"details": {
"subtotal": "7.41",
"tax": "0.03",
"shipping": "0.03"
}
},
"description": "This is the payment transaction description."
}
]
},
"path": "/v1/payments/payment",
"method": "POST"
},
"response": {
"headers": { },
"body": {
"id": "PAY-17S8410768582940NKEE66EQ",
"create_time": "2013-01-31T04:12:02Z",
"update_time": "2013-01-31T04:12:04Z",
"state": "approved",
"intent": "sale",
"payer": {
"payment_method": "credit_card",
"funding_instruments": [
{
"credit_card": {
"type": "visa",
"number": "xxxxxxxxxxxx0331",
"expire_month": "11",
"expire_year": "2018",
"first_name": "Betsy",
"last_name": "Buyer",
"billing_address": {
"line1": "111 First Street",
"city": "Saratoga",
"state": "CA",
"postal_code": "95070",
"country_code": "US"
}
}
}
]
},
"transactions": [
{
"amount": {
"total": "7.47",
"currency": "USD",
"details": {
"tax": "0.03",
"shipping": "0.03"
}
},
"description": "This is the payment transaction description.",
"related_resources": [
{
"sale": {
"id": "4RR959492F879224U",
"create_time": "2013-01-31T04:12:02Z",
"update_time": "2013-01-31T04:12:04Z",
"state": "completed",
"amount": {
"total": "7.47",
"currency": "USD"
},
"parent_payment": "PAY-17S8410768582940NKEE66EQ",
"links": [
{
"href": "https://api.paypal.com/v1/payments/sale/4RR959492F879224U",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/payments/sale/4RR959492F879224U/refund",
"rel": "refund",
"method": "POST"
},
{
"href": "https://api.paypal.com/v1/payments/payment/PAY-17S8410768582940NKEE66EQ",
"rel": "parent_payment",
"method": "GET"
}
]
}
}
]
}
],
"links": [
{
"href": "https://api.paypal.com/v1/payments/payment/PAY-17S8410768582940NKEE66EQ",
"rel": "self",
"method": "GET"
}
]
},
"status": "201 Created"
}
}

View File

@@ -0,0 +1,177 @@
{
"description": "Creates a payment resource.",
"title": "payment",
"runnable": true,
"operationId": "payment.create",
"user": {
"scopes": []
},
"credentials": {
"oauth": {
"clientId": "",
"clientSecret": "",
"path": ""
},
"login": {},
"openIdConnect": {}
},
"request": {
"headers": {},
"body": {
"intent": "sale",
"payer": {
"payment_method": "paypal",
"payer_info": {
"tax_id_type": "BR_CPF",
"tax_id": "Fh618775611"
}
},
"redirect_urls": {
"return_url": "http://localhost/Server-SDK/rest-api-sdk-php/sample/payments/ExecutePayment.php?success=true",
"cancel_url": "http://localhost/Server-SDK/rest-api-sdk-php/sample/payments/ExecutePayment.php?success=false"
},
"transactions": [
{
"amount": {
"total": "20.00",
"currency": "USD",
"details": {
"subtotal": "17.50",
"tax": "1.30",
"shipping": "1.20",
"handling_fee": "1.00",
"shipping_discount": "-1.00",
"insurance": "0.00"
}
},
"description": "This is the payment transaction description.",
"custom": "EBAY_EMS_90048630024435",
"invoice_number": "48787589677",
"payment_options": {
"allowed_payment_method": "INSTANT_FUNDING_SOURCE"
},
"soft_descriptor": "ECHI5786786",
"item_list": {
"items": [
{
"name": "hat",
"description": "Browncolorsatinhat",
"quantity": "1",
"price": "7.50",
"tax": "0.30",
"sku": "1",
"currency": "USD"
},
{
"name": "handbag",
"description": "Blackcolorhandbag",
"quantity": "5",
"price": "2.00",
"tax": "0.20",
"sku": "product34",
"currency": "USD"
}
],
"shipping_address": {
"recipient_name": "HelloWorld",
"line1": "2211 North First Street",
"city": "San Jose",
"country_code": "US",
"postal_code": "95131",
"phone": "011862212345678",
"state": "CA"
}
}
}
]
},
"path": "/v1/payments/payment",
"method": "POST"
},
"response": {
"headers": {},
"body": {
"id": "PAY-17S8410768582940NKEE66EQ",
"create_time": "2013-01-31T04: 12: 02Z",
"update_time": "2013-01-31T04: 12: 04Z",
"state": "approved",
"intent": "sale",
"payer": {
"payment_method": "credit_card",
"funding_instruments": [
{
"credit_card": {
"type": "visa",
"number": "xxxxxxxxxxxx0331",
"expire_month": "11",
"expire_year": "2018",
"first_name": "Betsy",
"last_name": "Buyer",
"billing_address": {
"line1": "111FirstStreet",
"city": "Saratoga",
"state": "CA",
"postal_code": "95070",
"country_code": "US"
}
}
}
]
},
"transactions": [
{
"amount": {
"total": "20.00",
"currency": "USD",
"details": {
"subtotal": "17.50",
"tax": "1.30",
"shipping": "1.20"
}
},
"description": "Thisisthepaymenttransactiondescription.",
"related_resources": [
{
"sale": {
"id": "4RR959492F879224U",
"create_time": "2013-01-31T04: 12: 02Z",
"update_time": "2013-01-31T04: 12: 04Z",
"state": "completed",
"amount": {
"total": "7.47",
"currency": "USD"
},
"parent_payment": "PAY-17S8410768582940NKEE66EQ",
"links": [
{
"href": "https: //api.paypal.com/v1/payments/sale/4RR959492F879224U",
"rel": "self",
"method": "GET"
},
{
"href": "https: //api.paypal.com/v1/payments/sale/4RR959492F879224U/refund",
"rel": "refund",
"method": "POST"
},
{
"href": "https: //api.paypal.com/v1/payments/payment/PAY-17S8410768582940NKEE66EQ",
"rel": "parent_payment",
"method": "GET"
}
]
}
}
]
}
],
"links": [
{
"href": "https: //api.paypal.com/v1/payments/payment/PAY-17S8410768582940NKEE66EQ",
"rel": "self",
"method": "GET"
}
]
},
"status": "201 Created"
}
}

View File

@@ -0,0 +1,98 @@
{
"description": "Completes a payment.",
"title": "Execute Payment",
"runnable": true,
"operationId": "payment.execute",
"user": {
"scopes": []
},
"credentials": {
"oauth": {
"clientId": "",
"clientSecret": "",
"path": ""
},
"login": {},
"openIdConnect": {}
},
"request": {
"headers": {},
"body": {
"payer_id": "CR87QHB7JTRSC"
},
"path": "/v1/payments/payment/PAY-34629814WL663112AKEE3AWQ/execute",
"method": "POST"
},
"response": {
"headers": {},
"body": {
"id": "PAY-34629814WL663112AKEE3AWQ",
"create_time": "2013-01-30T23:44:26Z",
"update_time": "2013-01-30T23:44:28Z",
"state": "approved",
"intent": "sale",
"payer": {
"payment_method": "paypal",
"payer_info": {
"email": "bbuyer@example.com",
"first_name": "Betsy",
"last_name": "Buyer",
"payer_id": "CR87QHB7JTRSC"
}
},
"transactions": [
{
"amount": {
"total": "7.47",
"currency": "USD",
"details": {
"tax": "0.04",
"shipping": "0.06"
}
},
"description": "This is the payment transaction description.",
"related_resources": [
{
"sale": {
"id": "1KE4800207592173L",
"create_time": "2013-01-30T23:44:26Z",
"update_time": "2013-01-30T23:44:28Z",
"state": "completed",
"amount": {
"total": "7.47",
"currency": "USD"
},
"parent_payment": "PAY-34629814WL663112AKEE3AWQ",
"links": [
{
"href": "https://api.paypal.com/v1/payments/sale/1KE4800207592173L",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/payments/sale/1KE4800207592173L/refund",
"rel": "refund",
"method": "POST"
},
{
"href": "https://api.paypal.com/v1/payments/payment/PAY-34629814WL663112AKEE3AWQ",
"rel": "parent_payment",
"method": "GET"
}
]
}
}
]
}
],
"links": [
{
"href": "https://api.paypal.com/v1/payments/payment/PAY-34629814WL663112AKEE3AWQ",
"rel": "self",
"method": "GET"
}
]
},
"status": "200 OK"
}
}

View File

@@ -0,0 +1,109 @@
{
"description": "Obtain the payment resource for the given identifier.",
"title": "Get a payment resource",
"runnable": true,
"operationId": "payment.get",
"user": {
"scopes": []
},
"credentials": {
"oauth": {
"clientId": "",
"clientSecret": "",
"path": ""
},
"login": {},
"openIdConnect": {}
},
"request": {
"headers": {},
"body": {},
"path": "/v1/payments/payment/PAY-5YK922393D847794YKER7MUI",
"method": "GET"
},
"response": {
"headers": {},
"body": {
"id": "PAY-17S8410768582940NKEE66EQ",
"create_time": "2013-01-31T04:12:02Z",
"update_time": "2013-01-31T04:12:04Z",
"state": "approved",
"intent": "sale",
"payer": {
"payment_method": "credit_card",
"funding_instruments": [
{
"credit_card": {
"type": "visa",
"number": "xxxxxxxxxxxx0331",
"expire_month": "11",
"expire_year": "2018",
"first_name": "Betsy",
"last_name": "Buyer",
"billing_address": {
"line1": "111 First Street",
"city": "Saratoga",
"state": "CA",
"postal_code": "95070",
"country_code": "US"
}
}
}
]
},
"transactions": [
{
"amount": {
"total": "7.47",
"currency": "USD",
"details": {
"tax": "0.03",
"shipping": "0.03"
}
},
"description": "This is the payment transaction description.",
"related_resources": [
{
"sale": {
"id": "4RR959492F879224U",
"create_time": "2013-01-31T04:12:02Z",
"update_time": "2013-01-31T04:12:04Z",
"state": "completed",
"amount": {
"total": "7.47",
"currency": "USD"
},
"parent_payment": "PAY-17S8410768582940NKEE66EQ",
"links": [
{
"href": "https://api.paypal.com/v1/payments/sale/4RR959492F879224U",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/payments/sale/4RR959492F879224U/refund",
"rel": "refund",
"method": "POST"
},
{
"href": "https://api.paypal.com/v1/payments/payment/PAY-17S8410768582940NKEE66EQ",
"rel": "parent_payment",
"method": "GET"
}
]
}
}
]
}
],
"links": [
{
"href": "https://api.paypal.com/v1/payments/payment/PAY-17S8410768582940NKEE66EQ",
"rel": "self",
"method": "GET"
}
]
},
"status": "200 OK"
}
}

View File

@@ -0,0 +1,100 @@
{
"description": "Obtain the payment resource for the given identifier.",
"title": "Get a payment resource",
"runnable": true,
"operationId": "payment.get",
"user": {
"scopes": []
},
"credentials": {
"oauth": {
"clientId": "",
"clientSecret": "",
"path": ""
},
"login": {},
"openIdConnect": {}
},
"request": {
"headers": {},
"body": {},
"path": "/v1/payments/payment/PAY-5YK922393D847794YKER7MUI",
"method": "GET"
},
"response": {
"headers": {},
"body": {
"id": "PAY-5YK922393D847794YKER7MUI",
"create_time": "2013-02-19T22:01:53Z",
"update_time": "2013-02-19T22:01:55Z",
"state": "approved",
"intent": "sale",
"payer": {
"payment_method": "paypal",
"status": "VERIFIED"
},
"transactions": [
{
"amount": {
"total": "7.47",
"currency": "USD",
"details": {
"subtotal": "7.47"
}
},
"description": "This is the payment transaction description.",
"related_resources": [
{
"sale": {
"id": "36C38912MN9658832",
"create_time": "2013-02-19T22:01:53Z",
"update_time": "2013-02-19T22:01:55Z",
"amount": {
"total": "7.47",
"currency": "USD"
},
"payment_mode": "INSTANT_TRANSFER",
"state": "pending",
"reason_code": "ECHECK",
"protection_eligibility": "ELIGIBLE",
"protection_eligibility_type": "ELIGIBLE",
"clearing_time": "2014-06-12T07:00:00Z",
"parent_payment": "PAY-5YK922393D847794YKER7MUI",
"links": [
{
"href": "https://api.paypal.com/v1/payments/sale/36C38912MN9658832",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/payments/sale/36C38912MN9658832/refund",
"rel": "refund",
"method": "POST"
},
{
"href": "https://www.paypal.com/cgi-bin/webscr?cmd=_complete-express-checkout&token=EC-92V50600P8987630S",
"rel": "payment_instruction_redirect",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/payments/payment/PAY-5YK922393D847794YKER7MUI",
"rel": "parent_payment",
"method": "GET"
}
]
}
}
]
}
],
"links": [
{
"href": "https://api.paypal.com/v1/payments/payment/PAY-5YK922393D847794YKER7MUI",
"rel": "self",
"method": "GET"
}
]
},
"status": "200 OK"
}
}

View File

@@ -0,0 +1,60 @@
{
"description": "Lookup a Sale resource.",
"title": "Sale Resource",
"runnable": true,
"operationId": "sale.get",
"user": {
"scopes": []
},
"credentials": {
"oauth": {
"clientId": "",
"clientSecret": "",
"path": ""
},
"login": {},
"openIdConnect": {}
},
"request": {
"headers": {},
"body": {},
"path": "/v1/sales/4RR959492F879224U",
"method": "GET"
},
"response": {
"headers": {},
"body":
{
"id": "4RR959492F879224U",
"create_time": "2014-10-28T19:27:39Z",
"update_time": "2014-10-28T19:28:02Z",
"amount": {
"total": "7.47",
"currency": "USD"
},
"payment_mode": "INSTANT_TRANSFER",
"state": "completed",
"protection_eligibility": "ELIGIBLE",
"protection_eligibility_type": "ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE",
"parent_payment": "PAY-17S8410768582940NKEE66EQ",
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/payments/sale/5SA006225W236580K",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/sale/5SA006225W236580K/refund",
"rel": "refund",
"method": "POST"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-48W25034R6080713AKRH64KY",
"rel": "parent_payment",
"method": "GET"
}
]
},
"status": "201 OK"
}
}

View File

@@ -0,0 +1,62 @@
{
"description": "Creates a refunded sale resource.",
"title": "Refund a Sale",
"runnable": true,
"operationId": "sale.refund",
"user": {
"scopes": []
},
"credentials": {
"oauth": {
"clientId": "",
"clientSecret": "",
"path": ""
},
"login": {},
"openIdConnect": {}
},
"request": {
"headers": {},
"body": {
"amount": {
"total": "2.34",
"currency": "USD"
}
},
"path": "/v1/sales/4RR959492F879224U/refund",
"method": "POST"
},
"response": {
"headers": {},
"body": {
"id": "4CF18861HF410323U",
"create_time": "2013-01-31T04:13:34Z",
"update_time": "2013-01-31T04:13:36Z",
"state": "completed",
"amount": {
"total": "2.34",
"currency": "USD"
},
"sale_id": "4RR959492F879224U",
"parent_payment": "PAY-17S8410768582940NKEE66EQ",
"links": [
{
"href": "https://api.paypal.com/v1/payments/refund/4CF18861HF410323U",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/payments/payment/PAY-46E69296BH2194803KEE662Y",
"rel": "parent_payment",
"method": "GET"
},
{
"href": "https://api.paypal.com/v1/payments/sale/2MU78835H4515710F",
"rel": "sale",
"method": "GET"
}
]
},
"status": "201 Created"
}
}