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 Subscriptions
8
{
9
    /**
10
     * @return array
11
     */
12
    private function mockCreateSubscriptionResponse(): array
13
    {
14
        return Utils::jsonDecode('{
15
  "id": "I-BW452GLLEP1G",
16
  "status": "APPROVAL_PENDING",
17
  "status_update_time": "2018-12-10T21:20:49Z",
18
  "plan_id": "P-5ML4271244454362WXNWU5NQ",
19
  "start_time": "2018-11-01T00:00:00Z",
20
  "quantity": "20",
21
  "shipping_amount": {
22
    "currency_code": "USD",
23
    "value": "10.00"
24
  },
25
  "subscriber": {
26
    "name": {
27
      "given_name": "John",
28
      "surname": "Doe"
29
    },
30
    "email_address": "customer@example.com",
31
    "payer_id": "2J6QB8YJQSJRJ",
32
    "shipping_address": {
33
      "name": {
34
        "full_name": "John Doe"
35
      },
36
      "address": {
37
        "address_line_1": "2211 N First Street",
38
        "address_line_2": "Building 17",
39
        "admin_area_2": "San Jose",
40
        "admin_area_1": "CA",
41
        "postal_code": "95131",
42
        "country_code": "US"
43
      }
44
    }
45
  },
46
  "create_time": "2018-12-10T21:20:49Z",
47
  "links": [
48
    {
49
      "href": "https://www.paypal.com/webapps/billing/subscriptions?ba_token=BA-2M539689T3856352J",
50
      "rel": "approve",
51
      "method": "GET"
52
    },
53
    {
54
      "href": "https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G",
55
      "rel": "edit",
56
      "method": "PATCH"
57
    },
58
    {
59
      "href": "https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G",
60
      "rel": "self",
61
      "method": "GET"
62
    }
63
  ]
64
}', true);
65
    }
66
 
67
    /**
68
     * @return array
69
     */
70
    private function mockGetSubscriptionDetailsResponse(): array
71
    {
72
        return Utils::jsonDecode('{
73
  "id": "I-BW452GLLEP1G",
74
  "plan_id": "P-5ML4271244454362WXNWU5NQ",
75
  "start_time": "2019-04-10T07:00:00Z",
76
  "quantity": "20",
77
  "shipping_amount": {
78
    "currency_code": "USD",
79
    "value": "10.0"
80
  },
81
  "subscriber": {
82
    "shipping_address": {
83
      "name": {
84
        "full_name": "John Doe"
85
      },
86
      "address": {
87
        "address_line_1": "2211 N First Street",
88
        "address_line_2": "Building 17",
89
        "admin_area_2": "San Jose",
90
        "admin_area_1": "CA",
91
        "postal_code": "95131",
92
        "country_code": "US"
93
      }
94
    },
95
    "name": {
96
      "given_name": "John",
97
      "surname": "Doe"
98
    },
99
    "email_address": "customer@example.com",
100
    "payer_id": "2J6QB8YJQSJRJ"
101
  },
102
  "billing_info": {
103
    "outstanding_balance": {
104
      "currency_code": "USD",
105
      "value": "1.0"
106
    },
107
    "cycle_executions": [
108
      {
109
        "tenure_type": "TRIAL",
110
        "sequence": 1,
111
        "cycles_completed": 0,
112
        "cycles_remaining": 2,
113
        "total_cycles": 2
114
      },
115
      {
116
        "tenure_type": "TRIAL",
117
        "sequence": 2,
118
        "cycles_completed": 0,
119
        "cycles_remaining": 3,
120
        "total_cycles": 3
121
      },
122
      {
123
        "tenure_type": "REGULAR",
124
        "sequence": 3,
125
        "cycles_completed": 0,
126
        "cycles_remaining": 12,
127
        "total_cycles": 12
128
      }
129
    ],
130
    "last_payment": {
131
      "amount": {
132
        "currency_code": "USD",
133
        "value": "1.15"
134
      },
135
      "time": "2019-04-09T10:27:20Z"
136
    },
137
    "next_billing_time": "2019-04-10T10:00:00Z",
138
    "failed_payments_count": 0
139
  },
140
  "create_time": "2019-04-09T10:26:04Z",
141
  "update_time": "2019-04-09T10:27:27Z",
142
  "links": [
143
    {
144
      "href": "https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G/cancel",
145
      "rel": "cancel",
146
      "method": "POST"
147
    },
148
    {
149
      "href": "https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G",
150
      "rel": "edit",
151
      "method": "PATCH"
152
    },
153
    {
154
      "href": "https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G",
155
      "rel": "self",
156
      "method": "GET"
157
    },
158
    {
159
      "href": "https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G/suspend",
160
      "rel": "suspend",
161
      "method": "POST"
162
    },
163
    {
164
      "href": "https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G/capture",
165
      "rel": "capture",
166
      "method": "POST"
167
    }
168
  ],
169
  "status": "ACTIVE",
170
  "status_update_time": "2019-04-09T10:27:27Z"
171
}', true);
172
    }
173
 
174
    /**
175
     * @return array
176
     */
177
    private function mockUpdateSubscriptionItemsResponse(): array
178
    {
179
        return Utils::jsonDecode('{
180
  "plan_id": "P-5ML4271244454362WXNWU5NQ",
181
  "effective_time": "2018-11-01T00:00:00Z",
182
  "shipping_amount": {
183
    "currency_code": "USD",
184
    "value": "10.00"
185
  },
186
  "shipping_address": {
187
    "name": {
188
      "full_name": "John Doe"
189
    },
190
    "address": {
191
      "address_line_1": "2211 N First Street",
192
      "address_line_2": "Building 17",
193
      "admin_area_2": "San Jose",
194
      "admin_area_1": "CA",
195
      "postal_code": "95131",
196
      "country_code": "US"
197
    }
198
  },
199
  "links": [
200
    {
201
      "href": "https://www.paypal.com/webapps/billing/subscriptions/update?ba_token=BA-2M539689T3856352J",
202
      "rel": "approve",
203
      "method": "GET"
204
    }
205
  ]
206
}', true);
207
    }
208
 
209
    /**
210
     * @return array
211
     */
212
    private function mockListSubscriptionTransactionsResponse(): array
213
    {
214
        return Utils::jsonDecode('{
215
  "transactions": [
216
    {
217
      "id": "TRFGHNJKOIIOJKL",
218
      "status": "COMPLETED",
219
      "payer_email": "customer@example.com",
220
      "payer_name": {
221
        "given_name": "John",
222
        "surname": "Doe"
223
      },
224
      "amount_with_breakdown": {
225
        "gross_amount": {
226
          "currency_code": "USD",
227
          "value": "10.00"
228
        },
229
        "fee_amount": {
230
          "currency_code": "USD",
231
          "value": "1.00"
232
        },
233
        "net_amount": {
234
          "currency_code": "USD",
235
          "value": "9.00"
236
        }
237
      },
238
      "time": "2018-03-16T07:40:20.940Z"
239
    },
240
    {
241
      "id": "VDFG45345FFGS",
242
      "status": "COMPLETED",
243
      "payer_email": "customer2@example.com",
244
      "payer_name": {
245
        "given_name": "Jhonny",
246
        "surname": "Cat"
247
      },
248
      "amount_with_breakdown": {
249
        "gross_amount": {
250
          "currency_code": "USD",
251
          "value": "15.00"
252
        },
253
        "fee_amount": {
254
          "currency_code": "USD",
255
          "value": "1.00"
256
        },
257
        "net_amount": {
258
          "currency_code": "USD",
259
          "value": "14.00"
260
        }
261
      },
262
      "time": "2018-08-21T07:50:20.940Z"
263
    }
264
  ],
265
  "links": [
266
    {
267
      "href": "https://api.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G/transactions?start_time=2018-01-21T07:50:20.940Z&end_time=2018-08-21T07:50:20.940Z",
268
      "rel": "self",
269
      "method": "GET"
270
    }
271
  ]
272
}', true);
273
    }
274
}