-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from vimeo/PYMT-1355
Add support for ECP payment methods
- Loading branch information
Showing
8 changed files
with
241 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<?php | ||
|
||
use Omnipay\Common\Helper; | ||
use Symfony\Component\HttpFoundation\ParameterBag; | ||
|
||
class EcpAccount | ||
{ | ||
/** | ||
* Internal storage of all of the account parameters. | ||
* | ||
* @var \Symfony\Component\HttpFoundation\ParameterBag | ||
*/ | ||
protected $parameters; | ||
|
||
public function __construct($parameters = null) | ||
{ | ||
$this->initialize($parameters); | ||
} | ||
|
||
/** | ||
* Initialize the object with parameters. | ||
* If any unknown parameters passed, they will be ignored. | ||
*/ | ||
public function initialize(array $parameters = null): self | ||
{ | ||
$this->parameters = new ParameterBag; | ||
|
||
Helper::initialize($this, $parameters); | ||
|
||
return $this; | ||
} | ||
|
||
public function getParameters(): array | ||
{ | ||
return $this->parameters->all(); | ||
} | ||
|
||
protected function getParameter($key): mixed | ||
{ | ||
return $this->parameters->get($key); | ||
} | ||
|
||
protected function setParameter($key, $value): self | ||
{ | ||
$this->parameters->set($key, $value); | ||
|
||
return $this; | ||
} | ||
|
||
public function getMaskedAccountNumber(): self | ||
{ | ||
return $this->getParameter('maskedAccountNumber'); | ||
} | ||
|
||
public function setMaskedAccountNumber(string $value): self | ||
{ | ||
return $this->setParameter('maskedAccountNumber', $value); | ||
} | ||
|
||
public function getRoutingNumber(): self | ||
{ | ||
return $this->getParameter('routingNumber'); | ||
} | ||
|
||
public function setRoutingNumber(string $value): self | ||
{ | ||
return $this->setParameter('routingNumber', $value); | ||
} | ||
|
||
public function getAccountType(): self | ||
{ | ||
return $this->getParameter('accountType'); | ||
} | ||
|
||
public function setAccountType(string $value): self | ||
{ | ||
return $this->setParameter('accountType', $value); | ||
} | ||
|
||
public function getBillingPostcode(): self | ||
{ | ||
return $this->getParameter('billingPostcode'); | ||
} | ||
|
||
public function setBillingPostcode(string $value): self | ||
{ | ||
return $this->setParameter('billingPostcode', $value); | ||
} | ||
|
||
public function getBillingCountry(): self | ||
{ | ||
return $this->getParameter('billingCountry'); | ||
} | ||
|
||
public function setBillingCountry(string $value): self | ||
{ | ||
return $this->setParameter('billingCountry', $value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace Omnipay\Vindicia; | ||
|
||
use EcpAccount; | ||
use Omnipay\Tests\TestCase; | ||
use Omnipay\Vindicia\TestFramework\DataFaker; | ||
|
||
class EcpAccountTest extends TestCase | ||
{ | ||
public function setUp(): void | ||
{ | ||
$this->ecp = new EcpAccount(); | ||
$this->faker = new DataFaker(); | ||
} | ||
|
||
public function testMaskedAccountNumber(): void | ||
{ | ||
$value = 'XXXXX1234'; | ||
$this->assertSame($this->ecp, $this->ecp->setMaskedAccountNumber($value)); | ||
$this->assertSame($value, $this->ecp->getMaskedAccountNumber()); | ||
} | ||
|
||
public function testRoutingNumber(): void | ||
{ | ||
$value = '123456789'; | ||
$this->assertSame($this->ecp, $this->ecp->setRoutingNumber($value)); | ||
$this->assertSame($value, $this->ecp->getRoutingNumber()); | ||
} | ||
|
||
public function testAccountType(): void | ||
{ | ||
$value = 'ConsumerChecking'; | ||
$this->assertSame($this->ecp, $this->ecp->setAccountType($value)); | ||
$this->assertSame($value, $this->ecp->getAccountType()); | ||
} | ||
|
||
public function testPostalCode(): void | ||
{ | ||
$value = $this->faker->postcode(); | ||
$this->assertSame($this->ecp, $this->ecp->setBillingPostcode($value)); | ||
$this->assertSame($value, $this->ecp->getBillingPostcode()); | ||
} | ||
|
||
public function testCountry(): void | ||
{ | ||
$value = $this->faker->region(); | ||
$this->assertSame($this->ecp, $this->ecp->setBillingCountry($value)); | ||
$this->assertSame($value, $this->ecp->getBillingCountry()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters