-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathOrder System.postman_collection.json
1346 lines (1346 loc) · 40.4 KB
/
Order System.postman_collection.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"info": {
"_postman_id": "a41dc98d-629c-4062-9bd2-3445336ca33e",
"name": "Order System",
"description": "The Order System is a microservice that handles ordering merchandise from an e-commerce web app. It stores the order history of a user, integrates with third-party payment providers such as PayPal and Stripe, and stores custom account information.\n\nThis microservice is designed to be integrated with other services that handle things such as the product catalog to create a whole e-commerce platform.\n\n- **Note:** Although some requests are documented with the `application/x-www-form-urlencoded` type, they also support `application/json`.",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Orders",
"item": [
{
"name": "Create Order",
"event": [
{
"listen": "test",
"script": {
"id": "9a4d9b89-1d96-4e31-8a11-29f22f67fe02",
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"Set `order` environment variable\", function () {",
" var json = pm.response.json();",
" pm.environment.set(\"order\", json.id);",
"});",
"",
"pm.test(\"Set `jwt_token` environment variable\", function () {",
" var json = pm.response.json();",
" pm.environment.set(\"jwt_token\", json.authToken);",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "noauth"
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"addresses\": {\n\t\t\"billing\": {\n\t\t\t\"street\": \"156 Plumberry Ln.\",\n\t\t\t\"zip\": \"15620\",\n\t\t\t\"city\": \"Cidersville\",\n\t\t\t\"country\": \"Notherling\"\n\t\t}\n\t},\n\t\"items\": [\n\t\t{\n\t\t\t\"productID\": 1,\n\t\t\t\"quantity\": 4\n\t\t}\t\n\t]\n}"
},
"url": {
"raw": "http://localhost:8082/v1/orders",
"protocol": "http",
"host": [
"localhost"
],
"port": "8082",
"path": [
"v1",
"orders"
]
},
"description": "Creates a new order that a customer can pay for. The new order contains information such as the items in the order, the customer's billing address, and their shipping address.\n\nAlthough this route does not require authentication, a token can be passed in and the `email` and `id` values in the payload will be used to identify the order. Otherwise, it will be considered a guest order."
},
"response": [
{
"name": "Create Order",
"originalRequest": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"addresses\": {\n\t\t\"billing\": {\n\t\t\t\"street\": \"156 Plumberry Ln.\",\n\t\t\t\"zip\": \"15620\",\n\t\t\t\"city\": \"Cidersville\",\n\t\t\t\"country\": \"Notherling\"\n\t\t}\n\t},\n\t\"items\": [\n\t\t{\n\t\t\t\"productID\": 1,\n\t\t\t\"quantity\": 4,\n\t\t\t\"taxRate\": 7.42\n\t\t}\t\n\t]\n}"
},
"url": {
"raw": "http://localhost:8080/v1/orders",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"v1",
"orders"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "content-type",
"value": "application/json; charset=utf-8"
},
{
"key": "content-length",
"value": "881"
},
{
"key": "date",
"value": "Thu, 01 Nov 2018 20:47:03 GMT"
},
{
"key": "Connection",
"value": "keep-alive"
}
],
"cookie": [],
"body": "{\n \"id\": 11,\n \"userID\": 8225173777548120213,\n \"authToken\": \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImNyaXQiOlsiZXhwIiwiYXVkIl19.eyJleHAiOjY0MDkyMjExMjAwLCJlbWFpbCI6Imp3dC50b2tlbkBleGFtcGxlLmNvbSIsImlkIjo4MjI1MTczNzc3NTQ4MTIwMjEzLCJpYXQiOjE1NDExMDUyMDYuNjQ3MDI4OX0.Az6K6zKTRftnRYtvTgpNzhkEJM1LB_UHMNY1rcaccJLvT2FOD0Bw37nQJp-3m-iep11XEGZ8tYAcBqZT43zAMEL6LuGkaR2P2q_thqvP43rjs9Bcugt3DUXzRj5HuzQOpLubpDb0xcQK1g9TSCWB6kZdkV3ImG3WgXGqjHgzwoqCq0zRRuuYO6ZmSiT6BnQibtmNUYnSW5Sm_keHceGLosP8IcUq6dZC58u8AEdEXRrDKBmrY7snpAvAXAHfS74dfdol36pf6dQCm8wwd4SDsepewvghl77yAQ2Ou1xo90x9x5IenihDfPJhsqSKXZ9-Xrw_MXuqP-dU6BuATCNxHA\",\n \"tax\": 0,\n \"refundedTotal\": 0,\n \"total\": 0,\n \"paidTotal\": 0,\n \"billingAddress\": {\n \"country\": \"Notherling\",\n \"street\": \"156 Plumberry Ln.\",\n \"zip\": \"15620\",\n \"city\": \"Cidersville\"\n },\n \"items\": [\n {\n \"taxRate\": 7.42,\n \"quantity\": 4,\n \"productID\": 1\n }\n ],\n \"guest\": false,\n \"email\": \"jwt.token@example.com\",\n \"status\": 0,\n \"paymentStatus\": 0\n}"
}
]
},
{
"name": "Get Order by ID",
"event": [
{
"listen": "test",
"script": {
"id": "f1700f40-8a13-41ef-8387-97b54d433965",
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"Your test name\", function () {",
" var json = pm.response.json();",
" var id = pm.environment.get(\"order\");",
" pm.expect(json.id).to.eql(id);",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{jwt_token}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "http://localhost:8080/v1/orders/{{order}}",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"v1",
"orders",
"{{order}}"
]
},
"description": "Gets the order for a user with a specific ID. The order's user ID is fetched from the JWT auth token passed in the `Authorization` header."
},
"response": [
{
"name": "Get Order by ID",
"originalRequest": {
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "http://localhost:8080/v1/orders/{{order}}",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"v1",
"orders",
"{{order}}"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "content-type",
"value": "application/json; charset=utf-8"
},
{
"key": "content-length",
"value": "881"
},
{
"key": "date",
"value": "Thu, 01 Nov 2018 20:47:54 GMT"
},
{
"key": "Connection",
"value": "keep-alive"
}
],
"cookie": [],
"body": "{\n \"id\": 11,\n \"userID\": 8225173777548120213,\n \"authToken\": \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImNyaXQiOlsiZXhwIiwiYXVkIl19.eyJleHAiOjY0MDkyMjExMjAwLCJlbWFpbCI6Imp3dC50b2tlbkBleGFtcGxlLmNvbSIsImlkIjo4MjI1MTczNzc3NTQ4MTIwMjEzLCJpYXQiOjE1NDExMDUyMDYuNjQ3MDI4OX0.Az6K6zKTRftnRYtvTgpNzhkEJM1LB_UHMNY1rcaccJLvT2FOD0Bw37nQJp-3m-iep11XEGZ8tYAcBqZT43zAMEL6LuGkaR2P2q_thqvP43rjs9Bcugt3DUXzRj5HuzQOpLubpDb0xcQK1g9TSCWB6kZdkV3ImG3WgXGqjHgzwoqCq0zRRuuYO6ZmSiT6BnQibtmNUYnSW5Sm_keHceGLosP8IcUq6dZC58u8AEdEXRrDKBmrY7snpAvAXAHfS74dfdol36pf6dQCm8wwd4SDsepewvghl77yAQ2Ou1xo90x9x5IenihDfPJhsqSKXZ9-Xrw_MXuqP-dU6BuATCNxHA\",\n \"tax\": 0,\n \"refundedTotal\": 0,\n \"total\": 0,\n \"paidTotal\": 0,\n \"billingAddress\": {\n \"country\": \"Notherling\",\n \"street\": \"156 Plumberry Ln.\",\n \"zip\": \"15620\",\n \"city\": \"Cidersville\"\n },\n \"items\": [\n {\n \"taxRate\": 7.42,\n \"quantity\": 4,\n \"productID\": 1\n }\n ],\n \"guest\": false,\n \"email\": \"jwt.token@example.com\",\n \"status\": 0,\n \"paymentStatus\": 0\n}"
}
]
},
{
"name": "Get Orders for User",
"event": [
{
"listen": "test",
"script": {
"id": "c367f5f0-940f-41bf-b31f-9d348cd0fe14",
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"Received array as response\", function () {",
" var json = pm.response.json();",
" ",
" pm.expect(json).instanceOf(Array);",
"});",
"",
"pm.test(\"New order returned\", function () {",
" var json = pm.response.json();",
" var id = pm.environment.get(\"order\");",
" ",
" var result = json.find(function (el) { el.id == id});",
" if (result) {",
" pm.expect(result.id).to.eql(id); ",
" }",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{jwt_token}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "http://localhost:8080/v1/orders",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"v1",
"orders"
]
},
"description": "Gets a user's order history. The orders are fetched that have a user ID matching the ID in the JWT auth token."
},
"response": [
{
"name": "Get Orders for User",
"originalRequest": {
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "http://localhost:8080/v1/orders",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"v1",
"orders"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "content-type",
"value": "application/json; charset=utf-8"
},
{
"key": "content-length",
"value": "452"
},
{
"key": "date",
"value": "Thu, 25 Oct 2018 21:17:40 GMT"
},
{
"key": "Connection",
"value": "keep-alive"
}
],
"cookie": [],
"body": "[\n {\n \"status\": 0,\n \"userID\": 4533041739374140682,\n \"guest\": false,\n \"id\": 7,\n \"tax\": 1038,\n \"items\": [\n {\n \"quantity\": 4,\n \"sku\": \"672A75A7-EA1E-4D9A-95BC-11885E5070EE\",\n \"price\": 3500,\n \"tax\": 1038,\n \"taxRate\": 7.42,\n \"totalWithTax\": 15038,\n \"total\": 14000,\n \"description\": \"We have no description\",\n \"name\": \"Mince-meat Pie\"\n }\n ],\n \"refundedTotal\": 0,\n \"paymentStatus\": 0,\n \"total\": 14000,\n \"billingAddress\": {\n \"country\": \"Notherling\",\n \"street\": \"156 Plumberry Ln.\",\n \"zip\": \"15620\",\n \"city\": \"Cidersville\"\n },\n \"paidTotal\": 0\n }\n]"
}
]
},
{
"name": "Add Item to Order",
"event": [
{
"listen": "test",
"script": {
"id": "8fd2dde7-a645-4b0e-9534-8fdc960c1313",
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"Added item object\", function () {",
" var json = pm.response.json();",
" var items = json.items.filter(function (el) { el.productID == 2 });",
" ",
" pm.expect(items.length).to.equal(1);",
" pm.expect(items[0].quantity).to.equal(2)",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{jwt_token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"productID\": 2,\n\t\"quantity\": 2\n}"
},
"url": {
"raw": "http://localhost:8080/v1/orders/{{order}}/items",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"v1",
"orders",
"{{order}}",
"items"
]
},
"description": "Adds a new item to an order model."
},
"response": [
{
"name": "Add Item to Order",
"originalRequest": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"productID\": 2,\n\t\"quantity\": 2,\n\t\"taxRate\": 7.42\n}"
},
"url": {
"raw": "http://localhost:8080/v1/orders/{{order}}/items",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"v1",
"orders",
"{{order}}",
"items"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "content-type",
"value": "application/json; charset=utf-8"
},
{
"key": "content-length",
"value": "904"
},
{
"key": "date",
"value": "Mon, 05 Nov 2018 22:39:57 GMT"
},
{
"key": "Connection",
"value": "keep-alive"
}
],
"cookie": [],
"body": "{\n \"status\": 0,\n \"userID\": 8994818343213048547,\n \"authToken\": \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImNyaXQiOlsiZXhwIiwiYXVkIl19.eyJleHAiOjY0MDkyMjExMjAwLCJlbWFpbCI6Imp3dC50b2tlbkBleGFtcGxlLmNvbSIsImlkIjo4OTk0ODE4MzQzMjEzMDQ4NTQ3LCJpYXQiOjE1NDE0NTcwNTMuMTY3MTJ9.JZRNNlSsE7pSTOHdWRJAGiKkEeBOzO_fyAvMge8Stz6QUIHlbUBPE9dkWutNGwxa_m61vnUVcnWQCwihU2VXT87AeKrkQP6mgzAqYyP2D5nB4VlwKnvKt0wvDeP4wT3FXOoQbjSWDYzPuYst95qEq81kbm_arx88bNLrIHlFpHXkgA5nr80xGKnqS-g71QdXTbnXQ3uO4PH4DJUiaPm1deeb1D3vMo9-bDu8P-n9zWJnD4cGS_HEXejajaahU8u-JP2LXbSosOcUI39T1a9PS7S44Awx9Qlh3dElaXnOsxP-vh9CmgafA2H9MM_o27LQJUn9I78dX1uJPFpAfZlHxw\",\n \"id\": 16,\n \"guest\": false,\n \"items\": [\n {\n \"taxRate\": 7.42,\n \"quantity\": 4,\n \"productID\": 1\n },\n {\n \"taxRate\": 7.42,\n \"quantity\": 2,\n \"productID\": 2\n }\n ],\n \"refundedTotal\": 0,\n \"email\": \"jwt.token@example.com\",\n \"paymentStatus\": 0,\n \"billingAddress\": {\n \"country\": \"Notherling\",\n \"street\": \"156 Plumberry Ln.\",\n \"zip\": \"15620\",\n \"city\": \"Cidersville\"\n },\n \"paidTotal\": 0\n}"
}
]
},
{
"name": "Remove Item from Order",
"event": [
{
"listen": "test",
"script": {
"id": "6e5d472f-7b2e-48e2-b460-fb11b72fec82",
"exec": [
"pm.test(\"Status code is 204\", function () {",
" pm.response.to.have.status(200);",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{jwt_token}}",
"type": "string"
}
]
},
"method": "DELETE",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json",
"disabled": true
}
],
"body": {},
"url": {
"raw": "http://localhost:8080/v1/orders/{{order}}/items/{{item}}",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"v1",
"orders",
"{{order}}",
"items",
"{{item}}"
]
},
"description": "Removes an item from an order model."
},
"response": [
{
"name": "Remove Item from Order",
"originalRequest": {
"method": "DELETE",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json",
"disabled": true
}
],
"body": {},
"url": {
"raw": "http://localhost:8080/v1/orders/{{order}}/items/{{item}}",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"v1",
"orders",
"{{order}}",
"items",
"{{item}}"
]
}
},
"status": "No Content",
"code": 204,
"_postman_previewlanguage": "plain",
"header": [
{
"key": "date",
"value": "Mon, 05 Nov 2018 22:45:11 GMT"
},
{
"key": "Connection",
"value": "keep-alive"
}
],
"cookie": [],
"body": null
}
]
}
],
"description": "An `Order` model represents the items a customer is purchasing from a merchant and handles additional metadata, such as the customer’s information (`firstname`, `lastname`, `email`, etc), its payment status, or if the order is made by a guest.\n\nAn order also as the parent for multiple other model types, including `Item` which represents a product in the order, `Address` which holds the information for the order’s payment or billing addresses, and `Payment`, which is the internal payment information that connects to an external payment from a third-party payment provider such as PayPal or Stripe.",
"event": [
{
"listen": "prerequest",
"script": {
"id": "efb991af-5d5d-442c-a1ad-295afe4d236e",
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"id": "ee85e3f6-6450-4902-b4ce-1bfe5cd45b6c",
"type": "text/javascript",
"exec": [
""
]
}
}
]
},
{
"name": "Payments",
"item": [
{
"name": "Create PayPal Payment For Order",
"event": [
{
"listen": "test",
"script": {
"id": "f4fbf14f-0061-45ca-bdbf-efb117f187ca",
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"`rel` is 'approval_url'\", function () {",
" var json = pm.response.json();",
" pm.expect(json.rel).to.eql('approval_url');",
"});",
"",
"pm.test(\"`method` is 'REDIRECT'\", function () {",
" var json = pm.response.json();",
" pm.expect(json.method).to.eql('REDIRECT');",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{jwt_token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/x-www-form-urlencoded",
"type": "text"
}
],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "currency",
"value": "usd",
"description": "The currency to use for the payment. (Required)",
"type": "text"
},
{
"key": "shipping",
"value": "3000",
"description": "The price of shipping.",
"type": "text"
},
{
"key": "shippingDiscount",
"value": "1200",
"description": "The discount the customer receives on the shipping price.",
"type": "text"
},
{
"key": "handling",
"value": "1500",
"description": "The price for handing.",
"type": "text"
},
{
"key": "insurence",
"value": "2000",
"description": "The price for insurence.",
"type": "text"
},
{
"key": "giftWrap",
"value": "250",
"description": "The price for gift wrap.",
"type": "text"
}
]
},
"url": {
"raw": "http://localhost:8080/v1/orders/{{order}}/payment/paypal/create",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"v1",
"orders",
"{{order}}",
"payment",
"paypal",
"create"
]
},
"description": "Creates a new PayPal payment based on an `Order` model's `Item` prices.\n\nThe response returned is the JSON representation of a PayPal link. Usually, you will redirect your client to the URI in the `href` key. The client can then authorize the PayPal payment so you can execute it."
},
"response": [
{
"name": "Create PayPal Payment For Order",
"originalRequest": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"currency\": \"USD\",\n\t\"shipping\": 3000,\n\t\"shippingDiscount\": 1200,\n\t\"handling\": 1500,\n\t\"insurence\": 2000,\n\t\"giftWrap\": 250\n}"
},
"url": {
"raw": "http://localhost:8080/v1/orders/{{order}}/payment/paypal/create",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"v1",
"orders",
"{{order}}",
"payment",
"paypal",
"create"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "content-type",
"value": "application/json; charset=utf-8"
},
{
"key": "content-length",
"value": "150"
},
{
"key": "date",
"value": "Thu, 25 Oct 2018 21:39:28 GMT"
},
{
"key": "Connection",
"value": "keep-alive"
}
],
"cookie": [],
"body": "{\n \"rel\": \"approval_url\",\n \"href\": \"https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-04B42176RC427425A\",\n \"method\": \"REDIRECT\"\n}"
}
]
},
{
"name": "Execute PayPal Payment for Order",
"event": [
{
"listen": "test",
"script": {
"id": "49e90629-8822-49c6-bb0c-da97a8084adc",
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"`id` equals `order` value\", function () {",
" var json = pm.response.json();",
" var id = pm.environment.get(\"order\");",
" pm.expect(json.id).to.eql(id);",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{jwt_token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/x-www-form-urlencoded",
"type": "text"
}
],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "payerID",
"value": "B5DMWWRJTB6G4",
"description": "The ID of the user in the PayPal system that is making the payment.",
"type": "text"
},
{
"key": "paymentID",
"value": "PAY-0B756831FK924644ALPMFOXA",
"description": "The ID of the payment to execute.",
"type": "text"
}
]
},
"url": {
"raw": "http://localhost:8080/v1/orders/{{order}}/payment/paypal/execute",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"v1",
"orders",
"{{order}}",
"payment",
"paypal",
"execute"
]
},
"description": "Executes a PayPal payment that was created for an order.\n\nThe body of this request expects 2 values, `payerID` and `paymentID`. These values come from the `accept` redirect request for the payment that is executed.\n\n- Note: The `payerID` query-string key is `PayerID` and `paymentID` is `paymentId`."
},
"response": [
{
"name": "Execute PayPal Payment for Order",
"originalRequest": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"payerID\": \"B5DMWWRJTB6G4\",\n\t\"paymentID\": \"PAYID-LPJDQGY8RX5968459466911A\"\n}"
},
"url": {
"raw": "http://localhost:8080/v1/orders/{{order}}/payment/paypal/execute",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"v1",
"orders",
"{{order}}",
"payment",
"paypal",
"execute"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "content-type",
"value": "application/json; charset=utf-8"
},
{
"key": "content-length",
"value": "247"
},
{
"key": "date",
"value": "Thu, 25 Oct 2018 21:45:11 GMT"
},
{
"key": "Connection",
"value": "keep-alive"
}
],
"cookie": [],
"body": "{\n \"id\": 7,\n \"insurence\": 2000,\n \"giftWrap\": 250,\n \"shipping\": 3000,\n \"tax\": 1038,\n \"orderID\": 13,\n \"paymentMethod\": \"paypal\",\n \"handling\": 1500,\n \"subtotal\": 14000,\n \"refunded\": 0,\n \"shippingDiscount\": 1200,\n \"currency\": \"USD\",\n \"externalID\": \"PAYID-LPJDQGY8RX5968459466911A\",\n \"paid\": 0\n}"
}
]
},
{
"name": "Execute Stripe Payment for Order",
"event": [
{
"listen": "test",
"script": {
"id": "f861a134-67bd-4dae-8fc0-731c11d8e40d",
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"`success` is true\", function () {",
" var json = pm.response.json();",
" pm.expect(json.success).to.eql(true);",
"});",
"",
"pm.test(\"`message` is 'Success'\", function () {",
" var json = pm.response.json();",
" pm.expect(json.message).to.eql('Success');",
"});",
"",
""
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{jwt_token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"stripeToken\": \"tok_1Dz2iT2DSdLg2fx4o0efKbkz\",\n\t\"currency\": \"usd\",\n\t\"shipping\": 3000,\n\t\"shippingDiscount\": 1200,\n\t\"handling\": 1500,\n\t\"insurence\": 2000,\n\t\"giftWrap\": 250\n}"
},
"url": {
"raw": "http://localhost:8082/v1/orders/{{order}}/payment/stripe-cc",
"protocol": "http",
"host": [
"localhost"
],
"port": "8082",
"path": [
"v1",
"orders",
"{{order}}",
"payment",
"stripe-cc"
]
},
"description": "Takes a Stripe credit card token and creates a charge with it."
},
"response": [
{
"name": "Execute Stripe Payment for Order",
"originalRequest": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/x-www-form-urlencoded",
"type": "text"
}
],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "stripeToken",
"value": "tok_1DPGsL2DSdLg2fx4QreVIQGU",
"description": "The Strip credit card token, returned from the Stripe API when the data is submitted from your front-end. (Required)",
"type": "text"
},
{
"key": "currency",
"value": "usd",
"description": "The currency to use for the payment. (Required)",
"type": "text"
},
{
"key": "shipping",
"value": "3000",
"description": "The price of shipping.",
"type": "text"
},
{