-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.test.ts
41 lines (36 loc) · 1.14 KB
/
index.test.ts
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
import * as fs from 'fs'
import fetch from 'node-fetch'
import { createMerchantInfo } from './testMerchant'
import { createBanxwareLinkIntegration } from '../src/index'
import assert from 'assert'
describe('link integration', () => {
test('it should create a session', async () => {
const testTenantPrivateKey = fs
.readFileSync('./resources/test-tenant-private-key-1.pem')
.toString()
const banxwareDevPublicKey = fs
.readFileSync('./resources/banxware-dev-public-key-1.pem')
.toString()
const merchantInfo = createMerchantInfo()
console.log({ merchantInfo })
const blob = await createBanxwareLinkIntegration(
testTenantPrivateKey,
banxwareDevPublicKey,
merchantInfo,
)
console.log({ blob })
const response = await fetch(
'https://panther-services-api-dev.pc-in.net/merchant-integration',
{
headers: {
'Tenant-Code': 'TEST',
},
method: 'PUT',
body: JSON.stringify({ merchantInfo: blob }),
},
)
assert.equal(response.status, 200)
const body = await response.json()
console.dir({ body }, { depth: null })
})
})