xendit-node
Advanced tools
Comparing version 1.10.0 to 1.12.0
# CHANGELOG | ||
## 2021-04-14 | ||
- Enable forUserId for Virtual Accounts product | ||
- Enable forUserId for Cards product | ||
## 2020-03-05 | ||
@@ -4,0 +8,0 @@ |
@@ -84,3 +84,3 @@ const x = require('../xendit'); | ||
}, | ||
quantity: '15', | ||
quantity: 15, | ||
}, | ||
@@ -87,0 +87,0 @@ { |
@@ -100,3 +100,3 @@ const x = require('../xendit'); | ||
}, | ||
quantity: '15', | ||
quantity: 15, | ||
}, | ||
@@ -103,0 +103,0 @@ { |
@@ -80,3 +80,3 @@ const x = require('./xendit.test'); | ||
}, | ||
quantity: '15', | ||
quantity: 15, | ||
}, | ||
@@ -83,0 +83,0 @@ { |
{ | ||
"name": "xendit-node", | ||
"version": "1.10.0", | ||
"version": "1.12.0", | ||
"description": "NodeJS client for Xendit API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -162,2 +162,3 @@ # Xendit API Node.js Client | ||
installment?: object; | ||
forUserID?: string; | ||
}) | ||
@@ -172,2 +173,3 @@ ``` | ||
amount: number; | ||
forUserID?: string; | ||
}) | ||
@@ -197,2 +199,3 @@ ``` | ||
installment?: object; | ||
forUserID?: string; | ||
}) | ||
@@ -207,2 +210,3 @@ ``` | ||
externalID: string; | ||
forUserID?: string; | ||
}) | ||
@@ -219,2 +223,3 @@ ``` | ||
xIdempotencyKey?: string; | ||
forUserID?: string; | ||
}) | ||
@@ -254,3 +259,5 @@ ``` | ||
```ts | ||
va.getVABanks(); | ||
va.getVABanks(data?: { | ||
forUserID?: string; | ||
}); | ||
``` | ||
@@ -272,2 +279,3 @@ | ||
description?: string; | ||
forUserID?: string; | ||
}) | ||
@@ -279,3 +287,6 @@ ``` | ||
```ts | ||
va.getFixedVA(data: { id: string }) | ||
va.getFixedVA(data: { | ||
id: string; | ||
forUserID?: string; | ||
}) | ||
``` | ||
@@ -293,2 +304,3 @@ | ||
description?: string; | ||
forUserID?: string; | ||
}) | ||
@@ -300,3 +312,6 @@ ``` | ||
```ts | ||
va.getVAPayment(data: { paymentID: string }) | ||
va.getVAPayment(data: { | ||
paymentID: string; | ||
forUserID?: string; | ||
}) | ||
``` | ||
@@ -303,0 +318,0 @@ |
@@ -13,2 +13,3 @@ export function createAuthorization(data: { | ||
installment?: object; | ||
forUserID?: string; | ||
}): Promise<object>; | ||
@@ -19,2 +20,3 @@ | ||
externalID: string; | ||
forUserID?: string; | ||
}): Promise<object>; |
@@ -13,2 +13,11 @@ const { Validate, Auth, fetchWithHTTPErr, promWithJsErr } = require('../utils'); | ||
let headers = { | ||
Authorization: Auth.basicAuthHeader(this.opts.secretKey), | ||
'Content-Type': 'application/json', | ||
}; | ||
if (data && data.forUserID) { | ||
headers['for-user-id'] = data.forUserID; | ||
} | ||
fetchWithHTTPErr( | ||
@@ -19,6 +28,3 @@ // eslint-disable-next-line max-len | ||
method: 'POST', | ||
headers: { | ||
Authorization: Auth.basicAuthHeader(this.opts.secretKey), | ||
'Content-Type': 'application/json', | ||
}, | ||
headers, | ||
body: JSON.stringify({ external_id: data.externalID }), | ||
@@ -25,0 +31,0 @@ }, |
@@ -14,2 +14,3 @@ export function createCharge(data: { | ||
installment?: object; | ||
forUserID?: string; | ||
}): Promise<object>; | ||
@@ -20,4 +21,5 @@ | ||
amount: number; | ||
forUserID?: string; | ||
}): Promise<object>; | ||
export function getCharge(data: { chargeID: string }): Promise<object>; |
@@ -8,8 +8,14 @@ const { Validate, Auth, fetchWithHTTPErr, promWithJsErr } = require('../utils'); | ||
let headers = { | ||
Authorization: Auth.basicAuthHeader(this.opts.secretKey), | ||
'Content-Type': 'application/json', | ||
}; | ||
if (data && data.forUserID) { | ||
headers['for-user-id'] = data.forUserID; | ||
} | ||
fetchWithHTTPErr(`${this.API_ENDPOINT}/credit_card_charges`, { | ||
method: 'POST', | ||
headers: { | ||
Authorization: Auth.basicAuthHeader(this.opts.secretKey), | ||
'Content-Type': 'application/json', | ||
}, | ||
headers, | ||
body: JSON.stringify({ | ||
@@ -40,2 +46,11 @@ token_id: data.tokenID, | ||
let headers = { | ||
Authorization: Auth.basicAuthHeader(this.opts.secretKey), | ||
'Content-Type': 'application/json', | ||
}; | ||
if (data && data.forUserID) { | ||
headers['for-user-id'] = data.forUserID; | ||
} | ||
fetchWithHTTPErr( | ||
@@ -45,6 +60,3 @@ `${this.API_ENDPOINT}/credit_card_charges/${data.chargeID}/capture`, | ||
method: 'POST', | ||
headers: { | ||
Authorization: Auth.basicAuthHeader(this.opts.secretKey), | ||
'Content-Type': 'application/json', | ||
}, | ||
headers, | ||
body: JSON.stringify({ amount: data.amount }), | ||
@@ -51,0 +63,0 @@ }, |
@@ -6,2 +6,3 @@ export function createRefund(data: { | ||
xIdempotencyKey?: string; | ||
forUserID?: string; | ||
}): Promise<object>; |
@@ -13,2 +13,6 @@ const { Validate, Auth, fetchWithHTTPErr, promWithJsErr } = require('../utils'); | ||
if (data && data.forUserID) { | ||
headers['for-user-id'] = data.forUserID; | ||
} | ||
fetchWithHTTPErr( | ||
@@ -15,0 +19,0 @@ `${this.API_ENDPOINT}/credit_card_charges/${data.chargeID}/refunds`, |
@@ -12,3 +12,3 @@ interface Basket { | ||
metadata?: object; | ||
quantity?: string; | ||
quantity?: number; | ||
} | ||
@@ -15,0 +15,0 @@ |
@@ -12,5 +12,9 @@ export function createFixedVA(data: { | ||
description?: string; | ||
forUserID?: string; | ||
}): Promise<object>; | ||
export function getFixedVA(data: { id: string }): Promise<object>; | ||
export function getFixedVA(data: { | ||
id: string; | ||
forUserID?: string; | ||
}): Promise<object>; | ||
@@ -24,2 +28,3 @@ export function updateFixedVA(data: { | ||
description?: string; | ||
forUserID?: string; | ||
}): Promise<object>; |
@@ -8,8 +8,14 @@ const { promWithJsErr, Validate, fetchWithHTTPErr, Auth } = require('../utils'); | ||
let headers = { | ||
Authorization: Auth.basicAuthHeader(this.opts.secretKey), | ||
'Content-Type': 'application/json', | ||
}; | ||
if (data && data.forUserID) { | ||
headers['for-user-id'] = data.forUserID; | ||
} | ||
fetchWithHTTPErr(`${this.API_ENDPOINT}/callback_virtual_accounts`, { | ||
method: 'POST', | ||
headers: { | ||
Authorization: Auth.basicAuthHeader(this.opts.secretKey), | ||
'Content-Type': 'application/json', | ||
}, | ||
headers, | ||
body: JSON.stringify({ | ||
@@ -38,2 +44,11 @@ external_id: data.externalID, | ||
Validate.rejectOnMissingFields(['id'], data, reject); | ||
let headers = { | ||
Authorization: Auth.basicAuthHeader(this.opts.secretKey), | ||
}; | ||
if (data && data.forUserID) { | ||
headers['for-user-id'] = data.forUserID; | ||
} | ||
fetchWithHTTPErr( | ||
@@ -43,5 +58,3 @@ `${this.API_ENDPOINT}/callback_virtual_accounts/${data.id}`, | ||
method: 'GET', | ||
headers: { | ||
Authorization: Auth.basicAuthHeader(this.opts.secretKey), | ||
}, | ||
headers, | ||
}, | ||
@@ -57,2 +70,12 @@ ) | ||
Validate.rejectOnMissingFields(['id'], data, reject); | ||
let headers = { | ||
Authorization: Auth.basicAuthHeader(this.opts.secretKey), | ||
'Content-Type': 'application/json', | ||
}; | ||
if (data && data.forUserID) { | ||
headers['for-user-id'] = data.forUserID; | ||
} | ||
fetchWithHTTPErr( | ||
@@ -62,6 +85,3 @@ `${this.API_ENDPOINT}/callback_virtual_accounts/${data.id}`, | ||
method: 'PATCH', | ||
headers: { | ||
Authorization: Auth.basicAuthHeader(this.opts.secretKey), | ||
'Content-Type': 'application/json', | ||
}, | ||
headers, | ||
body: JSON.stringify({ | ||
@@ -68,0 +88,0 @@ suggested_amount: data.suggestedAmt, |
@@ -1,1 +0,1 @@ | ||
export function getVABanks(): Promise<object>; | ||
export function getVABanks(data?: { forUserID?: string }): Promise<object>; |
const { Auth, fetchWithHTTPErr, promWithJsErr } = require('../utils'); | ||
function getVABanks() { | ||
function getVABanks(data = {}) { | ||
return promWithJsErr((resolve, reject) => { | ||
let headers = { | ||
Authorization: Auth.basicAuthHeader(this.opts.secretKey), | ||
}; | ||
if (data && data.forUserID) { | ||
headers['for-user-id'] = data.forUserID; | ||
} | ||
fetchWithHTTPErr(`${this.API_ENDPOINT}/available_virtual_account_banks`, { | ||
method: 'GET', | ||
headers: { | ||
Authorization: Auth.basicAuthHeader(this.opts.secretKey), | ||
}, | ||
headers, | ||
}) | ||
@@ -11,0 +17,0 @@ .then(resolve) |
@@ -1,1 +0,4 @@ | ||
export function getVAPayment(data: { paymentID: string }): Promise<object>; | ||
export function getVAPayment(data: { | ||
paymentID: string; | ||
forUserID?: string; | ||
}): Promise<object>; |
@@ -8,2 +8,10 @@ const { promWithJsErr, Validate, Auth, fetchWithHTTPErr } = require('../utils'); | ||
let headers = { | ||
Authorization: Auth.basicAuthHeader(this.opts.secretKey), | ||
}; | ||
if (data && data.forUserID) { | ||
headers['for-user-id'] = data.forUserID; | ||
} | ||
fetchWithHTTPErr( | ||
@@ -14,5 +22,3 @@ // eslint-disable-next-line max-len | ||
method: 'GET', | ||
headers: { | ||
Authorization: Auth.basicAuthHeader(this.opts.secretKey), | ||
}, | ||
headers, | ||
}, | ||
@@ -19,0 +25,0 @@ ) |
165156
4481
1130