public function testGetFormData()
 {
     $data = [TransactionInterface::TOKEN => 'token', TransactionInterface::GATEWAY_SPECIFIC_RESPONSE => 'response', TransactionInterface::GATEWAY_TYPE => 'type', TransactionInterface::AUTHORIZE_NET_RESPONSE_REASON_CODE => 'code', TransactionInterface::SUBSCRIBE_PRO_ERROR_DESCRIPTION => 'description', TransactionInterface::CREDITCARD_TYPE => 'type', TransactionInterface::CREDITCARD_LAST_DIGITS => '1111', TransactionInterface::CREDITCARD_FIRST_DIGITS => '411111', TransactionInterface::CREDITCARD_MONTH => '04', TransactionInterface::CREDITCARD_YEAR => '2019', TransactionInterface::BILLING_ADDRESS => '123', TransactionInterface::UNIQUE_ID => '123456789', TransactionInterface::REF_PAYMENT_PROFILE_ID => '414', TransactionInterface::REF_TRANSACTION_ID => '2323', TransactionInterface::REF_GATEWAY_ID => '525', TransactionInterface::REF_TOKEN => 'token', TransactionInterface::TYPE => 'type', TransactionInterface::AMOUNT => 'amount', TransactionInterface::CURRENCY_CODE => 'currency code', TransactionInterface::STATE => 'state', TransactionInterface::GATEWAY_TRANSACTION_ID => '124', TransactionInterface::EMAIL => '*****@*****.**', TransactionInterface::ORDER_ID => '123', TransactionInterface::IP => '0.0.0.0', TransactionInterface::RESPONSE_MESSAGE => 'message', TransactionInterface::ERROR_CODE => 'error_code', TransactionInterface::ERROR_DETAIL => 'detail', TransactionInterface::CVV_CODE => 'cvv_code', TransactionInterface::CVV_MESSAGE => 'cvv_message', TransactionInterface::AVS_CODE => 'avs_code', TransactionInterface::AVS_MESSAGE => 'avs_message', TransactionInterface::SUBSCRIBE_PRO_ERROR_CLASS => 'class', TransactionInterface::SUBSCRIBE_PRO_ERROR_TYPE => 'type', TransactionInterface::CREATED => '2016-12-12'];
     $expectedData = [TransactionInterface::AMOUNT => 'amount', TransactionInterface::CURRENCY_CODE => 'currency code', TransactionInterface::EMAIL => '*****@*****.**', TransactionInterface::ORDER_ID => '123', TransactionInterface::IP => '0.0.0.0', TransactionInterface::UNIQUE_ID => '123456789'];
     $this->transaction->importData($data);
     $this->assertEquals($expectedData, $this->transaction->getFormData());
 }
 /**
  * @param int $paymentProfileId
  * @param \SubscribePro\Service\Transaction\TransactionInterface $transaction
  * @return \SubscribePro\Service\Transaction\TransactionInterface
  * @throws \SubscribePro\Exception\EntityInvalidDataException
  * @throws \SubscribePro\Exception\HttpException
  */
 public function purchaseByProfile($paymentProfileId, TransactionInterface $transaction)
 {
     if (!$transaction->isValid()) {
         throw new EntityInvalidDataException('Not all required fields are set.');
     }
     $response = $this->httpClient->post("/services/v1/vault/paymentprofiles/{$paymentProfileId}/purchase.json", [self::API_NAME_TRANSACTION => $transaction->getFormData()]);
     return $this->retrieveItem($response, self::API_NAME_TRANSACTION, $transaction);
 }