Skip to content

Commit 51800d6

Browse files
committed
Merge pull request #96 from gigo1980/master
Add Sepa Conformity
2 parents 8668e8a + 01a5464 commit 51800d6

8 files changed

Lines changed: 128 additions & 9 deletions

File tree

lib/Paymill/Models/Request/Subscription.php

100644100755
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ class Subscription extends Base
8787
*/
8888
private $_remove;
8989

90+
/**
91+
* @var string
92+
*/
93+
private $_mandateReference;
9094

9195
/**
9296
* Creates an instance of the subscription request model
@@ -399,6 +403,28 @@ public function setRemove($remove)
399403
return $this;
400404
}
401405

406+
/**
407+
* Returns mandate reference
408+
* @return string
409+
*/
410+
public function getMandateReference()
411+
{
412+
return $this->_mandateReference;
413+
}
414+
415+
/**
416+
* Set mandate reference
417+
* @param string $mandateReference
418+
* @return \Paymill\Models\Request\Subscription
419+
*/
420+
public function setMandateReference($mandateReference)
421+
{
422+
$this->_mandateReference = $mandateReference;
423+
return $this;
424+
}
425+
426+
427+
402428
/**
403429
* Returns an array of parameters customized for the argumented methodname
404430
* @param string $method
@@ -438,6 +464,9 @@ public function parameterize($method)
438464
if (!is_null($this->getStartAt())) {
439465
$parameterArray['start_at'] = $this->getStartAt();
440466
}
467+
if (!is_null($this->getMandateReference())) {
468+
$parameterArray['mandate_reference'] = $this->getMandateReference();
469+
}
441470
break;
442471
case 'update':
443472
if (!is_null($this->getOffer())) {
@@ -475,6 +504,9 @@ public function parameterize($method)
475504
if (!is_null($this->getOfferChangeType())) {
476505
$parameterArray['offer_change_type'] = $this->getOfferChangeType();
477506
}
507+
if (!is_null($this->getMandateReference())) {
508+
$parameterArray['mandate_reference'] = $this->getMandateReference();
509+
}
478510
break;
479511
case 'getOne':
480512
$parameterArray['count'] = 1;

lib/Paymill/Models/Request/Transaction.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ class Transaction extends Base
6767
*/
6868
private $_source;
6969

70+
/**
71+
* @var string
72+
*/
73+
private $_mandateReference;
74+
7075
/**
7176
* Creates an instance of the transaction request model
7277
*/
@@ -301,6 +306,26 @@ public function getSource()
301306
return $this->_source;
302307
}
303308

309+
/**
310+
* Returns mandate reference
311+
* @return string
312+
*/
313+
public function getMandateReference()
314+
{
315+
return $this->_mandateReference;
316+
}
317+
318+
/**
319+
* Set mandate reference
320+
* @param string $mandateReference
321+
* @return \Paymill\Models\Request\Subscription
322+
*/
323+
public function setMandateReference($mandateReference)
324+
{
325+
$this->_mandateReference = $mandateReference;
326+
return $this;
327+
}
328+
304329
/**
305330
* Returns an array of parameters customized for the argumented methodname
306331
* @param string $method
@@ -334,6 +359,9 @@ public function parameterize($method)
334359
if(!is_null($this->getSource())) {
335360
$parameterArray['source'] = $this->getSource();
336361
}
362+
if (!is_null($this->getMandateReference())) {
363+
$parameterArray['mandate_reference'] = $this->getMandateReference();
364+
}
337365
break;
338366
case 'update':
339367
$parameterArray['description'] = $this->getDescription();

lib/Paymill/Models/Response/Subscription.php

100644100755
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ class Subscription extends Base
9696
*/
9797
private $_tempAmount;
9898

