コード例 #1
0
 /**
  * @param bool $isNew
  * @param array $data
  * @param array $billingData
  * @param array $expectedData
  * @param array $billingFormData
  * @dataProvider getThirdPartyTokenFormDataProvider
  */
 public function testGetThirdPartyTokenFormData($isNew, $data, $billingData, $expectedData, $billingFormData)
 {
     $this->billingAddressMock->expects($this->atLeastOnce())->method('importData')->with($billingData)->willReturnSelf();
     $this->billingAddressMock->expects($this->once())->method('getAsChildFormData')->with($isNew)->willReturn($billingFormData);
     $this->paymentProfile->importData($data);
     $this->assertEquals($expectedData, $this->paymentProfile->getThirdPartyTokenFormData());
 }
コード例 #2
0
 /**
  * @param array $data
  * @param array $addressData
  * @param array $addressAsChildFormData
  * @param array $expectedData
  * @param bool $isNew
  * @dataProvider getFormDataProvider
  */
 public function testGetFormData($data, $addressData, $addressAsChildFormData, $expectedData, $isNew)
 {
     $this->paymentProfileMock->expects($this->once())->method('importData')->with([])->willReturnSelf();
     $this->shippingAddressMock->expects($this->once())->method('importData')->with($addressData)->willReturnSelf();
     $this->shippingAddressMock->expects($this->any())->method('getId')->willReturn(null);
     $this->shippingAddressMock->expects($this->once())->method('getAsChildFormData')->with($isNew)->willReturn($addressAsChildFormData);
     $this->subscription->importData($data);
     $this->assertEquals($expectedData, $this->subscription->getFormData());
 }
コード例 #3
0
 /**
  * @param string $token
  * @param \SubscribePro\Service\PaymentProfile\PaymentProfileInterface $paymentProfile
  * @return \SubscribePro\Service\PaymentProfile\PaymentProfileInterface
  * @throws \SubscribePro\Exception\EntityInvalidDataException
  * @throws \SubscribePro\Exception\HttpException
  */
 public function verifyAndSaveToken($token, PaymentProfileInterface $paymentProfile)
 {
     if (!$paymentProfile->isTokenDataValid()) {
         throw new EntityInvalidDataException('Not all required fields are set.');
     }
     $response = $this->httpClient->post("/services/v1/vault/tokens/{$token}/verifyandstore.json", ['payment_profile' => $paymentProfile->getTokenFormData()]);
     return $this->retrieveItem($response, self::API_NAME_PROFILE, $paymentProfile);
 }