|
523 | 523 | "language": "json"
|
524 | 524 | }
|
525 | 525 | },
|
526 |
| - "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\" [email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"PiX\",\"last_name\":\"Fix\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"PiX\",\"last_name\":\"Fix\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}" |
| 526 | + "raw": "{\"amount\":6540,\"currency\":\"USD\",\"confirm\":true,\"routing\":{\"type\":\"single\",\"data\":\"forte\"},\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"amount_to_capture\":6540,\"customer_id\":\"StripeCustomer\",\"email\":\" [email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+1\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"PiX\",\"last_name\":\"Fix\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"PiX\",\"last_name\":\"Fix\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}" |
527 | 527 | },
|
528 | 528 | "url": {
|
529 | 529 | "raw": "{{baseUrl}}/payments",
|
|
646 | 646 | {
|
647 | 647 | "name": "Happy Cases",
|
648 | 648 | "item": [
|
| 649 | + { |
| 650 | + "name": "Scenario7-Create payment with Zero Amount", |
| 651 | + "item": [ |
| 652 | + { |
| 653 | + "name": "Payments - Create", |
| 654 | + "event": [ |
| 655 | + { |
| 656 | + "listen": "test", |
| 657 | + "script": { |
| 658 | + "exec": [ |
| 659 | + "// Validate status 2xx", |
| 660 | + "pm.test(\"[POST]::/payments - Status code is 2xx\", function () {", |
| 661 | + " pm.response.to.be.success;", |
| 662 | + "});", |
| 663 | + "", |
| 664 | + "// Validate if response header has matching content-type", |
| 665 | + "pm.test(\"[POST]::/payments - Content-Type is application/json\", function () {", |
| 666 | + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", |
| 667 | + " \"application/json\",", |
| 668 | + " );", |
| 669 | + "});", |
| 670 | + "", |
| 671 | + "// Validate if response has JSON Body", |
| 672 | + "pm.test(\"[POST]::/payments - Response has JSON Body\", function () {", |
| 673 | + " pm.response.to.have.jsonBody();", |
| 674 | + "});", |
| 675 | + "", |
| 676 | + "// Set response object as internal variable", |
| 677 | + "let jsonData = {};", |
| 678 | + "try {", |
| 679 | + " jsonData = pm.response.json();", |
| 680 | + "} catch (e) {}", |
| 681 | + "", |
| 682 | + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", |
| 683 | + "if (jsonData?.payment_id) {", |
| 684 | + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", |
| 685 | + " console.log(", |
| 686 | + " \"- use {{payment_id}} as collection variable for value\",", |
| 687 | + " jsonData.payment_id,", |
| 688 | + " );", |
| 689 | + "} else {", |
| 690 | + " console.log(", |
| 691 | + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", |
| 692 | + " );", |
| 693 | + "}", |
| 694 | + "", |
| 695 | + "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id", |
| 696 | + "if (jsonData?.mandate_id) {", |
| 697 | + " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);", |
| 698 | + " console.log(", |
| 699 | + " \"- use {{mandate_id}} as collection variable for value\",", |
| 700 | + " jsonData.mandate_id,", |
| 701 | + " );", |
| 702 | + "} else {", |
| 703 | + " console.log(", |
| 704 | + " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",", |
| 705 | + " );", |
| 706 | + "}", |
| 707 | + "", |
| 708 | + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", |
| 709 | + "if (jsonData?.client_secret) {", |
| 710 | + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", |
| 711 | + " console.log(", |
| 712 | + " \"- use {{client_secret}} as collection variable for value\",", |
| 713 | + " jsonData.client_secret,", |
| 714 | + " );", |
| 715 | + "} else {", |
| 716 | + " console.log(", |
| 717 | + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", |
| 718 | + " );", |
| 719 | + "}", |
| 720 | + "", |
| 721 | + "// Response body should have value \"processing\" for \"status\"", |
| 722 | + "if (jsonData?.status) {", |
| 723 | + " pm.test(", |
| 724 | + " \"[POST]::/payments - Content check if value for 'status' matches 'succeeded'\",", |
| 725 | + " function () {", |
| 726 | + " pm.expect(jsonData.status).to.eql(\"succeeded\");", |
| 727 | + " },", |
| 728 | + " );", |
| 729 | + "}", |
| 730 | + "" |
| 731 | + ], |
| 732 | + "type": "text/javascript" |
| 733 | + } |
| 734 | + } |
| 735 | + ], |
| 736 | + "request": { |
| 737 | + "method": "POST", |
| 738 | + "header": [ |
| 739 | + { |
| 740 | + "key": "Content-Type", |
| 741 | + "value": "application/json" |
| 742 | + }, |
| 743 | + { |
| 744 | + "key": "Accept", |
| 745 | + "value": "application/json" |
| 746 | + } |
| 747 | + ], |
| 748 | + "body": { |
| 749 | + "mode": "raw", |
| 750 | + "options": { |
| 751 | + "raw": { |
| 752 | + "language": "json" |
| 753 | + } |
| 754 | + }, |
| 755 | + "raw": "{\"amount\":0,\"currency\":\"USD\",\"confirm\":true,\"capture_method\":\"automatic\",\"capture_on\":\"2022-09-10T10:11:12Z\",\"customer_id\":\"StripeCustomer\",\"email\":\" [email protected]\",\"name\":\"John Doe\",\"phone\":\"999999999\",\"phone_country_code\":\"+65\",\"description\":\"Its my first payment request\",\"authentication_type\":\"no_three_ds\",\"routing\":{\"type\":\"single\",\"data\":\"forte\"},\"return_url\":\"https://duck.com\",\"payment_method\":\"card\",\"payment_method_data\":{\"card\":{\"card_number\":\"4242424242424242\",\"card_exp_month\":\"10\",\"card_exp_year\":\"25\",\"card_holder_name\":\"joseph Doe\",\"card_cvc\":\"123\"}},\"billing\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"PiX\",\"last_name\":\"Fix\"}},\"shipping\":{\"address\":{\"line1\":\"1467\",\"line2\":\"Harrison Street\",\"line3\":\"Harrison Street\",\"city\":\"San Fransico\",\"state\":\"California\",\"zip\":\"94122\",\"country\":\"US\",\"first_name\":\"PiX\",\"last_name\":\"Fix\"}},\"statement_descriptor_name\":\"joseph\",\"statement_descriptor_suffix\":\"JS\",\"metadata\":{\"udf1\":\"value1\",\"new_customer\":\"true\",\"login_date\":\"2019-09-10T10:11:12Z\"}}" |
| 756 | + }, |
| 757 | + "url": { |
| 758 | + "raw": "{{baseUrl}}/payments", |
| 759 | + "host": [ |
| 760 | + "{{baseUrl}}" |
| 761 | + ], |
| 762 | + "path": [ |
| 763 | + "payments" |
| 764 | + ] |
| 765 | + }, |
| 766 | + "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture" |
| 767 | + }, |
| 768 | + "response": [] |
| 769 | + }, |
| 770 | + { |
| 771 | + "name": "Payments - Retrieve", |
| 772 | + "event": [ |
| 773 | + { |
| 774 | + "listen": "test", |
| 775 | + "script": { |
| 776 | + "exec": [ |
| 777 | + "// Validate status 2xx", |
| 778 | + "pm.test(\"[GET]::/payments/:id - Status code is 2xx\", function () {", |
| 779 | + " pm.response.to.be.success;", |
| 780 | + "});", |
| 781 | + "", |
| 782 | + "// Validate if response header has matching content-type", |
| 783 | + "pm.test(\"[GET]::/payments/:id - Content-Type is application/json\", function () {", |
| 784 | + " pm.expect(pm.response.headers.get(\"Content-Type\")).to.include(", |
| 785 | + " \"application/json\",", |
| 786 | + " );", |
| 787 | + "});", |
| 788 | + "", |
| 789 | + "// Validate if response has JSON Body", |
| 790 | + "pm.test(\"[GET]::/payments/:id - Response has JSON Body\", function () {", |
| 791 | + " pm.response.to.have.jsonBody();", |
| 792 | + "});", |
| 793 | + "", |
| 794 | + "// Set response object as internal variable", |
| 795 | + "let jsonData = {};", |
| 796 | + "try {", |
| 797 | + " jsonData = pm.response.json();", |
| 798 | + "} catch (e) {}", |
| 799 | + "", |
| 800 | + "// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id", |
| 801 | + "if (jsonData?.payment_id) {", |
| 802 | + " pm.collectionVariables.set(\"payment_id\", jsonData.payment_id);", |
| 803 | + " console.log(", |
| 804 | + " \"- use {{payment_id}} as collection variable for value\",", |
| 805 | + " jsonData.payment_id,", |
| 806 | + " );", |
| 807 | + "} else {", |
| 808 | + " console.log(", |
| 809 | + " \"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.\",", |
| 810 | + " );", |
| 811 | + "}", |
| 812 | + "", |
| 813 | + "// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id", |
| 814 | + "if (jsonData?.mandate_id) {", |
| 815 | + " pm.collectionVariables.set(\"mandate_id\", jsonData.mandate_id);", |
| 816 | + " console.log(", |
| 817 | + " \"- use {{mandate_id}} as collection variable for value\",", |
| 818 | + " jsonData.mandate_id,", |
| 819 | + " );", |
| 820 | + "} else {", |
| 821 | + " console.log(", |
| 822 | + " \"INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.\",", |
| 823 | + " );", |
| 824 | + "}", |
| 825 | + "", |
| 826 | + "// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret", |
| 827 | + "if (jsonData?.client_secret) {", |
| 828 | + " pm.collectionVariables.set(\"client_secret\", jsonData.client_secret);", |
| 829 | + " console.log(", |
| 830 | + " \"- use {{client_secret}} as collection variable for value\",", |
| 831 | + " jsonData.client_secret,", |
| 832 | + " );", |
| 833 | + "} else {", |
| 834 | + " console.log(", |
| 835 | + " \"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.\",", |
| 836 | + " );", |
| 837 | + "}", |
| 838 | + "", |
| 839 | + "// Response body should have value \"processing\" for \"status\"", |
| 840 | + "if (jsonData?.status) {", |
| 841 | + " pm.test(", |
| 842 | + " \"[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'\",", |
| 843 | + " function () {", |
| 844 | + " pm.expect(jsonData.status).to.eql(\"succeeded\");", |
| 845 | + " },", |
| 846 | + " );", |
| 847 | + "}", |
| 848 | + "" |
| 849 | + ], |
| 850 | + "type": "text/javascript" |
| 851 | + } |
| 852 | + } |
| 853 | + ], |
| 854 | + "request": { |
| 855 | + "method": "GET", |
| 856 | + "header": [ |
| 857 | + { |
| 858 | + "key": "Accept", |
| 859 | + "value": "application/json" |
| 860 | + } |
| 861 | + ], |
| 862 | + "url": { |
| 863 | + "raw": "{{baseUrl}}/payments/:id?force_sync=true", |
| 864 | + "host": [ |
| 865 | + "{{baseUrl}}" |
| 866 | + ], |
| 867 | + "path": [ |
| 868 | + "payments", |
| 869 | + ":id" |
| 870 | + ], |
| 871 | + "query": [ |
| 872 | + { |
| 873 | + "key": "force_sync", |
| 874 | + "value": "true" |
| 875 | + } |
| 876 | + ], |
| 877 | + "variable": [ |
| 878 | + { |
| 879 | + "key": "id", |
| 880 | + "value": "{{payment_id}}", |
| 881 | + "description": "(Required) unique payment id" |
| 882 | + } |
| 883 | + ] |
| 884 | + }, |
| 885 | + "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment" |
| 886 | + }, |
| 887 | + "response": [] |
| 888 | + } |
| 889 | + ] |
| 890 | + }, |
649 | 891 | {
|
650 | 892 | "name": "Scenario1-Create payment with confirm true",
|
651 | 893 | "item": [
|
|
0 commit comments