Skip to content

Commit

Permalink
Merge pull request #7 from swarming/master
Browse files Browse the repository at this point in the history
Add unique ID to transactions
  • Loading branch information
garthbrantley authored Nov 8, 2016
2 parents e5d881c + e5c1f3a commit 0749522
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
23 changes: 21 additions & 2 deletions src/SubscribePro/Service/Transaction/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class Transaction extends DataObject implements TransactionInterface
self::CURRENCY_CODE => true,
self::ORDER_ID => false,
self::IP => false,
self::EMAIL => false
self::EMAIL => false,
self::UNIQUE_ID => false
];

/**
Expand All @@ -34,7 +35,8 @@ class Transaction extends DataObject implements TransactionInterface
self::IP => false,
self::EMAIL => false,
self::CREDITCARD_MONTH => false,
self::CREDITCARD_YEAR => false
self::CREDITCARD_YEAR => false,
self::UNIQUE_ID => false
];

/**
Expand Down Expand Up @@ -309,6 +311,23 @@ public function setCreditcardYear($creditcardYear)
return $this->setData(self::CREDITCARD_YEAR, $creditcardYear);
}

/**
* @return int|null
*/
public function getUniqueId()
{
return $this->getData(self::UNIQUE_ID);
}

/**
* @param int $uniqueId
* @return $this
*/
public function setUniqueId($uniqueId)
{
return $this->setData(self::UNIQUE_ID, $uniqueId);
}

/**
* @return int|null
*/
Expand Down
12 changes: 12 additions & 0 deletions src/SubscribePro/Service/Transaction/TransactionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ interface TransactionInterface extends DataInterface
const CREDITCARD_MONTH = 'creditcard_month';
const CREDITCARD_YEAR = 'creditcard_year';
const BILLING_ADDRESS = 'billing_address';
const UNIQUE_ID = 'unique_id';
const REF_PAYMENT_PROFILE_ID = 'ref_payment_profile_id';
const REF_TRANSACTION_ID = 'ref_transaction_id';
const REF_GATEWAY_ID = 'ref_gateway_id';
Expand Down Expand Up @@ -219,6 +220,17 @@ public function getCreditcardYear();
*/
public function setCreditcardYear($creditcardYear);

/**
* @return int|null
*/
public function getUniqueId();

/**
* @param int $uniqueId
* @return $this
*/
public function setUniqueId($uniqueId);

/**
* @return int|null
*/
Expand Down
9 changes: 8 additions & 1 deletion tests/Service/Transaction/TransactionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ public function testGetFormData()
TransactionInterface::CREDITCARD_MONTH => '04',
TransactionInterface::CREDITCARD_YEAR => '2019',
TransactionInterface::BILLING_ADDRESS => '123',
TransactionInterface::UNIQUE_ID => '123456789',
TransactionInterface::REF_PAYMENT_PROFILE_ID => '414',
TransactionInterface::REF_TRANSACTION_ID => '2323',
TransactionInterface::REF_GATEWAY_ID => '525',
Expand Down Expand Up @@ -178,6 +179,7 @@ public function testGetFormData()
TransactionInterface::EMAIL => '[email protected]',
TransactionInterface::ORDER_ID => '123',
TransactionInterface::IP => '0.0.0.0',
TransactionInterface::UNIQUE_ID => '123456789'
];

$this->transaction->importData($data);
Expand All @@ -198,6 +200,7 @@ public function testGetVerifyFormData()
TransactionInterface::CREDITCARD_MONTH => '04',
TransactionInterface::CREDITCARD_YEAR => '2019',
TransactionInterface::BILLING_ADDRESS => '123',
TransactionInterface::UNIQUE_ID => '987654321',
TransactionInterface::REF_PAYMENT_PROFILE_ID => '414',
TransactionInterface::REF_TRANSACTION_ID => '2323',
TransactionInterface::REF_GATEWAY_ID => '525',
Expand Down Expand Up @@ -225,7 +228,7 @@ public function testGetVerifyFormData()
TransactionInterface::CURRENCY_CODE => 'currency code',
TransactionInterface::EMAIL => '[email protected]',
TransactionInterface::ORDER_ID => '123',
TransactionInterface::IP => '0.0.0.0',
TransactionInterface::IP => '0.0.0.0'
];

$this->transaction->importData($data);
Expand All @@ -246,6 +249,7 @@ public function testGetServiceFormData()
TransactionInterface::CREDITCARD_MONTH => '04',
TransactionInterface::CREDITCARD_YEAR => '2019',
TransactionInterface::BILLING_ADDRESS => '123',
TransactionInterface::UNIQUE_ID => '918273645',
TransactionInterface::REF_PAYMENT_PROFILE_ID => '414',
TransactionInterface::REF_TRANSACTION_ID => '2323',
TransactionInterface::REF_GATEWAY_ID => '525',
Expand Down Expand Up @@ -297,6 +301,7 @@ public function testGetTokenFormData($address, $expectedData)
TransactionInterface::CREDITCARD_MONTH => '04',
TransactionInterface::CREDITCARD_YEAR => '2019',
TransactionInterface::BILLING_ADDRESS => '123',
TransactionInterface::UNIQUE_ID => '129834765',
TransactionInterface::REF_PAYMENT_PROFILE_ID => '414',
TransactionInterface::REF_TRANSACTION_ID => '2323',
TransactionInterface::REF_GATEWAY_ID => '525',
Expand Down Expand Up @@ -338,6 +343,7 @@ public function getTokenFormDataTest()
TransactionInterface::IP => '0.0.0.0',
TransactionInterface::CREDITCARD_MONTH => '04',
TransactionInterface::CREDITCARD_YEAR => '2019',
TransactionInterface::UNIQUE_ID => '129834765'
]
],
'With address' => [
Expand All @@ -364,6 +370,7 @@ public function getTokenFormDataTest()
TransactionInterface::IP => '0.0.0.0',
TransactionInterface::CREDITCARD_MONTH => '04',
TransactionInterface::CREDITCARD_YEAR => '2019',
TransactionInterface::UNIQUE_ID => '129834765',
TransactionInterface::BILLING_ADDRESS => [
AddressInterface::CITY => 'city',
AddressInterface::COUNTRY => 'country',
Expand Down

0 comments on commit 0749522

Please sign in to comment.