/** * Check all fields match expected values. * * @param PaymentResponse $fromXmlResponse * @param PHPUnit_Framework_TestCase $testCase */ public static function checkUnmarshalledDCCPaymentResponse(PaymentResponse $fromXmlResponse, PHPUnit_Framework_TestCase $testCase) { $testCase->assertEquals(self::DCC_RATE_TIMESTAMP_RESPONSE, $fromXmlResponse->getTimeStamp()); $testCase->assertEquals(self::DCC_RATE_MERCHANT_ID_RESPONSE, $fromXmlResponse->getMerchantId()); $testCase->assertEquals(self::DCC_RATE_ACCOUNT_RESPONSE, $fromXmlResponse->getAccount()); $testCase->assertEquals(self::DCC_RATE_ORDER_ID_RESPONSE, $fromXmlResponse->getOrderId()); $testCase->assertEquals(self::DCC_RATE_RESULT_RESPONSE, $fromXmlResponse->getResult()); $testCase->assertEquals(self::DCC_RATE_CVN_RESULT_RESPONSE, $fromXmlResponse->getCvnResult()); $testCase->assertEquals(self::DCC_RATE_PASREF_RESPONSE, $fromXmlResponse->getPaymentsReference()); $testCase->assertEquals(self::DCC_RATE_CH_CURRENCY_RESPONSE, $fromXmlResponse->getDccInfoResult()->getCardHolderCurrency()); $testCase->assertEquals(self::DCC_RATE_CH_AMOUNT_RESPONSE, $fromXmlResponse->getDccInfoResult()->getCardHolderAmount()); $testCase->assertEquals(self::DCC_RATE_CH_RATE_RESPONSE, $fromXmlResponse->getDccInfoResult()->getCardHolderRate()); $testCase->assertEquals(self::DCC_RATE_MERCHANT_CURRENCY_RESPONSE, $fromXmlResponse->getDccInfoResult()->getMerchantCurrency()); $testCase->assertEquals(self::DCC_RATE_MERCHANT_AMOUNT_RESPONSE, $fromXmlResponse->getDccInfoResult()->getMerchantAmount()); $testCase->assertEquals(self::DCC_RATE_REQUEST_HASH_RESPONSE, $fromXmlResponse->getHash()); $testCase->assertTrue($fromXmlResponse->isSuccess()); }
/** * Check all fields match expected values. * * @param PaymentResponse $response * @param PHPUnit_Framework_TestCase $testCase */ public static function checkFullResponseError(PaymentResponse $response, PHPUnit_Framework_TestCase $testCase) { $testCase->assertEquals(self::ACCOUNT, $response->getAccount()); $testCase->assertEquals(self::ACQUIRER_RESPONSE, $response->getAcquirerResponse()); $testCase->assertEquals(self::AUTH_CODE, $response->getAuthCode()); $testCase->assertEquals(self::AUTH_TIME_TAKEN, $response->getAuthTimeTaken()); $testCase->assertEquals(self::BATCH_ID, $response->getBatchId()); $testCase->assertEquals(self::BANK, $response->getCardIssuer()->getBank()); $testCase->assertEquals(self::COUNTRY, $response->getCardIssuer()->getCountry()); $testCase->assertEquals(self::COUNTRY_CODE, $response->getCardIssuer()->getCountryCode()); $testCase->assertEquals(self::REGION, $response->getCardIssuer()->getRegion()); $testCase->assertEquals(self::CVN_RESULT, $response->getCvnResult()); $testCase->assertEquals(self::MERCHANT_ID, $response->getMerchantId()); $testCase->assertEquals(self::MESSAGE_FULL_ERROR, $response->getMessage()); $testCase->assertEquals(self::ORDER_ID, $response->getOrderId()); $testCase->assertEquals(self::PASREF, $response->getPaymentsReference()); $testCase->assertEquals(self::RESULT_FULL_ERROR, $response->getResult()); $testCase->assertEquals(self::RESPONSE_FULL_ERROR_HASH, $response->getHash()); $testCase->assertEquals(self::TIMESTAMP, $response->getTimeStamp()); $testCase->assertEquals(self::TIME_TAKEN, $response->getTimeTaken()); $testCase->assertEquals(self::TSS_RESULT, $response->getTssResult()->getResult()); $checks = $response->getTssResult()->getChecks(); $testCase->assertEquals(self::TSS_RESULT_CHECK1_ID, $checks[0]->getId()); $testCase->assertEquals(self::TSS_RESULT_CHECK1_VALUE, $checks[0]->getValue()); $testCase->assertEquals(self::TSS_RESULT_CHECK2_ID, $checks[1]->getId()); $testCase->assertEquals(self::TSS_RESULT_CHECK2_VALUE, $checks[1]->getValue()); $testCase->assertFalse($response->isSuccess()); }