/** * 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 $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()); }