Skip to content

Commit

Permalink
Merge branch 'master' of github.com:paymill/paymill-php
Browse files Browse the repository at this point in the history
  • Loading branch information
l0ck3 committed Jun 4, 2015
2 parents 1c084ce + 51800d6 commit e006a44
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 9 deletions.
32 changes: 32 additions & 0 deletions lib/Paymill/Models/Request/Subscription.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ class Subscription extends Base
*/
private $_remove;

/**
* @var string
*/
private $_mandateReference;

/**
* Creates an instance of the subscription request model
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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())) {
Expand Down Expand Up @@ -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;
Expand Down
28 changes: 28 additions & 0 deletions lib/Paymill/Models/Request/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ class Transaction extends Base
*/
private $_source;

/**
* @var string
*/
private $_mandateReference;

/**
* Creates an instance of the transaction request model
*/
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down
21 changes: 21 additions & 0 deletions lib/Paymill/Models/Response/Subscription.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

}
21 changes: 21 additions & 0 deletions lib/Paymill/Models/Response/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ public function setAmount($amount)
*/
private $_originAmount;

/**
* @var string
*/
private $_mandateReference;

/**
* Returns the origin amount for the transaction.
* @return integer
Expand Down Expand Up @@ -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;
}
}
15 changes: 11 additions & 4 deletions tests/unit/Paymill/Models/Request/SubscriptionTest.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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(
Expand All @@ -82,7 +88,8 @@ public function parameterizeTest($subscription)
));
$this->assertEquals($updateArray, array(
'offer' => 'offer_40237e20a7d5a231d99b',
'payment' => 'pay_95ba26ba2c613ebb0ca8'
'payment' => 'pay_95ba26ba2c613ebb0ca8',
'mandate_reference' => 'DE1234TEST'
));
}

Expand Down
10 changes: 7 additions & 3 deletions tests/unit/Paymill/Models/Request/TransactionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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']);



Expand All @@ -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;
Expand Down Expand Up @@ -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'
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/Paymill/Models/Response/SubscriptionTest.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
Expand All @@ -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);
}

}
5 changes: 4 additions & 1 deletion tests/unit/Paymill/Models/Response/TransactionTest.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
Expand All @@ -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);
}

}

0 comments on commit e006a44

Please sign in to comment.