QA: Update Postman Create Transaction body to ERP schema (mercant_id,timestamp,deskripsi,nominal,nama,no_telepon,email,item[])
This commit is contained in:
parent
baed44ecd7
commit
92ec715632
|
|
@ -22,7 +22,7 @@
|
|||
"url": { "raw": "{{baseUrl}}/createtransaksi", "host": ["{{baseUrl}}"], "path": ["createtransaksi"] },
|
||||
"body": {
|
||||
"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": [
|
||||
|
|
@ -33,18 +33,16 @@
|
|||
"exec": [
|
||||
"let res = {};",
|
||||
"try { res = pm.response.json(); } catch(e) { res = {}; }",
|
||||
"if (res && res.token) {",
|
||||
" pm.collectionVariables.set('token', res.token);",
|
||||
"const url = (res && res.data && res.data.url) ? res.data.url : (res && res.url ? res.url : '');",
|
||||
"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.collectionVariables.set('order_id', res.order_id);",
|
||||
"}",
|
||||
"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');",
|
||||
"pm.test('Create Transaction returns data.url and token', function () {",
|
||||
" pm.expect(url, 'data.url exists').to.be.a('string');",
|
||||
"});"
|
||||
]
|
||||
}
|
||||
|
|
@ -77,6 +75,7 @@
|
|||
"exec": [
|
||||
"let 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.expect(res.order_id, 'order_id').to.be.a('string');",
|
||||
" pm.expect(res.nominal, 'nominal').to.exist;",
|
||||
|
|
|
|||
Loading…
Reference in New Issue