Passed
Push — v2.0 ( f438a9...d79b43 )
by Raza
02:10 queued 17s
created

listItemsReferencedInBatchPayout()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 7
rs 10
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
     * @param string $request_id
12
     * @param string $partner_attribution_id
13
     *
14
     * @throws \Throwable
15
     *
16
     * @return array|\Psr\Http\Message\StreamInterface|string
17
     *
18
     * @see https://developer.paypal.com/docs/api/referenced-payouts/v1/#referenced-payouts_create_batch
19
     */
20
    public function createReferencedBatchPayout(array $data, $request_id, $partner_attribution_id)
21
    {
22
        $this->apiEndPoint = 'v1/payments/referenced-payouts';
23
24
        $this->options['headers']['PayPal-Request-Id'] = $request_id;
25
        $this->options['headers']['PayPal-Partner-Attribution-Id'] = $partner_attribution_id;
26
        $this->options['json'] = $data;
27
28
        $this->verb = 'post';
29
30
        return $this->doPayPalRequest();
31
    }
32
33
    /**
34
     * Show Batch Payout details by ID.
35
     *
36
     * @param string $batch_payout_id
37
     *
38
     * @throws \Throwable
39
     *
40
     * @return array|\Psr\Http\Message\StreamInterface|string
41
     *
42
     * @see https://developer.paypal.com/docs/api/referenced-payouts/v1/#referenced-payouts_get_batch_details
43
     */
44
    public function listItemsReferencedInBatchPayout($batch_payout_id)
45
    {
46
        $this->apiEndPoint = "v1/payments/referenced-payouts/{$batch_payout_id}";
47
48
        $this->verb = 'get';
49
50
        return $this->doPayPalRequest();
51
    }
52
53
    /**
54
     * Create a referenced Batch Payout Item.
55
     *
56
     * @param array  $data
57
     * @param string $request_id
58
     * @param string $partner_attribution_id
59
     *
60
     * @throws \Throwable
61
     *
62
     * @return array|\Psr\Http\Message\StreamInterface|string
63
     *
64
     * @see https://developer.paypal.com/docs/api/referenced-payouts/v1/#referenced-payouts-items_create
65
     */
66
    public function createReferencedBatchPayoutItem(array $data, $request_id, $partner_attribution_id)
67
    {
68
        $this->apiEndPoint = 'v1/payments/referenced-payouts-items';
69
70
        $this->options['headers']['PayPal-Request-Id'] = $request_id;
71
        $this->options['headers']['PayPal-Partner-Attribution-Id'] = $partner_attribution_id;
72
        $this->options['json'] = $data;
73
74
        $this->verb = 'post';
75
76
        return $this->doPayPalRequest();
77
    }
78
79
    /**
80
     * Show Payout Item details by ID.
81
     *
82
     * @param string $payout_item_id
83
     * @param string $partner_attribution_id
84
     *
85
     * @throws \Throwable
86
     *
87
     * @return array|\Psr\Http\Message\StreamInterface|string
88
     *
89
     * @see https://developer.paypal.com/docs/api/referenced-payouts/v1/#referenced-payouts-items_get
90
     */
91
    public function showReferencedPayoutItemDetails($payout_item_id, $partner_attribution_id)
92
    {
93
        $this->apiEndPoint = "v1/payments/referenced-payouts-items/{$payout_item_id}";
94
95
        $this->options['headers']['PayPal-Partner-Attribution-Id'] = $partner_attribution_id;
96
        $this->verb = 'get';
97
98
        return $this->doPayPalRequest();
99
    }
100
}
101