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/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(); 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; + } } 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 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