QA: Update Postman Create Transaction body to ERP schema (mercant_id,timestamp,deskripsi,nominal,nama,no_telepon,email,item[])

This commit is contained in:
CIFO Dev 2025-11-11 13:53:20 +07:00
parent baed44ecd7
commit 92ec715632
1 changed files with 11 additions and 12 deletions

View File

@ -22,7 +22,7 @@
"url": { "raw": "{{baseUrl}}/createtransaksi", "host": ["{{baseUrl}}"], "path": ["createtransaksi"] }, "url": { "raw": "{{baseUrl}}/createtransaksi", "host": ["{{baseUrl}}"], "path": ["createtransaksi"] },
"body": { "body": {
"mode": "raw", "mode": "raw",
"raw": "{\n \"item_id\": \"order-demo-1\",\n \"nominal\": 150000,\n \"customer\": { \"name\": \"Demo User\", \"email\": \"demo@example.com\" },\n \"allowed_methods\": [\"bank_transfer\", \"credit_card\", \"gopay\", \"cstore\"]\n}" "raw": "{\n \"mercant_id\": \"REFNO-001\",\n \"timestamp\": 1731300000000,\n \"deskripsi\": \"Bayar Internet\",\n \"nominal\": 200000,\n \"nama\": \"Demo User\",\n \"no_telepon\": \"081234567890\",\n \"email\": \"demo@example.com\",\n \"item\": [\n { \"item_id\": \"TKG-2511101\", \"nama\": \"Internet\", \"harga\": 200000, \"qty\": 1 }\n ]\n}"
} }
}, },
"event": [ "event": [
@ -33,18 +33,16 @@
"exec": [ "exec": [
"let res = {};", "let res = {};",
"try { res = pm.response.json(); } catch(e) { res = {}; }", "try { res = pm.response.json(); } catch(e) { res = {}; }",
"if (res && res.token) {", "const url = (res && res.data && res.data.url) ? res.data.url : (res && res.url ? res.url : '');",
" pm.collectionVariables.set('token', res.token);", "if (url) {",
" pm.collectionVariables.set('paymentLinkUrl', url);",
" const trimmed = url.replace(/\\\/$/, '');",
" const parts = trimmed.split('/');",
" const tok = parts[parts.length - 1];",
" pm.collectionVariables.set('token', tok);",
"}", "}",
"if (res && res.order_id) {", "pm.test('Create Transaction returns data.url and token', function () {",
" pm.collectionVariables.set('order_id', res.order_id);", " pm.expect(url, 'data.url exists').to.be.a('string');",
"}",
"if (res && res.url) {",
" pm.collectionVariables.set('paymentLinkUrl', res.url);",
"}",
"pm.test('Create Transaction returns token and order_id', function () {",
" pm.expect(res.token, 'token exists').to.be.a('string');",
" pm.expect(res.order_id, 'order_id exists').to.be.a('string');",
"});" "});"
] ]
} }
@ -77,6 +75,7 @@
"exec": [ "exec": [
"let res = {};", "let res = {};",
"try { res = pm.response.json(); } catch(e) { res = {}; }", "try { res = pm.response.json(); } catch(e) { res = {}; }",
"if (res && res.order_id) { pm.collectionVariables.set('order_id', res.order_id); }",
"pm.test('Resolve Token payload has order_id and nominal', function () {", "pm.test('Resolve Token payload has order_id and nominal', function () {",
" pm.expect(res.order_id, 'order_id').to.be.a('string');", " pm.expect(res.order_id, 'order_id').to.be.a('string');",
" pm.expect(res.nominal, 'nominal').to.exist;", " pm.expect(res.nominal, 'nominal').to.exist;",