ReferencedPayouts   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 84
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 84
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A createReferencedBatchPayout() 0 9 1
A showReferencedPayoutItemDetails() 0 7 1
A createReferencedBatchPayoutItem() 0 9 1
A listItemsReferencedInBatchPayout() 0 7 1
1
<?php
2
3
namespace Srmklive\PayPal\Traits\PayPalAPI;
4
5
trait ReferencedPayouts
6
{
7
    /**
8
     * Create a referenced Batch Payout.
9
     *
10
     * @param array $data
11
     *
12
     * @throws \Throwable
13
     *
14
     * @return array|\Psr\Http\Message\StreamInterface|string
15
     *
16
     * @see https://developer.paypal.com/docs/api/referenced-payouts/v1/#referenced-payouts_create_batch
17
     */
18
    public function createReferencedBatchPayout(array $data)
19
    {
20
        $this->apiEndPoint = 'v1/payments/referenced-payouts';
21
22
        $this->options['json'] = $data;
23
24
        $this->verb = 'post';
25
26
        return $this->doPayPalRequest();
27
    }
28
29
    /**
30
     * Show Batch Payout details by ID.
31
     *
32
     * @param string $batch_payout_id
33
     *
34
     * @throws \Throwable
35
     *
36
     * @return array|\Psr\Http\Message\StreamInterface|string
37
     *
38
     * @see https://developer.paypal.com/docs/api/referenced-payouts/v1/#referenced-payouts_get_batch_details
39
     */
40
    public function listItemsReferencedInBatchPayout(string $batch_payout_id)
41
    {
42
        $this->apiEndPoint = "v1/payments/referenced-payouts/{$batch_payout_id}";
43
44
        $this->verb = 'get';
45
46
        return $this->doPayPalRequest();
47
    }
48
49
    /**
50
     * Create a referenced Batch Payout Item.
51
     *
52
     * @param array $data
53
     *
54
     * @throws \Throwable
55
     *
56
     * @return array|\Psr\Http\Message\StreamInterface|string
57
     *
58
     * @see https://developer.paypal.com/docs/api/referenced-payouts/v1/#referenced-payouts-items_create
59
     */
60
    public function createReferencedBatchPayoutItem(array $data)
61
    {
62
        $this->apiEndPoint = 'v1/payments/referenced-payouts-items';
63
64
        $this->options['json'] = $data;
65
66
        $this->verb = 'post';
67
68
        return $this->doPayPalRequest();
69
    }
70
71
    /**
72
     * Show Payout Item details by ID.
73
     *
74
     * @param string $payout_item_id
75
     *
76
     * @throws \Throwable
77
     *
78
     * @return array|\Psr\Http\Message\StreamInterface|string
79
     *
80
     * @see https://developer.paypal.com/docs/api/referenced-payouts/v1/#referenced-payouts-items_get
81
     */
82
    public function showReferencedPayoutItemDetails(string $payout_item_id)
83
    {
84
        $this->apiEndPoint = "v1/payments/referenced-payouts-items/{$payout_item_id}";
85
86
        $this->verb = 'get';
87
88
        return $this->doPayPalRequest();
89
    }
90
}
91