Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
676 lars 1
<?php
2
 
3
namespace Srmklive\PayPal\Tests\Mocks\Requests;
4
 
5
use GuzzleHttp\Utils;
6
 
7
trait Subscriptions
8
{
9
    /**
10
     * @return array
11
     */
12
    private function mockCreateSubscriptionParams(): array
13
    {
14
        return Utils::jsonDecode('{
15
  "plan_id": "P-5ML4271244454362WXNWU5NQ",
16
  "start_time": "2018-11-01T00:00:00Z",
17
  "quantity": "20",
18
  "shipping_amount": {
19
    "currency_code": "USD",
20
    "value": "10.00"
21
  },
22
  "subscriber": {
23
    "name": {
24
      "given_name": "John",
25
      "surname": "Doe"
26
    },
27
    "email_address": "customer@example.com",
28
    "shipping_address": {
29
      "name": {
30
        "full_name": "John Doe"
31
      },
32
      "address": {
33
        "address_line_1": "2211 N First Street",
34
        "address_line_2": "Building 17",
35
        "admin_area_2": "San Jose",
36
        "admin_area_1": "CA",
37
        "postal_code": "95131",
38
        "country_code": "US"
39
      }
40
    }
41
  },
42
  "application_context": {
43
    "brand_name": "walmart",
44
    "locale": "en-US",
45
    "shipping_preference": "SET_PROVIDED_ADDRESS",
46
    "user_action": "SUBSCRIBE_NOW",
47
    "payment_method": {
48
      "payer_selected": "PAYPAL",
49
      "payee_preferred": "IMMEDIATE_PAYMENT_REQUIRED"
50
    },
51
    "return_url": "https://example.com/returnUrl",
52
    "cancel_url": "https://example.com/cancelUrl"
53
  }
54
}', true);
55
    }
56
 
57
    /**
58
     * @return array
59
     */
60
    private function mockUpdateSubscriptionParams(): array
61
    {
62
        return Utils::jsonDecode('[
63
  {
64
    "op": "replace",
65
    "path": "/billing_info/outstanding_balance",
66
    "value": {
67
      "currency_code": "USD",
68
      "value": "50.00"
69
    }
70
  }
71
]', true);
72
    }
73
 
74
    /**
75
     * @return array
76
     */
77
    private function mockActivateSubscriptionParams()
78
    {
79
        return Utils::jsonDecode('{
80
  "reason": "Reactivating the subscription"
81
}', true);
82
    }
83
 
84
    /**
85
     * @return array
86
     */
87
    private function mockCancelSubscriptionParams()
88
    {
89
        return Utils::jsonDecode('{
90
  "reason": "Not satisfied with the service"
91
}', true);
92
    }
93
 
94
    /**
95
     * @return array
96
     */
97
    private function mockSuspendSubscriptionParams()
98
    {
99
        return Utils::jsonDecode('{
100
  "reason": "Item out of stock"
101
}', true);
102
    }
103
 
104
    /**
105
     * @return array
106
     */
107
    private function mockCaptureSubscriptionPaymentParams()
108
    {
109
        return Utils::jsonDecode('{
110
  "note": "Charging as the balance reached the limit",
111
  "capture_type": "OUTSTANDING_BALANCE",
112
  "amount": {
113
    "currency_code": "USD",
114
    "value": "100"
115
  }
116
}', true);
117
    }
118
 
119
    /**
120
     * @return array
121
     */
122
    private function mockUpdateSubscriptionItemsParams()
123
    {
124
        return Utils::jsonDecode('{
125
  "plan_id": "P-5ML4271244454362WXNWU5NQ",
126
  "shipping_amount": {
127
    "currency_code": "USD",
128
    "value": "10.00"
129
  },
130
  "shipping_address": {
131
    "name": {
132
      "full_name": "John Doe"
133
    },
134
    "address": {
135
      "address_line_1": "2211 N First Street",
136
      "address_line_2": "Building 17",
137
      "admin_area_2": "San Jose",
138
      "admin_area_1": "CA",
139
      "postal_code": "95131",
140
      "country_code": "US"
141
    }
142
  },
143
  "application_context": {
144
    "brand_name": "walmart",
145
    "locale": "en-US",
146
    "shipping_preference": "SET_PROVIDED_ADDRESS",
147
    "payment_method": {
148
      "payer_selected": "PAYPAL",
149
      "payee_preferred": "IMMEDIATE_PAYMENT_REQUIRED"
150
    },
151
    "return_url": "https://example.com/returnUrl",
152
    "cancel_url": "https://example.com/cancelUrl"
153
  }
154
}', true);
155
    }
156
}