/**
  * Set TransactionReference and/or CardReference based on previous transaction response
  *
  * @param GenericPostResponse $response Previous transaction response
  * @param int|bool $fillMode Whether to set TransactionReference, CardReference, Amount, Currency and/or Description
  * @return $this
  */
 public function fill(GenericPostResponse $response, $fillMode = true)
 {
     if (true === $fillMode) {
         $fillMode = $this->defaultFillMode;
     }
     if ($fillMode & self::FILL_MODE_TRANSACTION_REFERENCE) {
         $transactionReference = $response->getTransactionReference();
         if ($transactionReference) {
             $this->setTransactionReference($transactionReference);
         }
     }
     if ($fillMode & self::FILL_MODE_CARD_REFERENCE) {
         $cardReference = $response->getCardReference();
         if ($cardReference) {
             $this->setCardReference($cardReference);
         }
     }
     if ($fillMode & self::FILL_MODE_AMOUNT) {
         $amount = $response->getPresentationAmount();
         if ('0.00' === $amount) {
             $amount = null;
         }
         if ($amount) {
             $this->setAmount($amount);
         }
     }
     if ($fillMode & self::FILL_MODE_CURRENCY) {
         $currency = $response->getPresentationCurrency();
         if ($currency) {
             $this->setCurrency($currency);
         }
     }
     if ($fillMode & self::FILL_MODE_DESCRIPTION) {
         $description = $response->getPresentationUsage();
         if ($description) {
             $this->setDescription($description);
         }
     }
     return $this;
 }
 public function testInvalidRequestResponse()
 {
     $data = ['POST_VALIDATION' => '2020', 'P3_VALIDATION' => '2020'];
     $response = new GenericPostResponse($this->getMockRequest(), $data, 200);
     $this->assertFalse($response->isSuccessful());
     $this->assertFalse($response->isRedirect());
     $this->assertFalse($response->isTransparentRedirect());
     $this->assertFalse($response->isTransactionToken());
     $this->assertFalse($response->isCancelled());
     $this->assertFalse($response->isWaiting());
     $this->assertFalse($response->haveWidget());
     $this->assertNull($response->getWidget());
     $this->assertSame('2020', $response->getCode());
     $this->assertSame('', $response->getMessage());
     $this->assertNull($response->getCardReference());
     $this->assertNull($response->getTransactionReference());
     $this->assertNull($response->getIdentificationUniqueId());
     $this->assertNull($response->getTransactionId());
     $this->assertNull($response->getIdentificationTransactionId());
     $this->assertNull($response->getAccountRegistration());
     $this->assertNull($response->getIdentificationShortId());
     $this->assertNull($response->getIdentificationShopperId());
     $this->assertNull($response->getProcessingReason());
     $this->assertNull($response->getProcessingReturn());
     $this->assertNull($response->getProcessingResult());
     $this->assertNull($response->getProcessingCode());
     $this->assertNull($response->getProcessingReasonCode());
     $this->assertNull($response->getProcessingStatusCode());
     $this->assertNull($response->acquireProcessingStatusCode());
     $this->assertNull($response->getProcessingReturnCode());
     $this->assertNull($response->getPaymentCode());
     $this->assertNull($response->getTransactionResponse());
     $this->assertSame('2020', $response->getPostValidationErrorCode());
 }