From 9d1e788a698ddaf09042b996c0a65a72e58081bf Mon Sep 17 00:00:00 2001 From: "enrico.hofmann" Date: Tue, 20 Jan 2015 13:34:31 +0100 Subject: [PATCH 1/5] Add Mandate Reference to Subscription --- lib/Paymill/Models/Request/Subscription.php | 30 ++++++++++++++++++++ lib/Paymill/Models/Response/Subscription.php | 21 ++++++++++++++ 2 files changed, 51 insertions(+) mode change 100644 => 100755 lib/Paymill/Models/Request/Subscription.php mode change 100644 => 100755 lib/Paymill/Models/Response/Subscription.php diff --git a/lib/Paymill/Models/Request/Subscription.php b/lib/Paymill/Models/Request/Subscription.php old mode 100644 new mode 100755 index d2699fd..0488025 --- a/lib/Paymill/Models/Request/Subscription.php +++ b/lib/Paymill/Models/Request/Subscription.php @@ -87,6 +87,10 @@ class Subscription extends Base */ private $_remove; + /** + * @var string + */ + private $_mandateReference; /** * Creates an instance of the subscription request model @@ -399,6 +403,26 @@ public function setRemove($remove) return $this; } + /** + * Returns mandate reference + * @return string + */ + public function getMandateReference() + { + return $this->_mandateReference; + } + + /** + * Set mandate reference + * @param string $mandateReference + */ + public function setMandateReference($mandateReference) + { + $this->_mandateReference = $mandateReference; + } + + + /** * Returns an array of parameters customized for the argumented methodname * @param string $method @@ -438,6 +462,9 @@ public function parameterize($method) if (!is_null($this->getStartAt())) { $parameterArray['start_at'] = $this->getStartAt(); } + if (!is_null($this->getMandateReference())) { + $parameterArray['mandate_reference'] = $this->getMandateReference(); + } break; case 'update': if (!is_null($this->getOffer())) { @@ -475,6 +502,9 @@ public function parameterize($method) if (!is_null($this->getOfferChangeType())) { $parameterArray['offer_change_type'] = $this->getOfferChangeType(); } + if (!is_null($this->getMandateReference())) { + $parameterArray['mandate_reference'] = $this->getMandateReference(); + } break; case 'getOne': $parameterArray['count'] = 1; diff --git a/lib/Paymill/Models/Response/Subscription.php b/lib/Paymill/Models/Response/Subscription.php old mode 100644 new mode 100755 index 17f23c1..ddd38ce --- a/lib/Paymill/Models/Response/Subscription.php +++ b/lib/Paymill/Models/Response/Subscription.php @@ -96,6 +96,11 @@ class Subscription extends Base */ private $_tempAmount; + /** + * @var string + */ + private $_mandateReference; + /** * Returns the model of the offer the subscription is based on * @return \Paymill\Models\Response\Offer @@ -442,5 +447,21 @@ public function getTempAmount() return $this->_tempAmount; } + /** Set mandate reference mandate_reference + * @param string $mandateReference + */ + public function setMandateReference($mandateReference) + { + $this->_mandateReference = $mandateReference; + } + + /** + * Return mandate reference mandate_reference + * @return string + */ + public function getMandateReference() + { + return $this->_mandateReference; + } } From 2178802d4610c58d21237b0feee195380ab1e2d0 Mon Sep 17 00:00:00 2001 From: "enrico.hofmann" Date: Tue, 20 Jan 2015 13:34:31 +0100 Subject: [PATCH 2/5] Add Mandate Reference to Subscription --- lib/Paymill/Models/Request/Subscription.php | 32 ++++++++++++++++++++ lib/Paymill/Models/Response/Subscription.php | 21 +++++++++++++ 2 files changed, 53 insertions(+) mode change 100644 => 100755 lib/Paymill/Models/Request/Subscription.php mode change 100644 => 100755 lib/Paymill/Models/Response/Subscription.php diff --git a/lib/Paymill/Models/Request/Subscription.php b/lib/Paymill/Models/Request/Subscription.php old mode 100644 new mode 100755 index d2699fd..cdcccb1 --- a/lib/Paymill/Models/Request/Subscription.php +++ b/lib/Paymill/Models/Request/Subscription.php @@ -87,6 +87,10 @@ class Subscription extends Base */ private $_remove; + /** + * @var string + */ + private $_mandateReference; /** * Creates an instance of the subscription request model @@ -399,6 +403,28 @@ public function setRemove($remove) return $this; } + /** + * Returns mandate reference + * @return string + */ + public function getMandateReference() + { + return $this->_mandateReference; + } + + /** + * Set mandate reference + * @param string $mandateReference + * @return \Paymill\Models\Request\Subscription + */ + public function setMandateReference($mandateReference) + { + $this->_mandateReference = $mandateReference; + return $this; + } + + + /** * Returns an array of parameters customized for the argumented methodname * @param string $method @@ -438,6 +464,9 @@ public function parameterize($method) if (!is_null($this->getStartAt())) { $parameterArray['start_at'] = $this->getStartAt(); } + if (!is_null($this->getMandateReference())) { + $parameterArray['mandate_reference'] = $this->getMandateReference(); + } break; case 'update': if (!is_null($this->getOffer())) { @@ -475,6 +504,9 @@ public function parameterize($method) if (!is_null($this->getOfferChangeType())) { $parameterArray['offer_change_type'] = $this->getOfferChangeType(); } + if (!is_null($this->getMandateReference())) { + $parameterArray['mandate_reference'] = $this->getMandateReference(); + } break; case 'getOne': $parameterArray['count'] = 1; diff --git a/lib/Paymill/Models/Response/Subscription.php b/lib/Paymill/Models/Response/Subscription.php old mode 100644 new mode 100755 index 17f23c1..ddd38ce --- a/lib/Paymill/Models/Response/Subscription.php +++ b/lib/Paymill/Models/Response/Subscription.php @@ -96,6 +96,11 @@ class Subscription extends Base */ private $_tempAmount; + /** + * @var string + */ + private $_mandateReference; + /** * Returns the model of the offer the subscription is based on * @return \Paymill\Models\Response\Offer @@ -442,5 +447,21 @@ public function getTempAmount() return $this->_tempAmount; } + /** Set mandate reference mandate_reference + * @param string $mandateReference + */ + public function setMandateReference($mandateReference) + { + $this->_mandateReference = $mandateReference; + } + + /** + * Return mandate reference mandate_reference + * @return string + */ + public function getMandateReference() + { + return $this->_mandateReference; + } } From acb8d6889fb30ef317be8ee83f168119590d3372 Mon Sep 17 00:00:00 2001 From: "enrico.hofmann" Date: Tue, 20 Jan 2015 15:35:15 +0100 Subject: [PATCH 3/5] Add Mandate Reference to Transaction --- lib/Paymill/Models/Request/Transaction.php | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/lib/Paymill/Models/Request/Transaction.php b/lib/Paymill/Models/Request/Transaction.php index 37b191f..b99e3c4 100755 --- a/lib/Paymill/Models/Request/Transaction.php +++ b/lib/Paymill/Models/Request/Transaction.php @@ -67,6 +67,11 @@ class Transaction extends Base */ private $_source; + /** + * @var string + */ + private $_mandateReference; + /** * Creates an instance of the transaction request model */ @@ -301,6 +306,26 @@ public function getSource() return $this->_source; } + /** + * Returns mandate reference + * @return string + */ + public function getMandateReference() + { + return $this->_mandateReference; + } + + /** + * Set mandate reference + * @param string $mandateReference + * @return \Paymill\Models\Request\Subscription + */ + public function setMandateReference($mandateReference) + { + $this->_mandateReference = $mandateReference; + return $this; + } + /** * Returns an array of parameters customized for the argumented methodname * @param string $method @@ -334,6 +359,9 @@ public function parameterize($method) if(!is_null($this->getSource())) { $parameterArray['source'] = $this->getSource(); } + if (!is_null($this->getMandateReference())) { + $parameterArray['mandate_reference'] = $this->getMandateReference(); + } break; case 'update': $parameterArray['description'] = $this->getDescription(); From 56605ee8bcca4636d14bbdb0d4b1a163c94cd1af Mon Sep 17 00:00:00 2001 From: "enrico.hofmann" Date: Sat, 14 Mar 2015 21:58:04 +0100 Subject: [PATCH 4/5] Add mandate_reference to response object of the transaction object --- lib/Paymill/Models/Response/Transaction.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/Paymill/Models/Response/Transaction.php b/lib/Paymill/Models/Response/Transaction.php index 7f0861c..c790a2c 100755 --- a/lib/Paymill/Models/Response/Transaction.php +++ b/lib/Paymill/Models/Response/Transaction.php @@ -46,6 +46,11 @@ public function setAmount($amount) */ private $_originAmount; + /** + * @var string + */ + private $_mandateReference; + /** * Returns the origin amount for the transaction. * @return integer @@ -397,4 +402,20 @@ public function getSource() return $this->_source; } + /** Set mandate reference mandate_reference + * @param string $mandateReference + */ + public function setMandateReference($mandateReference) + { + $this->_mandateReference = $mandateReference; + } + + /** + * Return mandate reference mandate_reference + * @return string + */ + public function getMandateReference() + { + return $this->_mandateReference; + } } \ No newline at end of file From 01a546455a18754eb8fac4a2ec5e5888fb5fc5b4 Mon Sep 17 00:00:00 2001 From: "enrico.hofmann" Date: Sat, 14 Mar 2015 22:28:29 +0100 Subject: [PATCH 5/5] Add Unit Tests --- .../Paymill/Models/Request/SubscriptionTest.php | 15 +++++++++++---- .../Paymill/Models/Request/TransactionTest.php | 10 +++++++--- .../Paymill/Models/Response/SubscriptionTest.php | 5 ++++- .../Paymill/Models/Response/TransactionTest.php | 5 ++++- 4 files changed, 26 insertions(+), 9 deletions(-) mode change 100644 => 100755 tests/unit/Paymill/Models/Request/SubscriptionTest.php mode change 100644 => 100755 tests/unit/Paymill/Models/Response/SubscriptionTest.php mode change 100644 => 100755 tests/unit/Paymill/Models/Response/TransactionTest.php diff --git a/tests/unit/Paymill/Models/Request/SubscriptionTest.php b/tests/unit/Paymill/Models/Request/SubscriptionTest.php old mode 100644 new mode 100755 index d8e84b5..3f3b0cf --- a/tests/unit/Paymill/Models/Request/SubscriptionTest.php +++ b/tests/unit/Paymill/Models/Request/SubscriptionTest.php @@ -44,14 +44,19 @@ public function setGetTest() $sample = array( 'client' => 'client_88a388d9dd48f86c3136', 'offer' => 'offer_40237e20a7d5a231d99b', - 'payment' => 'pay_95ba26ba2c613ebb0ca8' + 'payment' => 'pay_95ba26ba2c613ebb0ca8', + 'mandate_reference' => 'DE1234TEST', ); - $this->_subscription->setPayment($sample['payment'])->setOffer($sample['offer'])->setClient($sample['client']); + $this->_subscription->setPayment($sample['payment']) + ->setOffer($sample['offer']) + ->setClient($sample['client']) + ->setMandateReference($sample['mandate_reference']); $this->assertEquals($this->_subscription->getClient(), $sample['client']); $this->assertEquals($this->_subscription->getOffer(), $sample['offer']); $this->assertEquals($this->_subscription->getPayment(), $sample['payment']); + $this->assertEquals($this->_subscription->getMandateReference(), $sample['mandate_reference']); return $this->_subscription; } @@ -73,7 +78,8 @@ public function parameterizeTest($subscription) $this->assertEquals(array( 'client' => 'client_88a388d9dd48f86c3136', 'offer' => 'offer_40237e20a7d5a231d99b', - 'payment' => 'pay_95ba26ba2c613ebb0ca8' + 'payment' => 'pay_95ba26ba2c613ebb0ca8', + 'mandate_reference' => 'DE1234TEST' ), $creationArray); $this->assertEquals($getOneArray, array( @@ -82,7 +88,8 @@ public function parameterizeTest($subscription) )); $this->assertEquals($updateArray, array( 'offer' => 'offer_40237e20a7d5a231d99b', - 'payment' => 'pay_95ba26ba2c613ebb0ca8' + 'payment' => 'pay_95ba26ba2c613ebb0ca8', + 'mandate_reference' => 'DE1234TEST' )); } diff --git a/tests/unit/Paymill/Models/Request/TransactionTest.php b/tests/unit/Paymill/Models/Request/TransactionTest.php index a3c9d5a..aa1209a 100755 --- a/tests/unit/Paymill/Models/Request/TransactionTest.php +++ b/tests/unit/Paymill/Models/Request/TransactionTest.php @@ -52,7 +52,8 @@ public function setGetTest() 'fee_payment' => 'pay_098f6bcd4621d373cade4e832627b4f6', 'fee_currency' => 'EUR', 'description' => 'Test Transaction', - 'source' => 'merchantcenter' + 'source' => 'merchantcenter', + 'mandate_reference' =>'DE1234TEST' ); $this->_transaction @@ -66,7 +67,8 @@ public function setGetTest() ->setFeePayment($sample['fee_payment']) ->setFeeCurrency($sample['fee_currency']) ->setDescription($sample['description']) - ->setSource($sample['source']); + ->setSource($sample['source']) + ->setMandateReference($sample['mandate_reference']); @@ -81,6 +83,7 @@ public function setGetTest() $this->assertEquals($this->_transaction->getFeeCurrency(), $sample['fee_currency']); $this->assertEquals($this->_transaction->getDescription(), $sample['description']); $this->assertEquals($this->_transaction->getSource(), $sample['source']); + $this->assertEquals($this->_transaction->getMandateReference(), $sample['mandate_reference']); return $this->_transaction; @@ -109,7 +112,8 @@ public function parameterizeTest($transaction) 'fee_payment' => 'pay_098f6bcd4621d373cade4e832627b4f6', 'fee_currency' => 'EUR', 'description' => 'Test Transaction', - 'source' => 'merchantcenter' + 'source' => 'merchantcenter', + 'mandate_reference' => 'DE1234TEST' )); $this->assertEquals($updateArray, array( 'description' => 'Test Transaction' diff --git a/tests/unit/Paymill/Models/Response/SubscriptionTest.php b/tests/unit/Paymill/Models/Response/SubscriptionTest.php old mode 100644 new mode 100755 index 2288076..f16875e --- a/tests/unit/Paymill/Models/Response/SubscriptionTest.php +++ b/tests/unit/Paymill/Models/Response/SubscriptionTest.php @@ -51,6 +51,7 @@ public function setGetTest() $canceledAt = null; $payment = new Response\Payment(); $client = new Response\Client(); + $mandateReference = 'DE1234TEST'; $this->_subscription->setOffer($offer) ->setLivemode($liveMode) @@ -59,7 +60,8 @@ public function setGetTest() ->setNextCaptureAt($nextCaptureAt) ->setCanceledAt($canceledAt) ->setClient($client) - ->setPayment($payment); + ->setPayment($payment) + ->setMandateReference($mandateReference); $this->assertEquals($this->_subscription->getOffer(), $offer); $this->assertEquals($this->_subscription->getLivemode(), $liveMode); @@ -69,6 +71,7 @@ public function setGetTest() $this->assertEquals($this->_subscription->getCanceledAt(), $canceledAt); $this->assertEquals($this->_subscription->getClient(), $client); $this->assertEquals($this->_subscription->getPayment(), $payment); + $this->assertEquals($this->_subscription->getMandateReference(), $mandateReference); } } \ No newline at end of file diff --git a/tests/unit/Paymill/Models/Response/TransactionTest.php b/tests/unit/Paymill/Models/Response/TransactionTest.php old mode 100644 new mode 100755 index 9257003..bbdc89f --- a/tests/unit/Paymill/Models/Response/TransactionTest.php +++ b/tests/unit/Paymill/Models/Response/TransactionTest.php @@ -56,6 +56,7 @@ public function setGetTest() $client = new Response\Client(); $preAuth = new Response\Preauthorization(); $fees = array(); + $mandateReference = 'DE1234TEST'; $this->_transaction->setAmount($amount) ->setOriginAmount($originAmount) @@ -70,7 +71,8 @@ public function setGetTest() ->setPayment($payment) ->setClient($client) ->setPreauthorization($preAuth) - ->setFees($fees); + ->setFees($fees) + ->setMandateReference($mandateReference); $this->assertEquals($this->_transaction->getAmount(), $amount); $this->assertEquals($this->_transaction->getOriginAmount(), $originAmount); @@ -86,6 +88,7 @@ public function setGetTest() $this->assertEquals($this->_transaction->getClient(), $client); $this->assertEquals($this->_transaction->getPreauthorization(), $preAuth); $this->assertEquals($this->_transaction->getFees(), $fees); + $this->assertEquals($this->_transaction->getMandateReference(), $mandateReference); } } \ No newline at end of file