xendit-node
Advanced tools
Comparing version 1.8.0 to 1.9.0
{ | ||
"name": "xendit-node", | ||
"version": "1.8.0", | ||
"version": "1.9.0", | ||
"description": "NodeJS client for Xendit API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -422,2 +422,3 @@ # Xendit API Node.js Client | ||
midLabel?: string; | ||
forUserID?: string; | ||
}) | ||
@@ -429,3 +430,3 @@ ``` | ||
```ts | ||
i.getInvoice(data: { invoiceID: string }) | ||
i.getInvoice(data: { invoiceID: string; forUserID?: string }) | ||
``` | ||
@@ -436,3 +437,6 @@ | ||
```ts | ||
i.expireInvoice(data: { invoiceID: string }) | ||
i.expireInvoice(data: { | ||
invoiceID: string; | ||
forUserID?: string; | ||
}) | ||
``` | ||
@@ -457,2 +461,3 @@ | ||
recurringPaymentID?: string; | ||
forUserID?: string; | ||
}) | ||
@@ -459,0 +464,0 @@ ``` |
@@ -21,5 +21,9 @@ import { XenditOptions } from '../xendit_opts'; | ||
midLabel?: string; | ||
forUserID?: string; | ||
}): Promise<object>; | ||
getInvoice(data: { invoiceID: string }): Promise<object>; | ||
expireInvoice(data: { invoiceID: string }): Promise<object>; | ||
getInvoice(data: { invoiceID: string; forUserID?: string }): Promise<object>; | ||
expireInvoice(data: { | ||
invoiceID: string; | ||
forUserID?: string; | ||
}): Promise<object>; | ||
getAllInvoices(data?: { | ||
@@ -39,3 +43,4 @@ statuses?: string[]; | ||
recurringPaymentID?: string; | ||
forUserID?: string; | ||
}): Promise<object>; | ||
}; |
@@ -35,8 +35,14 @@ const { | ||
let headers = { | ||
'Content-Type': 'application/json', | ||
Authorization: Auth.basicAuthHeader(this.opts.secretKey), | ||
}; | ||
if (data.forUserID) { | ||
headers['for-user-id'] = data.forUserID; | ||
} | ||
fetchWithHTTPErr(`${this.API_ENDPOINT}/v2/invoices`, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: Auth.basicAuthHeader(this.opts.secretKey), | ||
}, | ||
headers, | ||
body: JSON.stringify({ | ||
@@ -67,7 +73,13 @@ external_id: data.externalID, | ||
let headers = { | ||
Authorization: Auth.basicAuthHeader(this.opts.secretKey), | ||
}; | ||
if (data.forUserID) { | ||
headers['for-user-id'] = data.forUserID; | ||
} | ||
fetchWithHTTPErr(`${this.API_ENDPOINT}/v2/invoices/${data.invoiceID}`, { | ||
method: 'GET', | ||
headers: { | ||
Authorization: Auth.basicAuthHeader(this.opts.secretKey), | ||
}, | ||
headers, | ||
}) | ||
@@ -83,2 +95,10 @@ .then(resolve) | ||
let headers = { | ||
Authorization: Auth.basicAuthHeader(this.opts.secretKey), | ||
}; | ||
if (data.forUserID) { | ||
headers['for-user-id'] = data.forUserID; | ||
} | ||
fetchWithHTTPErr( | ||
@@ -88,5 +108,3 @@ `${this.API_ENDPOINT}/invoices/${data.invoiceID}/expire!`, | ||
method: 'POST', | ||
headers: { | ||
Authorization: Auth.basicAuthHeader(this.opts.secretKey), | ||
}, | ||
headers, | ||
}, | ||
@@ -131,2 +149,10 @@ ) | ||
let headers = { | ||
Authorization: Auth.basicAuthHeader(this.opts.secretKey), | ||
}; | ||
if (data && data.forUserID) { | ||
headers['for-user-id'] = data.forUserID; | ||
} | ||
fetchWithHTTPErr( | ||
@@ -136,5 +162,3 @@ `${this.API_ENDPOINT}/v2/invoices${queryStrWithQuestionMark}`, | ||
method: 'GET', | ||
headers: { | ||
Authorization: Auth.basicAuthHeader(this.opts.secretKey), | ||
}, | ||
headers, | ||
}, | ||
@@ -141,0 +165,0 @@ ) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
162531
4391
1105