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

Identity::setAccountProperties()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 12
rs 10
1
<?php
2
3
namespace Srmklive\PayPal\Traits\PayPalAPI;
4
5
trait Identity
6
{
7
    /**
8
     * Get user profile information.
9
     *
10
     * @throws \Throwable
11
     *
12
     * @return array|\Psr\Http\Message\StreamInterface|string
13
     *
14
     * @see https://developer.paypal.com/docs/api/identity/v1/#userinfo_get
15
     */
16
    public function showProfileInfo()
17
    {
18
        $this->apiEndPoint = 'v1/identity/oauth2/userinfo?schema=paypalv1.1';
19
20
        $this->verb = 'get';
21
22
        return $this->doPayPalRequest();
23
    }
24
25
    /**
26
     * Create a merchant application.
27
     *
28
     * @param string $client_name
29
     * @param array  $redirect_uris
30
     * @param array  $contacts
31
     * @param string $payer_id
32
     * @param string $migrated_app
33
     * @param string $application_type
34
     * @param string $logo_url
35
     *
36
     * @throws \Throwable
37
     *
38
     * @return array|\Psr\Http\Message\StreamInterface|string
39
     *
40
     * @see https://developer.paypal.com/docs/api/identity/v1/#applications_post
41
     */
42
    public function createMerchantApplication($client_name, array $redirect_uris, array $contacts, $payer_id, $migrated_app, $application_type = 'web', $logo_url = '')
0 ignored issues
show
Unused Code introduced by
The parameter $logo_url is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

42
    public function createMerchantApplication($client_name, array $redirect_uris, array $contacts, $payer_id, $migrated_app, $application_type = 'web', /** @scrutinizer ignore-unused */ $logo_url = '')

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
43
    {
44
        $this->apiEndPoint = 'v1/identity/applications';
45
46
        $this->options['json'] = [
47
            'application_type'  => $application_type,
48
            'redirect_uris'     => $redirect_uris,
49
            'client_name'       => $client_name,
50
            'contacts'          => $contacts,
51
            'payer_id'          => $payer_id,
52
            'migrated_app'      => $migrated_app,
53
        ];
54
55
        $this->verb = 'post';
56
57
        return $this->doPayPalRequest();
58
    }
59
60
    /**
61
     * Create a merchant application.
62
     *
63
     * @param array  $features
64
     * @param string $account_property
65
     *
66
     * @throws \Throwable
67
     *
68
     * @return array|\Psr\Http\Message\StreamInterface|string
69
     *
70
     * @see https://developer.paypal.com/docs/api/identity/v1/#account-settings_post
71
     */
72
    public function setAccountProperties(array $features, $account_property = 'BRAINTREE_MERCHANT')
73
    {
74
        $this->apiEndPoint = 'v1/identity/account-settings';
75
76
        $this->options['json'] = [
77
            'account_property'  => $account_property,
78
            'features'          => $features,
79
        ];
80
81
        $this->verb = 'post';
82
83
        return $this->doPayPalRequest();
84
    }
85
86
    /**
87
     * Create a merchant application.
88
     *
89
     * @param string $account_property
90
     *
91
     * @throws \Throwable
92
     *
93
     * @return array|\Psr\Http\Message\StreamInterface|string
94
     *
95
     * @see https://developer.paypal.com/docs/api/identity/v1/#account-settings_deactivate
96
     */
97
    public function disableAccountProperties($account_property = 'BRAINTREE_MERCHANT')
98
    {
99
        $this->apiEndPoint = 'v1/identity/account-settings/deactivate';
100
101
        $this->options['json'] = [
102
            'account_property'  => $account_property,
103
        ];
104
105
        $this->verb = 'post';
106
107
        return $this->doPayPalRequest();
108
    }
109
}
110