You are here

public function SquareApiIntegrationTest::testCreatePaymentDeclined in Commerce Square Connect 8

Tests creating a payment, declined.

@todo This should be a hard decline.

File

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

Class

SquareApiIntegrationTest
Tests the Square SDK integration with Commerce.

Namespace

Drupal\Tests\commerce_square\Kernel

Code

public function testCreatePaymentDeclined() {
  $this
    ->expectException(SoftDeclineException::class);
  $this
    ->expectExceptionCode(0);
  $this
    ->expectExceptionMessage('Card declined.');

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