| Server IP : 213.186.33.4 / Your IP : 216.73.216.193 Web Server : Apache System : Linux webm006.cluster103.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : awebpaca ( 35430) PHP Version : 8.5.0 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/awebpaca/Dolibarr/htdocs/includes/stripe/tests/ |
Upload File : |
<?php
namespace Stripe;
class CardErrorTest extends TestCase
{
public function testDecline()
{
self::authorizeFromEnv();
$card = array(
'number' => '4000000000000002',
'exp_month' => '3',
'exp_year' => '2020'
);
$charge = array(
'amount' => 100,
'currency' => 'usd',
'card' => $card
);
try {
Charge::create($charge);
} catch (Error\Card $e) {
$this->assertSame(402, $e->getHttpStatus());
$this->assertTrue(strpos($e->getRequestId(), "req_") === 0, $e->getRequestId());
$actual = $e->getJsonBody();
$this->assertSame(
array('error' => array(
'message' => 'Your card was declined.',
'type' => 'card_error',
'code' => 'card_declined',
'decline_code' => 'generic_decline',
'charge' => $actual['error']['charge'],
)),
$actual
);
}
}
}