Completed
Push — master ( 7b285b...480624 )
by Rigel Kent
04:14
created

Paymongo::payment()   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\Payment;
6
use Luigel\Paymongo\Models\Source;
7
use Luigel\Paymongo\Models\Token;
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 ENPOINT_TOKEN = 'tokens/';
22
    protected const ENDPOINT_PAYMENTS = 'payments/';
23
    protected const ENPDPOINT_SOURCES = 'sources/';
24
    protected const ENDPOINT_WEBHOOKS = 'webhooks/';
25
    protected const SOURCE_GCASH = 'gcash';
26
27
    public function token()
28
    {
29
        $this->apiUrl = self::BASE_API . self::ENPOINT_TOKEN;
30
        $this->returnModel = Token::class;
31
        return $this;
32
    }
33
34
    public function payment()
35
    {
36
        $this->apiUrl = self::BASE_API . self::ENDPOINT_PAYMENTS;
37
        $this->returnModel = Payment::class;
38
        return $this;
39
    }
40
41
    public function source()
42
    {
43
        $this->apiUrl = self::BASE_API . self::ENPDPOINT_SOURCES;
44
        $this->returnModel = Source::class;
45
        return $this;
46
    }
47
48
    public function webhook()
49
    {
50
        $this->apiUrl = self::BASE_API . self::ENDPOINT_WEBHOOKS;
51
        $this->returnModel = Webhook::class;
52
        return $this;
53
    }
54
}
55