99+
/**
100+
* @var string
101+
*/
102+
private $_mandateReference;
103+
99104
/**
100105
* Returns the model of the offer the subscription is based on
101106
* @return \Paymill\Models\Response\Offer
@@ -442,5 +447,21 @@ public function getTempAmount()
442447
return $this->_tempAmount;
443448
}
444449

450+
/** Set mandate reference mandate_reference
451+
* @param string $mandateReference
452+
*/
453+
public function setMandateReference($mandateReference)
454+
{
455+
$this->_mandateReference = $mandateReference;
456+
}
457+
458+
/**
459+
* Return mandate reference mandate_reference
460+
* @return string
461+
*/
462+
public function getMandateReference()
463+
{
464+
return $this->_mandateReference;
465+
}
445466

446467
}

lib/Paymill/Models/Response/Transaction.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ public function setAmount($amount)
4646
*/
4747
private $_originAmount;
4848

49+
/**
50+
* @var string
51+
*/
52+
private $_mandateReference;
53+
4954
/**
5055
* Returns the origin amount for the transaction.
5156
* @return integer
@@ -397,4 +402,20 @@ public function getSource()
397402
return $this->_source;
398403
}
399404

405+
/** Set mandate reference mandate_reference
406+
* @param string $mandateReference
407+
*/
408+
public function setMandateReference($mandateReference)
409+
{
410+
$this->_mandateReference = $mandateReference;
411+
}
412+
413+
/**
414+
* Return mandate reference mandate_reference
415+
* @return string
416+
*/
417+
public function getMandateReference()
418+
{
419+
return $this->_mandateReference;
420+
}
400421
}

tests/unit/Paymill/Models/Request/SubscriptionTest.php

100644100755
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,19 @@ public function setGetTest()
4444
$sample = array(
4545
'client' => 'client_88a388d9dd48f86c3136',
4646
'offer' => 'offer_40237e20a7d5a231d99b',
47-
'payment' => 'pay_95ba26ba2c613ebb0ca8'
47+
'payment' => 'pay_95ba26ba2c613ebb0ca8',
48+
'mandate_reference' => 'DE1234TEST',
4849
);
4950

50-
$this->_subscription->setPayment($sample['payment'])->setOffer($sample['offer'])->setClient($sample['client']);
51+
$this->_subscription->setPayment($sample['payment'])
52+
->setOffer($sample['offer'])
53+
->setClient($sample['client'])
54+
->setMandateReference($sample['mandate_reference']);
5155

5256
$this->assertEquals($this->_subscription->getClient(), $sample['client']);
5357
$this->assertEquals($this->_subscription->getOffer(), $sample['offer']);
5458
$this->assertEquals($this->_subscription->getPayment(), $sample['payment']);
59+
$this->assertEquals($this->_subscription->getMandateReference(), $sample['mandate_reference']);
5560

5661
return $this->_subscription;
5762
}
@@ -73,7 +78,8 @@ public function parameterizeTest($subscription)
7378
$this->assertEquals(array(
7479
'client' => 'client_88a388d9dd48f86c3136',
7580
'offer' => 'offer_40237e20a7d5a231d99b',
76-
'payment' => 'pay_95ba26ba2c613ebb0ca8'
81+
'payment' => 'pay_95ba26ba2c613ebb0ca8',
82+
'mandate_reference' => 'DE1234TEST'
7783
), $creationArray);
7884

7985
$this->assertEquals($getOneArray, array(
@@ -82,7 +88,8 @@ public function parameterizeTest($subscription)
8288
));
8389
$this->assertEquals($updateArray, array(
8490
'offer' => 'offer_40237e20a7d5a231d99b',
85-
'payment' => 'pay_95ba26ba2c613ebb0ca8'
91+
'payment' => 'pay_95ba26ba2c613ebb0ca8',
92+
'mandate_reference' => 'DE1234TEST'
8693
));
8794
}
8895

tests/unit/Paymill/Models/Request/TransactionTest.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ public function setGetTest()
5252
'fee_payment' => 'pay_098f6bcd4621d373cade4e832627b4f6',
5353
'fee_currency' => 'EUR',
5454
'description' => 'Test Transaction',
55-
'source' => 'merchantcenter'
55+
'source' => 'merchantcenter',
56+
'mandate_reference' =>'DE1234TEST'
5657
);
5758

