From e101156df5d4da27a0d806cb373e53b98fc630ec Mon Sep 17 00:00:00 2001 From: lmessier Date: Tue, 13 Sep 2016 11:56:39 +0200 Subject: [PATCH] remove email field when creating the card --- src/Message/CreateCardRequest.php | 8 ++++++++ tests/Message/CreateCardRequestTest.php | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/src/Message/CreateCardRequest.php b/src/Message/CreateCardRequest.php index e8344fb9..a73e4765 100644 --- a/src/Message/CreateCardRequest.php +++ b/src/Message/CreateCardRequest.php @@ -103,4 +103,12 @@ public function getEndpoint() // Create a new customer and card return $this->endpoint.'/customers'; } + + public function getCardData() + { + $data = parent::getCardData(); + unset($data['email']); + + return $data; + } } diff --git a/tests/Message/CreateCardRequestTest.php b/tests/Message/CreateCardRequestTest.php index 471109ba..3d3eda41 100644 --- a/tests/Message/CreateCardRequestTest.php +++ b/tests/Message/CreateCardRequestTest.php @@ -89,4 +89,13 @@ public function testSendFailure() $this->assertNull($response->getCardReference()); $this->assertSame('You must provide an integer value for \'exp_year\'.', $response->getMessage()); } + + public function testCardWithoutEmail() + { + $card = $this->getValidCard(); + $this->request->setCard($card); + $data = $this->request->getData(); + + $this->assertArrayNotHasKey('email', $card); + } }