Completed
Push — master ( 7fa4ba...22bb8d )
by Rigel Kent
01:35
created

Paymongo::token()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Luigel\Paymongo;
4
5
use Luigel\Paymongo\Models\PaymentIntent;
6
use Luigel\Paymongo\Models\PaymentMethod;
7
use Luigel\Paymongo\Models\Source;
8
use Luigel\Paymongo\Models\Webhook;
9
use Luigel\Paymongo\Traits\Request;
10
11
class Paymongo
12
{
13
    use Request;
14
15
    protected $method;
16
    protected $apiUrl = '';
17
    protected $payload;
18
    protected $returnModel = '';
19
20
    protected const BASE_API = 'https://api.paymongo.com/v1/';
21
    protected const ENPDPOINT_SOURCES = 'sources/';
22
    protected const ENDPOINT_WEBHOOKS = 'webhooks/';
23
    protected const ENDPOINT_PAYMENT_METHOD = 'payment_methods/';
24
    protected const ENDPOINT_PAYMENT_INTENT = 'payment_intents/';
25
    protected const SOURCE_GCASH = 'gcash';
26
    protected const SOURCE_GRAB_PAY = 'grab_pay';
27
28
    public function source()
29
    {
30
        $this->apiUrl = self::BASE_API . self::ENPDPOINT_SOURCES;
31
        $this->returnModel = Source::class;
32
        return $this;
33
    }
34
35
    public function webhook()
36
    {
37
        $this->apiUrl = self::BASE_API . self::ENDPOINT_WEBHOOKS;
38
        $this->returnModel = Webhook::class;
39
        return $this;
40
    }
41
42
    public function paymentMethod()
43
    {
44
        $this->apiUrl = self::BASE_API . self::ENDPOINT_PAYMENT_METHOD;
45
        $this->returnModel = PaymentMethod::class;
46
        return $this;
47
    }
48
49
    public function paymentIntent()
50
    {
51
        $this->apiUrl = self::BASE_API . self::ENDPOINT_PAYMENT_INTENT;
52
        $this->returnModel = PaymentIntent::class;
53
        return $this;
54
    }
55
}
56