5859
$this->_transaction
@@ -66,7 +67,8 @@ public function setGetTest()
6667
->setFeePayment($sample['fee_payment'])
6768
->setFeeCurrency($sample['fee_currency'])
6869
->setDescription($sample['description'])
69-
->setSource($sample['source']);
70+
->setSource($sample['source'])
71+
->setMandateReference($sample['mandate_reference']);
7072

7173

7274

@@ -81,6 +83,7 @@ public function setGetTest()
8183
$this->assertEquals($this->_transaction->getFeeCurrency(), $sample['fee_currency']);
8284
$this->assertEquals($this->_transaction->getDescription(), $sample['description']);
8385
$this->assertEquals($this->_transaction->getSource(), $sample['source']);
86+
$this->assertEquals($this->_transaction->getMandateReference(), $sample['mandate_reference']);
8487

8588

8689
return $this->_transaction;
@@ -109,7 +112,8 @@ public function parameterizeTest($transaction)
109112
'fee_payment' => 'pay_098f6bcd4621d373cade4e832627b4f6',
110113
'fee_currency' => 'EUR',
111114
'description' => 'Test Transaction',
112-
'source' => 'merchantcenter'
115+
'source' => 'merchantcenter',
116+
'mandate_reference' => 'DE1234TEST'
113117
));
114118
$this->assertEquals($updateArray, array(
115119
'description' => 'Test Transaction'

tests/unit/Paymill/Models/Response/SubscriptionTest.php

100644100755
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public function setGetTest()
5151
$canceledAt = null;
5252
$payment = new Response\Payment();
5353
$client = new Response\Client();
54+
$mandateReference = 'DE1234TEST';
5455

5556
$this->_subscription->setOffer($offer)
5657
->setLivemode($liveMode)
@@ -59,7 +60,8 @@ public function setGetTest()
5960
->setNextCaptureAt($nextCaptureAt)
6061
->setCanceledAt($canceledAt)
6162
->setClient($client)
62-
->setPayment($payment);
63+
->setPayment($payment)
64+
->setMandateReference($mandateReference);
6365

6466
$this->assertEquals($this->_subscription->getOffer(), $offer);
6567
$this->assertEquals($this->_subscription->getLivemode(), $liveMode);
@@ -69,6 +71,7 @@ public function setGetTest()
6971
$this->assertEquals($this->_subscription->getCanceledAt(), $canceledAt);
7072
$this->assertEquals($this->_subscription->getClient(), $client);
7173
$this->assertEquals($this->_subscription->getPayment(), $payment);
74+
$this->assertEquals($this->_subscription->getMandateReference(), $mandateReference);
7275
}
7376

7477
}

tests/unit/Paymill/Models/Response/TransactionTest.php

100644100755
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public function setGetTest()
5656
$client = new Response\Client();
5757
$preAuth = new Response\Preauthorization();
5858
$fees = array();
59+
$mandateReference = 'DE1234TEST';
5960

6061
$this->_transaction->setAmount($amount)
6162
->setOriginAmount($originAmount)
@@ -70,7 +71,8 @@ public function setGetTest()
7071
->setPayment($payment)
7172
->setClient($client)
7273
->setPreauthorization($preAuth)
73-
->setFees($fees);
74+
->setFees($fees)
75+
->setMandateReference($mandateReference);
7476

7577
$this->assertEquals($this->_transaction->getAmount(), $amount);
7678
$this->assertEquals($this->_transaction->getOriginAmount(), $originAmount);
@@ -86,6 +88,7 @@ public function setGetTest()
8688
$this->assertEquals($this->_transaction->getClient(), $client);
8789
$this->assertEquals($this->_transaction->getPreauthorization(), $preAuth);
8890
$this->assertEquals($this->_transaction->getFees(), $fees);
91+
$this->assertEquals($this->_transaction->getMandateReference(), $mandateReference);
8992
}
9093

9194
}

0 commit comments

Comments
 (0)