%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/eirtvhdf/logodowntown.com/logo-offer/root_stripe/stripe/tests/Stripe/
Upload File :
Create Path :
Current File : /home/eirtvhdf/logodowntown.com/logo-offer/root_stripe/stripe/tests/Stripe/PaymentIntentTest.php

<?php

namespace Stripe;

class PaymentIntentTest extends TestCase
{
    const TEST_RESOURCE_ID = 'pi_123';

    public function testIsListable()
    {
        $this->expectsRequest(
            'get',
            '/v1/payment_intents'
        );
        $resources = PaymentIntent::all();
        $this->assertTrue(is_array($resources->data));
        $this->assertInstanceOf("Stripe\\PaymentIntent", $resources->data[0]);
    }

    public function testIsRetrievable()
    {
        $this->expectsRequest(
            'get',
            '/v1/payment_intents/' . self::TEST_RESOURCE_ID
        );
        $resource = PaymentIntent::retrieve(self::TEST_RESOURCE_ID);
        $this->assertInstanceOf("Stripe\\PaymentIntent", $resource);
    }

    public function testIsCreatable()
    {
        $this->expectsRequest(
            'post',
            '/v1/payment_intents'
        );
        $resource = PaymentIntent::create([
            "allowed_source_types" => ["card"],
            "amount" => 100,
            "currency" => "usd",
        ]);
        $this->assertInstanceOf("Stripe\\PaymentIntent", $resource);
    }

    public function testIsSaveable()
    {
        $resource = PaymentIntent::retrieve(self::TEST_RESOURCE_ID);
        $resource->metadata["key"] = "value";
        $this->expectsRequest(
            'post',
            '/v1/payment_intents/' . self::TEST_RESOURCE_ID
        );
        $resource->save();
        $this->assertInstanceOf("Stripe\\PaymentIntent", $resource);
    }

    public function testIsUpdatable()
    {
        $this->expectsRequest(
            'post',
            '/v1/payment_intents/' . self::TEST_RESOURCE_ID
        );
        $resource = PaymentIntent::update(
            self::TEST_RESOURCE_ID,
            [
                "metadata" => ["key" => "value"],
            ]
        );
        $this->assertInstanceOf("Stripe\\PaymentIntent", $resource);
    }

    public function testIsCancelable()
    {
        $resource = PaymentIntent::retrieve(self::TEST_RESOURCE_ID);
        $this->expectsRequest(
            'post',
            '/v1/payment_intents/' . self::TEST_RESOURCE_ID . '/cancel'
        );
        $resource->cancel();
        $this->assertInstanceOf("Stripe\\PaymentIntent", $resource);
    }

    public function testIsCapturable()
    {
        $resource = PaymentIntent::retrieve(self::TEST_RESOURCE_ID);
        $this->expectsRequest(
            'post',
            '/v1/payment_intents/' . self::TEST_RESOURCE_ID . '/capture'
        );
        $resource->capture();
        $this->assertInstanceOf("Stripe\\PaymentIntent", $resource);
    }

    public function testIsConfirmable()
    {
        $resource = PaymentIntent::retrieve(self::TEST_RESOURCE_ID);
        $this->expectsRequest(
            'post',
            '/v1/payment_intents/' . self::TEST_RESOURCE_ID . '/confirm'
        );
        $resource->confirm();
        $this->assertInstanceOf("Stripe\\PaymentIntent", $resource);
    }
}

Zerion Mini Shell 1.0