You are here

public function SquareApiIntegrationTest::testCreatePaymentAlreadyUsed in Commerce Square Connect 8

Tests creating a payment, invalid/used nonce.

File

tests/src/Kernel/SquareApiIntegrationTest.php, line 157

Class

SquareApiIntegrationTest
Tests the Square SDK integration with Commerce.

Namespace

Drupal\Tests\commerce_square\Kernel

Code

public function testCreatePaymentAlreadyUsed() {
  $this
    ->expectException(SoftDeclineException::class);
  $this
    ->expectExceptionCode(0);
  $this
    ->expectExceptionMessage('Card verification code check failed.');

  /** @var \Drupal\commerce_square\Plugin\Commerce\PaymentGateway\SquareInterface $gateway_plugin */
  $gateway_plugin = $this->gateway
    ->getPlugin();
  $gateway_plugin
    ->createPayment($this
    ->generateTestPayment('cnon:card-nonce-rejected-cvv'));
}