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 Invoices
8
{
9
    /**
10
     * @return array
11
     */
12
    private function createInvoiceParams(): array
13
    {
14
        return Utils::jsonDecode('{
15
  "detail": {
16
    "invoice_number": "#123",
17
    "reference": "deal-ref",
18
    "invoice_date": "2018-11-12",
19
    "currency_code": "USD",
20
    "note": "Thank you for your business.",
21
    "term": "No refunds after 30 days.",
22
    "memo": "This is a long contract",
23
    "payment_term": {
24
      "term_type": "NET_10",
25
      "due_date": "2018-11-22"
26
    }
27
  },
28
  "invoicer": {
29
    "name": {
30
      "given_name": "David",
31
      "surname": "Larusso"
32
    },
33
    "address": {
34
      "address_line_1": "1234 First Street",
35
      "address_line_2": "337673 Hillside Court",
36
      "admin_area_2": "Anytown",
37
      "admin_area_1": "CA",
38
      "postal_code": "98765",
39
      "country_code": "US"
40
    },
41
    "email_address": "merchant@example.com",
42
    "phones": [
43
      {
44
        "country_code": "001",
45
        "national_number": "4085551234",
46
        "phone_type": "MOBILE"
47
      }
48
    ],
49
    "website": "www.test.com",
50
    "tax_id": "ABcNkWSfb5ICTt73nD3QON1fnnpgNKBy- Jb5SeuGj185MNNw6g",
51
    "logo_url": "https://example.com/logo.PNG",
52
    "additional_notes": "2-4"
53
  },
54
  "primary_recipients": [
55
    {
56
      "billing_info": {
57
        "name": {
58
          "given_name": "Stephanie",
59
          "surname": "Meyers"
60
        },
61
        "address": {
62
          "address_line_1": "1234 Main Street",
63
          "admin_area_2": "Anytown",
64
          "admin_area_1": "CA",
65
          "postal_code": "98765",
66
          "country_code": "US"
67
        },
68
        "email_address": "bill-me@example.com",
69
        "phones": [
70
          {
71
            "country_code": "001",
72
            "national_number": "4884551234",
73
            "phone_type": "HOME"
74
          }
75
        ],
76
        "additional_info_value": "add-info"
77
      },
78
      "shipping_info": {
79
        "name": {
80
          "given_name": "Stephanie",
81
          "surname": "Meyers"
82
        },
83
        "address": {
84
          "address_line_1": "1234 Main Street",
85
          "admin_area_2": "Anytown",
86
          "admin_area_1": "CA",
87
          "postal_code": "98765",
88
          "country_code": "US"
89
        }
90
      }
91
    }
92
  ],
93
  "items": [
94
    {
95
      "name": "Yoga Mat",
96
      "description": "Elastic mat to practice yoga.",
97
      "quantity": "1",
98
      "unit_amount": {
99
        "currency_code": "USD",
100
        "value": "50.00"
101
      },
102
      "tax": {
103
        "name": "Sales Tax",
104
        "percent": "7.25"
105
      },
106
      "discount": {
107
        "percent": "5"
108
      },
109
      "unit_of_measure": "QUANTITY"
110
    },
111
    {
112
      "name": "Yoga t-shirt",
113
      "quantity": "1",
114
      "unit_amount": {
115
        "currency_code": "USD",
116
        "value": "10.00"
117
      },
118
      "tax": {
119
        "name": "Sales Tax",
120
        "percent": "7.25"
121
      },
122
      "discount": {
123
        "amount": {
124
          "currency_code": "USD",
125
          "value": "5.00"
126
        }
127
      },
128
      "unit_of_measure": "QUANTITY"
129
    }
130
  ],
131
  "configuration": {
132
    "partial_payment": {
133
      "allow_partial_payment": true,
134
      "minimum_amount_due": {
135
        "currency_code": "USD",
136
        "value": "20.00"
137
      }
138
    },
139
    "allow_tip": true,
140
    "tax_calculated_after_discount": true,
141
    "tax_inclusive": false,
142
    "template_id": "TEMP-19V05281TU309413B"
143
  },
144
  "amount": {
145
    "breakdown": {
146
      "custom": {
147
        "label": "Packing Charges",
148
        "amount": {
149
          "currency_code": "USD",
150
          "value": "10.00"
151
        }
152
      },
153
      "shipping": {
154
        "amount": {
155
          "currency_code": "USD",
156
          "value": "10.00"
157
        },
158
        "tax": {
159
          "name": "Sales Tax",
160
          "percent": "7.25"
161
        }
162
      },
163
      "discount": {
164
        "invoice_discount": {
165
          "percent": "5"
166
        }
167
      }
168
    }
169
  }
170
}', true);
171
    }
172
 
173
    /**
174
     * @return array
175
     */
176
    private function updateInvoiceParams(): array
177
    {
178
        return Utils::jsonDecode('{
179
  "id": "INV2-C82X-JNN9-Y6S5-CNXW",
180
  "status": "DRAFT",
181
  "detail": {
182
    "invoice_number": "#123",
183
    "reference": "deal-refernce-update",
184
    "invoice_date": "2018-11-12",
185
    "currency_code": "USD",
186
    "note": "Thank you for your business.",
187
    "term": "No refunds after 30 days.",
188
    "memo": "This is a long contract",
189
    "payment_term": {
190
      "term_type": "NET_10",
191
      "due_date": "2018-11-22"
192
    }
193
  },
194
  "invoicer": {
195
    "name": {
196
      "given_name": "David",
197
      "surname": "Larusso"
198
    },
199
    "address": {
200
      "address_line_1": "1234 First Street",
201
      "address_line_2": "337673 Hillside Court",
202
      "admin_area_2": "Anytown",
203
      "admin_area_1": "CA",
204
      "postal_code": "98765",
205
      "country_code": "US"
206
    },
207
    "email_address": "merchant@example.com",
208
    "phones": [
209
      {
210
        "country_code": "001",
211
        "national_number": "4085551234",
212
        "phone_type": "MOBILE"
213
      }
214
    ],
215
    "website": "www.test.com",
216
    "tax_id": "ABcNkWSfb5ICTt73nD3QON1fnnpgNKBy-Jb5SeuGj185MNNw6g",
217
    "logo_url": "https://example.com/logo.PNG",
218
    "additional_notes": "2-4"
219
  },
220
  "primary_recipients": [
221
    {
222
      "billing_info": {
223
        "name": {
224
          "given_name": "Stephanie",
225
          "surname": "Meyers"
226
        },
227
        "address": {
228
          "address_line_1": "1234 Main Street",
229
          "admin_area_2": "Anytown",
230
          "admin_area_1": "CA",
231
          "postal_code": "98765",
232
          "country_code": "US"
233
        },
234
        "email_address": "bill-me@example.com",
235
        "phones": [
236
          {
237
            "country_code": "001",
238
            "national_number": "4884551234",
239
            "phone_type": "HOME"
240
          }
241
        ],
242
        "additional_info_value": "add-info"
243
      },
244
      "shipping_info": {
245
        "name": {
246
          "given_name": "Stephanie",
247
          "surname": "Meyers"
248
        },
249
        "address": {
250
          "address_line_1": "1234 Main Street",
251
          "admin_area_2": "Anytown",
252
          "admin_area_1": "CA",
253
          "postal_code": "98765",
254
          "country_code": "US"
255
        }
256
      }
257
    }
258
  ],
259
  "items": [
260
    {
261
      "name": "Yoga Mat",
262
      "description": "Elastic mat to practice yoga.",
263
      "quantity": "1",
264
      "unit_amount": {
265
        "currency_code": "USD",
266
        "value": "50.00"
267
      },
268
      "tax": {
269
        "name": "Sales Tax",
270
        "percent": "7.25",
271
        "amount": {
272
          "currency_code": "USD",
273
          "value": "3.27"
274
        }
275
      },
276
      "discount": {
277
        "percent": "5",
278
        "amount": {
279
          "currency_code": "USD",
280
          "value": "2.5"
281
        }
282
      },
283
      "unit_of_measure": "QUANTITY"
284
    },
285
    {
286
      "name": "Yoga t-shirt",
287
      "quantity": "1",
288
      "unit_amount": {
289
        "currency_code": "USD",
290
        "value": "10.00"
291
      },
292
      "tax": {
293
        "name": "Sales Tax",
294
        "percent": "7.25",
295
        "amount": {
296
          "currency_code": "USD",
297
          "value": "0.34"
298
        }
299
      },
300
      "discount": {
301
        "amount": {
302
          "currency_code": "USD",
303
          "value": "5.00"
304
        }
305
      },
306
      "unit_of_measure": "QUANTITY"
307
    }
308
  ],
309
  "configuration": {
310
    "partial_payment": {
311
      "allow_partial_payment": true,
312
      "minimum_amount_due": {
313
        "currency_code": "USD",
314
        "value": "20.00"
315
      }
316
    },
317
    "allow_tip": true,
318
    "tax_calculated_after_discount": true,
319
    "tax_inclusive": false,
320
    "template_id": "TEMP-19V05281TU309413B"
321
  },
322
  "amount": {
323
    "currency_code": "USD",
324
    "value": "74.21",
325
    "breakdown": {
326
      "item_total": {
327
        "currency_code": "USD",
328
        "value": "60.00"
329
      },
330
      "custom": {
331
        "label": "Packing Charges",
332
        "amount": {
333
          "currency_code": "USD",
334
          "value": "10.00"
335
        }
336
      },
337
      "shipping": {
338
        "amount": {
339
          "currency_code": "USD",
340
          "value": "10.00"
341
        },
342
        "tax": {
343
          "name": "Sales Tax",
344
          "percent": "7.25",
345
          "amount": {
346
            "currency_code": "USD",
347
            "value": "0.73"
348
          }
349
        }
350
      },
351
      "discount": {
352
        "item_discount": {
353
          "currency_code": "USD",
354
          "value": "-7.50"
355
        },
356
        "invoice_discount": {
357
          "percent": "5",
358
          "amount": {
359
            "currency_code": "USD",
360
            "value": "-2.63"
361
          }
362
        }
363
      },
364
      "tax_total": {
365
        "currency_code": "USD",
366
        "value": "4.34"
367
      }
368
    }
369
  }
370
}', true);
371
    }
372
 
373
    /**
374
     * @return array
375
     */
376
    private function cancelInvoiceParams(): array
377
    {
378
        return Utils::jsonDecode('{
379
  "subject": "Invoice Cancelled",
380
  "note": "Cancelling the invoice",
381
  "send_to_invoicer": true,
382
  "send_to_recipient": true,
383
  "additional_recipients": [
384
    "user@example.com"
385
  ]
386
}', true);
387
    }
388
 
389
    /**
390
     * @return array
391
     */
392
    private function generateQRCodeInvoiceParams(): array
393
    {
394
        return Utils::jsonDecode('{
395
  "width": 400,
396
  "height": 400
397
}', true);
398
    }
399
 
400
    /**
401
     * @return array
402
     */
403
    private function registerInvoicePaymentParams(): array
404
    {
405
        return Utils::jsonDecode('{
406
  "width": 400,
407
  "height": 400
408
}', true);
409
    }
410
 
411
    /**
412
     * @return array
413
     */
414
    private function refundInvoicePaymentParams(): array
415
    {
416
        return Utils::jsonDecode('{
417
  "method": "BANK_TRANSFER",
418
  "refund_date": "2018-05-21",
419
  "amount": {
420
    "currency_code": "USD",
421
    "value": "5.00"
422
  }
423
}', true);
424
    }
425
 
426
    /**
427
     * @return array
428
     */
429
    private function sendInvoiceParams(): array
430
    {
431
        return Utils::jsonDecode('{
432
  "subject": "Payment due for the invoice #ABC-123",
433
  "note": "Please pay before the due date to avoid incurring late payment charges which will be adjusted in the next bill generated.",
434
  "send_to_invoicer": true,
435
  "additional_recipients": [
436
    "customer-a@example.com",
437
    "customer@example.com"
438
  ]
439
}', true);
440
    }
441
 
442
    /**
443
     * @return array
444
     */
445
    private function sendInvoiceReminderParams(): array
446
    {
447
        return Utils::jsonDecode('{
448
  "subject": "Reminder: Payment due for the invoice #ABC-123",
449
  "note": "Please pay before the due date to avoid incurring late payment charges which will be adjusted in the next bill generated.",
450
  "send_to_invoicer": true,
451
  "additional_recipients": [
452
    "customer-a@example.com",
453
    "customer@example.com"
454
  ]
455
}', true);
456
    }
457
}