public function testDeletePaymentAccountMastercard()
 {
     // Create a card token
     $response = $this->gw->paymentAccountCreate(['PaymentAccountType' => PaymentAccountType::CREDIT_CARD, 'PaymentAccountReferenceNumber' => uniqid(), 'CardDataKeySerialNumber' => getenv('MASTERCARD_CARD_DATA_KEY_SERIAL_NUMBER'), 'EncryptedFormat' => EncryptedFormat::memberByKey(getenv('ENCRYPTED_FORMAT'))->value(), 'EncryptedTrack1Data' => getenv('MASTERCARD_ENCRYPTED_TRACK1_DATA'), 'BillingZipcode' => '90210'])->send();
     $this->assertSame("0", $response->getCode());
     // Delete PaymentAccount
     $response = $this->gw->paymentAccountDelete(['PaymentAccountID' => $response->getPaymentAccountId()])->send();
     $this->assertSame("0", $response->getCode());
     static::$buffer .= self::dataRow(...['Delete Payment Account (Mastercard)', 'N/A', $response->getCode(), $response->getData()->ServicesID]);
 }
 public function testVisaPerformVoidOfPriorCredit()
 {
     // First create a credit to void
     $response = $this->gw->creditCardCredit($this->optsRetailSwiped(['TransactionAmount' => '100.02', 'ReferenceNumber' => uniqid(), 'TicketNumber' => uniqid(), 'CardDataKeySerialNumber' => getenv('VISA_CARD_DATA_KEY_SERIAL_NUMBER'), 'EncryptedFormat' => EncryptedFormat::memberByKey(getenv('ENCRYPTED_FORMAT'))->value(), 'EncryptedTrack1Data' => getenv('VISA_ENCRYPTED_TRACK1_DATA')]))->send();
     $this->assertSame("0", $response->getCode());
     // Then void the credit
     $response = $this->gw->creditCardVoid($this->optsRetailKeyed(['ReferenceNumber' => uniqid(), 'TicketNumber' => uniqid(), 'TransactionID' => $response->getTransactionId()]))->send();
     $this->assertSame("0", $response->getCode());
     static::$buffer .= self::dataRow(...['Visa (perform Void of prior Credit)', '100.02', $response->getCode(), $response->getTransactionId()]);
 }
 public function testVisaPerformFullReversalOfPriorSale()
 {
     // First create a sale to reverse.
     $response = $this->gw->creditCardSale($this->optsRetailSwiped(['TransactionAmount' => '200.01', 'ReferenceNumber' => uniqid(), 'TicketNumber' => uniqid(), 'CardDataKeySerialNumber' => getenv('VISA_CARD_DATA_KEY_SERIAL_NUMBER'), 'EncryptedFormat' => EncryptedFormat::memberByKey(getenv('ENCRYPTED_FORMAT'))->value(), 'EncryptedTrack1Data' => getenv('VISA_ENCRYPTED_TRACK1_DATA')]))->send();
     $this->assertSame("0", $response->getCode());
     // Then reverse the sale
     $response = $this->gw->creditCardReversal($this->optsRetailKeyed(['TransactionAmount' => '200.01', 'ReferenceNumber' => uniqid(), 'TicketNumber' => uniqid(), 'TransactionID' => $response->getTransactionId(), 'ReversalType' => ReversalType::FULL]))->send();
     $this->assertSame("0", $response->getCode());
     static::$buffer .= self::dataRow(...['Visa (perform Full Reversal of prior Sale)', '200.01', $response->getCode(), $response->getTransactionId()]);
 }
 public function testQueryByExpirationMonthAndYear()
 {
     // Create a card token
     $response = $this->gw->paymentAccountCreate(['PaymentAccountType' => PaymentAccountType::CREDIT_CARD, 'PaymentAccountReferenceNumber' => uniqid(), 'CardDataKeySerialNumber' => getenv('VISA_CARD_DATA_KEY_SERIAL_NUMBER'), 'EncryptedFormat' => EncryptedFormat::memberByKey(getenv('ENCRYPTED_FORMAT'))->value(), 'EncryptedTrack1Data' => getenv('VISA_ENCRYPTED_TRACK1_DATA'), 'BillingZipcode' => '90210'])->send();
     $this->assertSame("0", $response->getCode());
     // Query based on PaymentAccountReferenceNumber
     $response = $this->gw->paymentAccountQuery(['ExpirationMonthEnd' => '12', 'ExpirationYearEnd' => '19'])->send();
     $this->assertSame("0", $response->getCode());
     static::$buffer .= self::dataRow(...['Query by ExpirationMonth and Year End', 'N/A', $response->getCode(), $response->getData()->ServicesID]);
 }
 public function testVisaDuplicateCheckDisabled()
 {
     // First create a sale.
     $response = $this->gw->creditCardSale($this->optsRetailSwiped(['TransactionAmount' => '0.23', 'ReferenceNumber' => uniqid(), 'TicketNumber' => uniqid(), 'CardDataKeySerialNumber' => getenv('VISA_CARD_DATA_KEY_SERIAL_NUMBER'), 'EncryptedFormat' => EncryptedFormat::memberByKey(getenv('ENCRYPTED_FORMAT'))->value(), 'EncryptedTrack1Data' => getenv('VISA_ENCRYPTED_TRACK1_DATA')]))->send();
     $this->assertSame("23", $response->getCode());
     static::$buffer .= self::dataRow(...['Visa (Sale)', '0.23', $response->getCode(), $response->getTransactionId()]);
     // Run it again with duplicate checks disabled set to true.
     $response = $this->gw->creditCardSale($this->optsRetailSwiped(['TransactionAmount' => '0.23', 'ReferenceNumber' => uniqid(), 'TicketNumber' => uniqid(), 'CardDataKeySerialNumber' => getenv('VISA_CARD_DATA_KEY_SERIAL_NUMBER'), 'EncryptedFormat' => EncryptedFormat::memberByKey(getenv('ENCRYPTED_FORMAT'))->value(), 'EncryptedTrack1Data' => getenv('VISA_ENCRYPTED_TRACK1_DATA'), 'DuplicateCheckDisableFlag' => "1"]))->send();
     $this->assertSame("0", $response->getCode());
     static::$buffer .= self::dataRow(...['Visa (Sale, DuplicateCheckDisableFlag=true)', '0.23', $response->getCode(), $response->getTransactionId()]);
 }
 public function testVisaPartialCreditCardReturn()
 {
     // First create a sale.
     $response = $this->gw->creditCardSale($this->optsRetailSwiped(['TransactionAmount' => '3.25', 'ReferenceNumber' => uniqid(), 'TicketNumber' => uniqid(), 'CardDataKeySerialNumber' => getenv('VISA_CARD_DATA_KEY_SERIAL_NUMBER'), 'EncryptedFormat' => EncryptedFormat::memberByKey(getenv('ENCRYPTED_FORMAT'))->value(), 'EncryptedTrack1Data' => getenv('VISA_ENCRYPTED_TRACK1_DATA')]))->send();
     $this->assertSame("0", $response->getCode());
     static::$buffer .= self::dataRow(...['Visa (Sale)', '3.25', $response->getCode(), $response->getTransactionId()]);
     // Perform a full return on the previous sale.
     $response = $this->gw->creditCardReturn($this->optsRetailKeyed(['TransactionAmount' => '2.25', 'ReferenceNumber' => uniqid(), 'TicketNumber' => uniqid(), 'TransactionID' => $response->getTransactionId()]))->send();
     $this->assertSame("0", $response->getCode());
     static::$buffer .= self::dataRow(...['Visa (partial CreditCardReturn)', '2.25', $response->getCode(), $response->getTransactionId()]);
 }
 public function testCreditCardCreditVisa()
 {
     // Create a card token
     $response = $this->gw->paymentAccountCreate(['PaymentAccountType' => PaymentAccountType::CREDIT_CARD, 'PaymentAccountReferenceNumber' => uniqid(), 'CardDataKeySerialNumber' => getenv('VISA_CARD_DATA_KEY_SERIAL_NUMBER'), 'EncryptedFormat' => EncryptedFormat::memberByKey(getenv('ENCRYPTED_FORMAT'))->value(), 'EncryptedTrack1Data' => getenv('VISA_ENCRYPTED_TRACK1_DATA'), 'BillingZipcode' => '90210'])->send();
     $this->assertSame("0", $response->getCode());
     $paymentAccountId = $response->getPaymentAccountId();
     // Create a CreditCardSale to credit.
     $response = $this->gw->creditCardSale($this->optsRetailKeyed(['TransactionAmount' => '1.93', 'ReferenceNumber' => uniqid(), 'TicketNumber' => uniqid(), 'PaymentAccountID' => $paymentAccountId]))->send();
     $this->assertSame("0", $response->getCode());
     // Credit the CreditCardSale amount back to the card
     $response = $this->gw->creditCardCredit($this->optsRetailKeyed(['TransactionAmount' => '1.93', 'ReferenceNumber' => uniqid(), 'TicketNumber' => uniqid(), 'PaymentAccountID' => $paymentAccountId]))->send();
     $this->assertSame("0", $response->getCode());
     static::$buffer .= self::dataRow(...['CreditCardCredit (Visa)', '1.93', $response->getCode(), $response->getTransactionId()]);
 }
 public function testVisaSwipedEncryptedTrack2Data()
 {
     $response = $this->gw->paymentAccountCreate(['PaymentAccountType' => PaymentAccountType::CREDIT_CARD, 'PaymentAccountReferenceNumber' => uniqid(), 'CardDataKeySerialNumber' => getenv('VISA_CARD_DATA_KEY_SERIAL_NUMBER'), 'EncryptedFormat' => EncryptedFormat::memberByKey(getenv('ENCRYPTED_FORMAT'))->value(), 'EncryptedTrack2Data' => getenv('VISA_ENCRYPTED_TRACK2_DATA'), 'BillingZipcode' => '90210'])->send();
     $this->assertSame("0", $response->getCode());
     static::$buffer .= self::dataRow(...['Visa Swiped (EncryptedTrack2Data)', 'N/A', $response->getCode(), $response->getData()->ServicesID]);
 }
 public function testVisaSwipedEncryptedTrack2Data()
 {
     $response = $this->gw->creditCardCredit($this->optsRetailSwiped(['TransactionAmount' => '5.21', 'ReferenceNumber' => uniqid(), 'TicketNumber' => uniqid(), 'CardDataKeySerialNumber' => getenv('VISA_CARD_DATA_KEY_SERIAL_NUMBER'), 'EncryptedFormat' => EncryptedFormat::memberByKey(getenv('ENCRYPTED_FORMAT'))->value(), 'EncryptedTrack2Data' => getenv('VISA_ENCRYPTED_TRACK2_DATA')]))->send();
     $this->assertSame("0", $response->getCode());
     static::$buffer .= self::dataRow(...['Visa Swiped (EncryptedTrack2Data)', '5.21', $response->getCode(), $response->getTransactionId()]);
 }