/** * Check all fields match expected values. * * @param PaymentResponse $fromXmlResponse * @param PHPUnit_Framework_TestCase $testCase */ public static function checkUnmarshalledPaymentResponseWithFraudFilterNoRules(PaymentResponse $fromXmlResponse, PHPUnit_Framework_TestCase $testCase, $ignoreTssChecks = false) { $fraudFilter = $fromXmlResponse->getFraudFilter(); $testCase->assertEquals(FraudFilterMode::ACTIVE, $fraudFilter->getMode()); $testCase->assertEquals(FraudFilterResult::NOT_EXECUTED, $fraudFilter->getResult()); $testCase->assertEmpty($fraudFilter->getRules()); $testCase->assertEquals(self::FRAUD_FILTER_TIMESTAMP, $fromXmlResponse->getTimeStamp()); $testCase->assertEquals(self::FRAUD_FILTER_MERCHANT_ID, $fromXmlResponse->getMerchantId()); $testCase->assertEquals(self::FRAUD_FILTER_ACCOUNT, $fromXmlResponse->getAccount()); $testCase->assertEquals(self::FRAUD_FILTER_ORDER_ID, $fromXmlResponse->getOrderId()); $testCase->assertEquals(self::FRAUD_FILTER_AUTH_CODE, $fromXmlResponse->getAuthCode()); $testCase->assertEquals(self::FRAUD_FILTER_RESULTT, $fromXmlResponse->getResult()); $testCase->assertEquals(self::FRAUD_FILTER_CVN_RESULT, $fromXmlResponse->getCvnResult()); $testCase->assertEquals(self::FRAUD_FILTER_AVS_POST, $fromXmlResponse->getAvsPostcodeResponse()); $testCase->assertEquals(self::FRAUD_FILTER_AVS_ADD, $fromXmlResponse->getAvsAddressResponse()); $testCase->assertEquals(self::FRAUD_FILTER_BATCH_ID, $fromXmlResponse->getBatchId()); $testCase->assertEquals(self::FRAUD_FILTER_MESSAGE, $fromXmlResponse->getMessage()); $testCase->assertEquals(self::FRAUD_FILTER_PAS_REF, $fromXmlResponse->getPaymentsReference()); $testCase->assertEquals(self::FRAUD_FILTER_TIME_TAKEN, $fromXmlResponse->getTimeTaken()); $testCase->assertEquals(self::FRAUD_FILTER_AUTH_TIME, $fromXmlResponse->getAuthTimeTaken()); $testCase->assertEquals(self::FRAUD_FILTER_HASH, $fromXmlResponse->getHash()); }
/** * Check all fields match expected values. * * @param PaymentResponse $fromXmlResponse * @param PHPUnit_Framework_TestCase $testCase */ public static function checkUnmarshalledPaymentResponse(PaymentResponse $fromXmlResponse, PHPUnit_Framework_TestCase $testCase, $ignoreTssChecks = false) { $testCase->assertEquals(self::ACCOUNT, $fromXmlResponse->getAccount()); $testCase->assertEquals(self::ACQUIRER_RESPONSE, $fromXmlResponse->getAcquirerResponse()); $testCase->assertEquals(self::AUTH_CODE, $fromXmlResponse->getAuthCode()); $testCase->assertEquals(self::AUTH_TIME_TAKEN, $fromXmlResponse->getAuthTimeTaken()); $testCase->assertEquals(self::BATCH_ID, $fromXmlResponse->getBatchId()); $testCase->assertEquals(self::BANK, $fromXmlResponse->getCardIssuer()->getBank()); $testCase->assertEquals(self::COUNTRY, $fromXmlResponse->getCardIssuer()->getCountry()); $testCase->assertEquals(self::COUNTRY_CODE, $fromXmlResponse->getCardIssuer()->getCountryCode()); $testCase->assertEquals(self::REGION, $fromXmlResponse->getCardIssuer()->getRegion()); $testCase->assertEquals(self::CVN_RESULT, $fromXmlResponse->getCvnResult()); $testCase->assertEquals(self::MERCHANT_ID, $fromXmlResponse->getMerchantId()); $testCase->assertEquals(self::MESSAGE, $fromXmlResponse->getMessage()); $testCase->assertEquals(self::ORDER_ID, $fromXmlResponse->getOrderId()); $testCase->assertEquals(self::PASREF, $fromXmlResponse->getPaymentsReference()); $testCase->assertEquals(self::RESULT_SUCCESS, $fromXmlResponse->getResult()); $testCase->assertEquals(self::RESPONSE_HASH, $fromXmlResponse->getHash()); $testCase->assertEquals(self::TIMESTAMP, $fromXmlResponse->getTimeStamp()); $testCase->assertEquals(self::TIME_TAKEN, $fromXmlResponse->getTimeTaken()); $testCase->assertEquals(self::TSS_RESULT, $fromXmlResponse->getTssResult()->getResult()); if (!$ignoreTssChecks) { $checks = $fromXmlResponse->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->assertEquals(self::AVS_ADDRESS, $fromXmlResponse->getAvsAddressResponse()); $testCase->assertEquals(self::AVS_POSTCODE, $fromXmlResponse->getAvsPostcodeResponse()); $testCase->assertTrue($fromXmlResponse->isSuccess()); }