Skip to content

Commit

Permalink
remove getting postcode and country directly from payment method
Browse files Browse the repository at this point in the history
  • Loading branch information
rondogency committed Jul 24, 2018
1 parent 2ba17d1 commit 0ca171f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 67 deletions.
2 changes: 0 additions & 2 deletions src/ObjectHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,6 @@ public function buildPaymentMethod(stdClass $object, stdClass $salesTaxAddress =
'paymentMethodId' => isset($object->merchantPaymentMethodId) ? $object->merchantPaymentMethodId : null,
'paymentMethodReference' => isset($object->VID) ? $object->VID : null,
'type' => isset($object->type) ? $object->type : null,
'postcode' => isset($object->billingAddress->postalCode) ? $object->billingAddress->postalCode : null,
'country' => isset($object->billingAddress->country) ? $object->billingAddress->country : null,
// NonStrippingCreditCard won't remove the X's that Vindicia masks with
'card' => new NonStrippingCreditCard($card_info),
'attributes' => isset($nameValues) ? $this->buildAttributes($nameValues) : null
Expand Down
42 changes: 0 additions & 42 deletions src/PaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,48 +198,6 @@ public function setType($value)
return $this->setParameter('type', $value);
}

/**
* Get the billing postcode.
*
* @return null|string
*/
public function getPostcode()
{
return $this->getParameter('postcode');
}

/**
* Sets the billing postcode.
*
* @param string $value
* @return static
*/
public function setPostcode($value)
{
return $this->setParameter('postcode', $value);
}

/**
* Get the billing country.
*
* @return null|string
*/
public function getCountry()
{
return $this->getParameter('country');
}

/**
* Sets the billing country.
*
* @param string $value
* @return static
*/
public function setCountry($value)
{
return $this->setParameter('country', $value);
}

/**
* A list of attributes
*
Expand Down
7 changes: 4 additions & 3 deletions tests/Message/FetchPaymentMethodRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ public function testSendPayPalSuccess()
'PAYMENT_METHOD_REFERENCE' => $this->paymentMethodReference,
'COUNTRY' => $this->card['country'],
'POSTCODE' => $this->card['postcode']

));

$response = $this->request->send();
Expand All @@ -222,8 +221,10 @@ public function testSendPayPalSuccess()
$this->assertSame($this->paymentMethodId, $paymentMethod->getId());
$this->assertSame($this->paymentMethodReference, $paymentMethod->getReference());
$this->assertSame('PayPal', $paymentMethod->getType());
$this->assertSame($this->card['country'], $paymentMethod->getCountry());
$this->assertSame($this->card['postcode'], $paymentMethod->getPostcode());
$card = $paymentMethod->getCard();
$this->assertInstanceOf('\Omnipay\Common\CreditCard', $card);
$this->assertSame($this->card['country'], $card->getCountry());
$this->assertSame($this->card['postcode'], $card->getPostcode());

$attributes = $paymentMethod->getAttributes();
$this->assertSame(2, count($attributes));
Expand Down
20 changes: 0 additions & 20 deletions tests/PaymentMethodTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,26 +112,6 @@ public function testType()
$this->assertSame($type, $this->paymentMethod->getType());
}

/**
* @return void
*/
public function testPostcode()
{
$postcode = $this->faker->postcode();
$this->assertSame($this->paymentMethod, $this->paymentMethod->setPostcode($postcode));
$this->assertSame($postcode, $this->paymentMethod->getPostcode());
}

/**
* @return void
*/
public function testCountry()
{
$country = $this->faker->region();
$this->assertSame($this->paymentMethod, $this->paymentMethod->setCountry($country));
$this->assertSame($country, $this->paymentMethod->getCountry());
}

/**
* @return void
*/
Expand Down

0 comments on commit 0ca171f

Please sign in to comment.