Skip to content

Commit

Permalink
Merge pull request #6 from m1r0/master
Browse files Browse the repository at this point in the history
Add purchase step option
  • Loading branch information
Agbonghama Collins committed Apr 22, 2016
2 parents b7bfe6c + d429786 commit cc34f28
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,30 @@ public function setLanguage($value)
return $this->setParameter('language', $value);
}

/**
* Getter: purchase step.
*
* @param $value
*
* @return $this
*/
public function getPurchaseStep()
{
return $this->getParameter('purchaseStep');
}

/**
* Setter: purchase step.
*
* @param $value
*
* @return $this
*/
public function setPurchaseStep($value)
{
return $this->setParameter('purchaseStep', $value);
}

/**
* Getter: coupon.
*
Expand Down
10 changes: 10 additions & 0 deletions src/Message/AbstractRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ public function setLanguage($value)
return $this->setParameter('language', $value);
}

public function getPurchaseStep()
{
return $this->getParameter('purchaseStep');
}

public function setPurchaseStep($value)
{
return $this->setParameter('purchaseStep', $value);
}

public function getCoupon()
{
return $this->getParameter('coupon');
Expand Down
4 changes: 4 additions & 0 deletions src/Message/PurchaseRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ public function getData()
$data['lang'] = $this->getLanguage();
}

if ($this->getPurchaseStep()) {
$data['purchase_step'] = $this->getPurchaseStep();
}

if ($this->getCoupon()) {
$data['coupon'] = $this->getCoupon();
}
Expand Down
2 changes: 2 additions & 0 deletions tests/GatewayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function setUp()
$this->gateway->setTestMode(true);
$this->gateway->setDemoMode(true);
$this->gateway->setLanguage('fr');
$this->gateway->setPurchaseStep('payment-method');
$this->gateway->setCoupon('BlackFriday');
$this->gateway->setCart(array(
array(
Expand Down Expand Up @@ -57,6 +58,7 @@ public function testGateway()
$cart = $this->gateway->getCart();
$this->assertSame('901290261', $this->gateway->getAccountNumber());
$this->assertSame('MzBjODg5YTUtNzcwMS00N2NlLWFkODMtNzQ2YzllZWRjMzBj', $this->gateway->getSecretWord());
$this->assertSame('payment-method', $this->gateway->getPurchaseStep());
$this->assertSame('BlackFriday', $this->gateway->getCoupon());
$this->assertSame('fr', $this->gateway->getLanguage());
$this->assertTrue($this->gateway->getTestMode());
Expand Down

0 comments on commit cc34f28

Please sign in to comment.