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\Responses;
4
 
5
use GuzzleHttp\Utils;
6
 
7
trait BillingPlans
8
{
9
    /**
10
     * @return array
11
     */
12
    private function mockCreatePlansResponse(): array
13
    {
14
        return Utils::jsonDecode('{
15
  "id": "P-5ML4271244454362WXNWU5NQ",
16
  "product_id": "PROD-XXCD1234QWER65782",
17
  "name": "Video Streaming Service Plan",
18
  "description": "Video Streaming Service basic plan",
19
  "status": "ACTIVE",
20
  "billing_cycles": [
21
    {
22
      "frequency": {
23
        "interval_unit": "MONTH",
24
        "interval_count": 1
25
      },
26
      "tenure_type": "TRIAL",
27
      "sequence": 1,
28
      "total_cycles": 2,
29
      "pricing_scheme": {
30
        "fixed_price": {
31
          "value": "3",
32
          "currency_code": "USD"
33
        },
34
        "version": 1,
35
        "create_time": "2020-05-27T12:13:51Z",
36
        "update_time": "2020-05-27T12:13:51Z"
37
      }
38
    },
39
    {
40
      "frequency": {
41
        "interval_unit": "MONTH",
42
        "interval_count": 1
43
      },
44
      "tenure_type": "TRIAL",
45
      "sequence": 2,
46
      "total_cycles": 3,
47
      "pricing_scheme": {
48
        "fixed_price": {
49
          "currency_code": "USD",
50
          "value": "6"
51
        },
52
        "version": 1,
53
        "create_time": "2020-05-27T12:13:51Z",
54
        "update_time": "2020-05-27T12:13:51Z"
55
      }
56
    },
57
    {
58
      "frequency": {
59
        "interval_unit": "MONTH",
60
        "interval_count": 1
61
      },
62
      "tenure_type": "REGULAR",
63
      "sequence": 3,
64
      "total_cycles": 12,
65
      "pricing_scheme": {
66
        "fixed_price": {
67
          "currency_code": "USD",
68
          "value": "10"
69
        },
70
        "version": 1,
71
        "create_time": "2020-05-27T12:13:51Z",
72
        "update_time": "2020-05-27T12:13:51Z"
73
      }
74
    }
75
  ],
76
  "payment_preferences": {
77
    "auto_bill_outstanding": true,
78
    "setup_fee": {
79
      "value": "10",
80
      "currency_code": "USD"
81
    },
82
    "setup_fee_failure_action": "CONTINUE",
83
    "payment_failure_threshold": 3
84
  },
85
  "taxes": {
86
    "percentage": "10",
87
    "inclusive": false
88
  },
89
  "create_time": "2020-05-27T12:13:51Z",
90
  "update_time": "2020-05-27T12:13:51Z",
91
  "links": [
92
    {
93
      "href": "https://api.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ",
94
      "rel": "self",
95
      "method": "GET"
96
    },
97
    {
98
      "href": "https://api.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ",
99
      "rel": "edit",
100
      "method": "PATCH"
101
    },
102
    {
103
      "href": "https://api.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ/deactivate",
104
      "rel": "deactivate",
105
      "method": "POST"
106
    },
107
    {
108
      "href": "https://api.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ/update-pricing-schemes",
109
      "rel": "edit",
110
      "method": "POST"
111
    }
112
  ]
113
}', true);
114
    }
115
 
116
    /**
117
     * @return array
118
     */
119
    private function mockListPlansResponse(): array
120
    {
121
        return Utils::jsonDecode('{
122
  "total_items": 12,
123
  "total_pages": 6,
124
  "plans": [
125
    {
126
      "id": "P-5ML4271244454362WXNWU5NQ",
127
      "product_id": "PROD-XXCD1234QWER65782",
128
      "status": "ACTIVE",
129
      "name": "Zoho Marketing Campaign  Plan",
130
      "description": "Zoho Marketing Campaign Plan",
131
      "create_time": "2018-12-10T21:20:49Z",
132
      "links": [
133
        {
134
          "href": "https://api.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ",
135
          "rel": "self",
136
          "method": "GET"
137
        }
138
      ]
139
    },
140
    {
141
      "id": "P-6LL4271454454362WXNWU5NQ",
142
      "product_id": "PROD-XXCD1234QWER65782",
143
      "status": "ACTIVE",
144
      "name": "Zoho Marketing Campaign Basic Plan",
145
      "description": "Zoho Marketing Campaign Plan",
146
      "create_time": "2019-01-10T21:20:49Z",
147
      "links": [
148
        {
149
          "href": "https://api.paypal.com/v1/billing/plans/P-6LL4271454454362WXNWU5NQ",
150
          "rel": "self",
151
          "method": "GET"
152
        }
153
      ]
154
    }
155
  ],
156
  "links": [
157
    {
158
      "href": "https://api.paypal.com/v1/billing/plans?product_id=PROD-XXCD1234QWER65782&page_size=2&page=1",
159
      "rel": "self",
160
      "method": "GET"
161
    },
162
    {
163
      "href": "https://api.paypal.com/v1/billing/plans?product_id=PROD-XXCD1234QWER65782&page_size=2&page=1",
164
      "rel": "first",
165
      "method": "GET"
166
    },
167
    {
168
      "href": "https://api.paypal.com/v1/billing/plans?product_id=PROD-XXCD1234QWER65782&page_size=2&page=2",
169
      "rel": "next",
170
      "method": "GET"
171
    },
172
    {
173
      "href": "https://api.paypal.com/v1/billing/plans?product_id=PROD-XXCD1234QWER65782&page_size=2&page=6",
174
      "rel": "last",
175
      "method": "GET"
176
    }
177
  ]
178
}', true);
179
    }
180
 
181
    /**
182
     * @return array
183
     */
184
    private function mockGetPlansResponse(): array
185
    {
186
        return Utils::jsonDecode('{
187
  "id": "P-5ML4271244454362WXNWU5NQ",
188
  "product_id": "PROD-XXCD1234QWER65782",
189
  "name": "Basic Plan",
190
  "description": "Basic Plan",
191
  "status": "ACTIVE",
192
  "billing_cycles": [
193
    {
194
      "frequency": {
195
        "interval_unit": "MONTH",
196
        "interval_count": 1
197
      },
198
      "tenure_type": "TRIAL",
199
      "sequence": 1,
200
      "total_cycles": 2,
201
      "pricing_scheme": {
202
        "fixed_price": {
203
          "currency_code": "USD",
204
          "value": "3"
205
        },
206
        "version": 1,
207
        "create_time": "2020-05-27T12:13:51Z",
208
        "update_time": "2020-05-27T12:13:51Z"
209
      }
210
    },
211
    {
212
      "frequency": {
213
        "interval_unit": "MONTH",
214
        "interval_count": 1
215
      },
216
      "tenure_type": "TRIAL",
217
      "sequence": 2,
218
      "total_cycles": 3,
219
      "pricing_scheme": {
220
        "fixed_price": {
221
          "currency_code": "USD",
222
          "value": "6"
223
        },
224
        "version": 1,
225
        "create_time": "2020-05-27T12:13:51Z",
226
        "update_time": "2020-05-27T12:13:51Z"
227
      }
228
    },
229
    {
230
      "frequency": {
231
        "interval_unit": "MONTH",
232
        "interval_count": 1
233
      },
234
      "tenure_type": "REGULAR",
235
      "sequence": 3,
236
      "total_cycles": 12,
237
      "pricing_scheme": {
238
        "fixed_price": {
239
          "value": "10",
240
          "currency_code": "USD"
241
        },
242
        "status": "ACTIVE",
243
        "version": 1,
244
        "create_time": "2020-05-27T12:13:51Z",
245
        "update_time": "2020-05-27T12:13:51Z"
246
      }
247
    }
248
  ],
249
  "taxes": {
250
    "percentage": "10",
251
    "inclusive": false
252
  },
253
  "create_time": "2020-05-27T12:13:51Z",
254
  "update_time": "2020-05-27T12:13:51Z",
255
  "links": [
256
    {
257
      "href": "https://api.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ",
258
      "rel": "self",
259
      "method": "GET"
260
    },
261
    {
262
      "href": "https://api.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ",
263
      "rel": "edit",
264
      "method": "PATCH"
265
    },
266
    {
267
      "href": "https://api.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ/deactivate",
268
      "rel": "deactivate",
269
      "method": "POST"
270
    },
271
    {
272
      "href": "https://api.paypal.com/v1/billing/plans/P-5ML4271244454362WXNWU5NQ/update-pricing-schemes",
273
      "rel": "edit",
274
      "method": "POST"
275
    }
276
  ]
277
}', true);
278
    }
279
}