PaymentExperienceWebProfiles   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 126
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 22
c 2
b 0
f 0
dl 0
loc 126
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A listWebExperienceProfiles() 0 7 1
A showWebExperienceProfileDetails() 0 7 1
A deleteWebExperienceProfile() 0 7 1
A createWebExperienceProfile() 0 9 1
A updateWebExperienceProfile() 0 9 1
A patchWebExperienceProfile() 0 9 1
1
<?php
2
3
namespace Srmklive\PayPal\Traits\PayPalAPI;
4
5
trait PaymentExperienceWebProfiles
6
{
7
    /**
8
     * List Web Experience Profiles.
9
     *
10
     * @throws \Throwable
11
     *
12
     * @return array|\Psr\Http\Message\StreamInterface|string
13
     *
14
     * @see https://developer.paypal.com/docs/api/payment-experience/v1/#web-profiles_get-list
15
     */
16
    public function listWebExperienceProfiles()
17
    {
18
        $this->apiEndPoint = 'v1/payment-experience/web-profiles';
19
20
        $this->verb = 'get';
21
22
        return $this->doPayPalRequest();
23
    }
24
25
    /**
26
     * Create a Web Experience Profile.
27
     *
28
     * @param array $data
29
     *
30
     * @throws \Throwable
31
     *
32
     * @return array|\Psr\Http\Message\StreamInterface|string
33
     *
34
     * @see https://developer.paypal.com/docs/api/payment-experience/v1/#web-profile_create
35
     */
36
    public function createWebExperienceProfile(array $data)
37
    {
38
        $this->apiEndPoint = 'v1/payment-experience/web-profiles';
39
40
        $this->options['json'] = $data;
41
42
        $this->verb = 'post';
43
44
        return $this->doPayPalRequest();
45
    }
46
47
    /**
48
     * Delete a Web Experience Profile.
49
     *
50
     * @param string $profile_id
51
     *
52
     * @throws \Throwable
53
     *
54
     * @return array|\Psr\Http\Message\StreamInterface|string
55
     *
56
     * @see https://developer.paypal.com/docs/api/payment-experience/v1/#web-profile_delete
57
     */
58
    public function deleteWebExperienceProfile(string $profile_id)
59
    {
60
        $this->apiEndPoint = "v1/payment-experience/web-profiles/{$profile_id}";
61
62
        $this->verb = 'delete';
63
64
        return $this->doPayPalRequest();
65
    }
66
67
    /**
68
     * Partially update a Web Experience Profile.
69
     *
70
     * @param string $profile_id
71
     * @param array  $data
72
     *
73
     * @throws \Throwable
74
     *
75
     * @return array|\Psr\Http\Message\StreamInterface|string
76
     *
77
     * @see https://developer.paypal.com/docs/api/payment-experience/v1/#web-profile_partial-update
78
     */
79
    public function patchWebExperienceProfile(string $profile_id, array $data)
80
    {
81
        $this->apiEndPoint = "v1/payment-experience/web-profiles/{$profile_id}";
82
83
        $this->options['json'] = $data;
84
85
        $this->verb = 'patch';
86
87
        return $this->doPayPalRequest();
88
    }
89
90
    /**
91
     * Partially update a Web Experience Profile.
92
     *
93
     * @param string $profile_id
94
     * @param array  $data
95
     *
96
     * @throws \Throwable
97
     *
98
     * @return array|\Psr\Http\Message\StreamInterface|string
99
     *
100
     * @see https://developer.paypal.com/docs/api/payment-experience/v1/#web-profile_update
101
     */
102
    public function updateWebExperienceProfile(string $profile_id, array $data)
103
    {
104
        $this->apiEndPoint = "v1/payment-experience/web-profiles/{$profile_id}";
105
106
        $this->options['json'] = $data;
107
108
        $this->verb = 'put';
109
110
        return $this->doPayPalRequest();
111
    }
112
113
    /**
114
     * Delete a Web Experience Profile.
115
     *
116
     * @param string $profile_id
117
     *
118
     * @throws \Throwable
119
     *
120
     * @return array|\Psr\Http\Message\StreamInterface|string
121
     *
122
     * @see https://developer.paypal.com/docs/api/payment-experience/v1/#web-profile_get
123
     */
124
    public function showWebExperienceProfileDetails(string $profile_id)
125
    {
126
        $this->apiEndPoint = "v1/payment-experience/web-profiles/{$profile_id}";
127
128
        $this->verb = 'get';
129
130
        return $this->doPayPalRequest();
131
    }
132
}
133