setStartYear() public method

Sets the card start year.
public setStartYear ( string $value ) : CreditCard
$value string
return CreditCard provides a fluent interface.
 public function setUp()
 {
     $this->gateway = new \Omnipay\PaymentWall\Gateway();
     $gateway = $this->gateway;
     $this->card = new CreditCard($this->getValidCard());
     $this->card->setStartMonth(1);
     $this->card->setStartYear(2000);
     $this->request = new PurchaseRequest($this->getHttpClient(), $this->getHttpRequest());
     $this->request->initialize(array('apiType' => $gateway::API_GOODS, 'publicKey' => 'asdfasdf', 'privateKey' => 'asdfasdf', 'amount' => '10.00', 'currency' => 'AUD', 'clientIp' => '127.0.0.1', 'browserDomain' => 'PairMeUp', 'accountId' => 12341234, 'packageId' => 1234, 'packageName' => 'Super Deluxe Excellent Discount Package', 'description' => 'Super Deluxe Excellent Discount Package', 'email' => '*****@*****.**', 'card' => $this->card));
 }
 public function setUp()
 {
     $this->gateway = new \Omnipay\PaymentWall\Gateway();
     $gateway = $this->gateway;
     $this->card = new CreditCard($this->getValidCard());
     $this->card->setStartMonth(1);
     $this->card->setStartYear(2000);
     $this->request = new VoidRequest($this->getHttpClient(), $this->getHttpRequest());
     $this->request->initialize(array('transactionReference' => 'ASDF1234', 'publicKey' => 'asdfasdf', 'privateKey' => 'asdfasdf', 'clientIp' => '127.0.0.1', 'browserDomain' => 'PairMeUp'));
     // Sample response data for testing
     $data = array('success' => true, 'id' => 1234, 'card' => array('token' => 'qwerty12341234'), 'error' => 'The quick brown fox', 'code' => 200);
     $this->response = new Response($this->request, $data, 200);
 }
 public function testGetDataWithCard()
 {
     $card = new CreditCard($this->getValidCard());
     $card->setStartMonth(1);
     $card->setStartYear(2000);
     $this->request->setCard($card);
     $this->request->setTransactionId('abc123');
     $this->request->setDescription('Sheep');
     $this->request->setClientIp('127.0.0.1');
     $data = $this->request->getData();
     $this->assertSame('authorize', $data['intent']);
     $this->assertSame('credit_card', $data['payer']['payment_method']);
     $this->assertSame('10.00', $data['transactions'][0]['amount']['total']);
     $this->assertSame('USD', $data['transactions'][0]['amount']['currency']);
     $this->assertSame('abc123 : Sheep', $data['transactions'][0]['description']);
     $this->assertSame($card->getNumber(), $data['payer']['funding_instruments'][0]['credit_card']['number']);
     $this->assertSame($card->getBrand(), $data['payer']['funding_instruments'][0]['credit_card']['type']);
     $this->assertSame($card->getExpiryMonth(), $data['payer']['funding_instruments'][0]['credit_card']['expire_month']);
     $this->assertSame($card->getExpiryYear(), $data['payer']['funding_instruments'][0]['credit_card']['expire_year']);
     $this->assertSame($card->getCvv(), $data['payer']['funding_instruments'][0]['credit_card']['cvv2']);
     $this->assertSame($card->getFirstName(), $data['payer']['funding_instruments'][0]['credit_card']['first_name']);
     $this->assertSame($card->getLastName(), $data['payer']['funding_instruments'][0]['credit_card']['last_name']);
     $this->assertSame($card->getAddress1(), $data['payer']['funding_instruments'][0]['credit_card']['billing_address']['line1']);
     $this->assertSame($card->getAddress2(), $data['payer']['funding_instruments'][0]['credit_card']['billing_address']['line2']);
     $this->assertSame($card->getCity(), $data['payer']['funding_instruments'][0]['credit_card']['billing_address']['city']);
     $this->assertSame($card->getState(), $data['payer']['funding_instruments'][0]['credit_card']['billing_address']['state']);
     $this->assertSame($card->getPostcode(), $data['payer']['funding_instruments'][0]['credit_card']['billing_address']['postal_code']);
     $this->assertSame($card->getCountry(), $data['payer']['funding_instruments'][0]['credit_card']['billing_address']['country_code']);
 }
 public function testGetData()
 {
     $card = new CreditCard($this->getValidCard());
     $card->setStartMonth(1);
     $card->setStartYear(2000);
     $this->request->setCard($card);
     $this->request->setTransactionId('abc123');
     $this->request->setDescription('Sheep');
     $this->request->setClientIp('127.0.0.1');
     $data = $this->request->getData();
     $this->assertSame('DoDirectPayment', $data['METHOD']);
     $this->assertSame('Authorization', $data['PAYMENTACTION']);
     $this->assertSame('10.00', $data['AMT']);
     $this->assertSame('USD', $data['CURRENCYCODE']);
     $this->assertSame('abc123', $data['INVNUM']);
     $this->assertSame('Sheep', $data['DESC']);
     $this->assertSame('127.0.0.1', $data['IPADDRESS']);
     $this->assertSame($card->getNumber(), $data['ACCT']);
     $this->assertSame($card->getBrand(), $data['CREDITCARDTYPE']);
     $this->assertSame($card->getExpiryDate('mY'), $data['EXPDATE']);
     $this->assertSame('012000', $data['STARTDATE']);
     $this->assertSame($card->getCvv(), $data['CVV2']);
     $this->assertSame($card->getIssueNumber(), $data['ISSUENUMBER']);
     $this->assertSame($card->getFirstName(), $data['FIRSTNAME']);
     $this->assertSame($card->getLastName(), $data['LASTNAME']);
     $this->assertSame($card->getEmail(), $data['EMAIL']);
     $this->assertSame($card->getAddress1(), $data['STREET']);
     $this->assertSame($card->getAddress2(), $data['STREET2']);
     $this->assertSame($card->getCity(), $data['CITY']);
     $this->assertSame($card->getState(), $data['STATE']);
     $this->assertSame($card->getPostcode(), $data['ZIP']);
     $this->assertSame($card->getCountry(), $data['COUNTRYCODE']);
 }
 public function testStoreCard()
 {
     $card = new CreditCard($this->getValidCard());
     $card->setStartMonth(1);
     $card->setStartYear(2000);
     $this->request = new CreateCardRequest($this->getHttpClient(), $this->getHttpRequest());
     $this->request->initialize(array('card' => $card));
     $data = $this->request->getData();
     $this->assertSame($card->getNumber(), $data['card_number']);
     $this->assertSame($card->getExpiryDate('m/Y'), $data['card_expiry']);
     $this->assertSame($card->getCvv(), $data['cvv']);
     $this->request = new PurchaseRequest($this->getHttpClient(), $this->getHttpRequest());
     $this->request->initialize(array('amount' => '10.00', 'transactionReference' => 'TestReference999', 'cardReference' => 'abc1234'));
     $this->request->setTransactionId('525-P-S2Y05UQ9');
     $this->request->setClientIp('127.0.0.1');
     $data = $this->request->getData();
     $this->assertSame('10.00', $data['amount']);
     $this->assertSame('abc1234', $data['card_token']);
 }
Example #6
0
 public function testStartDate()
 {
     $this->card->setStartMonth('11');
     $this->card->setStartYear('2012');
     $this->assertEquals('112012', $this->card->getStartDate('mY'));
 }