Skip to content

Commit e2addb1

Browse files
committed
Add credit card billingCountry
1 parent 3d086c7 commit e2addb1

File tree

2 files changed

+62
-19
lines changed

2 files changed

+62
-19
lines changed

src/Omnipay/Common/CreditCard.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,16 @@ public function setBillingLastName($value)
327327
return $this->setParameter('billingLastName', $value);
328328
}
329329

330+
public function getBillingCompany()
331+
{
332+
return $this->getParameter('billingCompany');
333+
}
334+
335+
public function setBillingCompany($value)
336+
{
337+
return $this->setParameter('billingCompany', $value);
338+
}
339+
330340
public function getBillingAddress1()
331341
{
332342
return $this->getParameter('billingAddress1');
@@ -604,12 +614,15 @@ public function setPhone($value)
604614

605615
public function getCompany()
606616
{
607-
return $this->getParameter('company');
617+
return $this->getParameter('billingCompany');
608618
}
609619

610620
public function setCompany($value)
611621
{
612-
return $this->setParameter('company', $value);
622+
$this->setParameter('billingCompany', $value);
623+
$this->setParameter('shippingCompany', $value);
624+
625+
return $this;
613626
}
614627

615628
public function getEmail()

tests/Omnipay/Common/CreditCardTest.php

Lines changed: 47 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,13 @@ public function testExpiryYearTwoDigits()
236236
$this->assertSame(2012, $this->card->getExpiryYear());
237237
}
238238

239+
public function testExpiryDate()
240+
{
241+
$this->assertSame($this->card, $this->card->setExpiryMonth('09'));
242+
$this->assertSame($this->card, $this->card->setExpiryYear('2012'));
243+
$this->assertSame('092012', $this->card->getExpiryDate('mY'));
244+
}
245+
239246
public function testStartMonth()
240247
{
241248
$this->card->setStartMonth(9);
@@ -279,6 +286,20 @@ public function testIssueNumber()
279286
$this->assertSame('12', $this->card->getIssueNumber());
280287
}
281288

289+
public function testBillingFirstName()
290+
{
291+
$this->card->setBillingFirstName('Bob');
292+
$this->assertEquals('Bob', $this->card->getBillingFirstName());
293+
$this->assertEquals('Bob', $this->card->getFirstName());
294+
}
295+
296+
public function testBillingLastName()
297+
{
298+
$this->card->setBillingLastName('Smith');
299+
$this->assertEquals('Smith', $this->card->getBillingLastName());
300+
$this->assertEquals('Smith', $this->card->getLastName());
301+
}
302+
282303
public function testBillingName()
283304
{
284305
$this->card->setBillingFirstName('Bob');
@@ -290,6 +311,13 @@ public function testBillingName()
290311
$this->assertEquals('Foo', $this->card->getBillingLastName());
291312
}
292313

314+
public function testBillingCompany()
315+
{
316+
$this->card->setBillingCompany('SuperSoft');
317+
$this->assertEquals('SuperSoft', $this->card->getBillingCompany());
318+
$this->assertEquals('SuperSoft', $this->card->getCompany());
319+
}
320+
293321
public function testBillingAddress1()
294322
{
295323
$this->card->setBillingAddress1('31 Spooner St');
@@ -339,17 +367,6 @@ public function testBillingPhone()
339367
$this->assertSame('12345', $this->card->getPhone());
340368
}
341369

342-
public function testShippingName()
343-
{
344-
$this->card->setShippingFirstName('Bob');
345-
$this->card->setShippingLastName('Smith');
346-
$this->assertEquals('Bob Smith', $this->card->getShippingName());
347-
348-
$this->card->setShippingName('John Foo');
349-
$this->assertEquals('John', $this->card->getShippingFirstName());
350-
$this->assertEquals('Foo', $this->card->getShippingLastName());
351-
}
352-
353370
public function testShippingFirstName()
354371
{
355372
$this->card->setShippingFirstName('James');
@@ -362,6 +379,17 @@ public function testShippingLastName()
362379
$this->assertEquals('Doctor', $this->card->getShippingLastName());
363380
}
364381

382+
public function testShippingName()
383+
{
384+
$this->card->setShippingFirstName('Bob');
385+
$this->card->setShippingLastName('Smith');
386+
$this->assertEquals('Bob Smith', $this->card->getShippingName());
387+
388+
$this->card->setShippingName('John Foo');
389+
$this->assertEquals('John', $this->card->getShippingFirstName());
390+
$this->assertEquals('Foo', $this->card->getShippingLastName());
391+
}
392+
365393
public function testShippingCompany()
366394
{
367395
$this->card->setShippingCompany('SuperSoft');
@@ -410,6 +438,14 @@ public function testShippingPhone()
410438
$this->assertEquals('12345', $this->card->getShippingPhone());
411439
}
412440

441+
public function testCompany()
442+
{
443+
$this->card->setCompany('FooBar');
444+
$this->assertEquals('FooBar', $this->card->getCompany());
445+
$this->assertEquals('FooBar', $this->card->getBillingCompany());
446+
$this->assertEquals('FooBar', $this->card->getShippingCompany());
447+
}
448+
413449
public function testAddress1()
414450
{
415451
$this->card->setAddress1('31 Spooner St');
@@ -466,12 +502,6 @@ public function testPhone()
466502
$this->assertEquals('12345', $this->card->getShippingPhone());
467503
}
468504

469-
public function testCompany()
470-
{
471-
$this->card->setCompany('FooBar');
472-
$this->assertEquals('FooBar', $this->card->getCompany());
473-
}
474-
475505
public function testEmail()
476506
{
477507
$this->card->setEmail('[email protected]');

0 commit comments

Comments
 (0)