xendit-node
Advanced tools
Comparing version 1.19.6 to 1.19.7
@@ -39,2 +39,17 @@ const x = require('../xendit'); | ||
const promotion = await card.createPromotion({ | ||
referenceId: Date.now().toString(), | ||
description: '20% discount applied for all BRI cards', | ||
binList: ['400000', '460000'], | ||
discountPercent: 20, | ||
channelCode: 'BRI', | ||
currency: 'IDR', | ||
minOriginalAmount: 25000, | ||
maxDiscountAmount: 5000, | ||
startTime: '2022-03-25T00:00:00.000Z', | ||
endTime: '2022-05-25T00:00:00.000Z', | ||
}); | ||
// eslint-disable-next-line max-len | ||
console.log('promotion created:', promotion); // eslint-disable-line no-console | ||
process.exit(0); | ||
@@ -41,0 +56,0 @@ } catch (e) { |
@@ -41,2 +41,20 @@ const x = require('../xendit'); | ||
}) | ||
.then(() => | ||
card.createPromotion({ | ||
referenceId: Date.now().toString(), | ||
description: '20% discount applied for all BRI cards', | ||
binList: ['400000', '460000'], | ||
discountPercent: 20, | ||
channelCode: 'BRI', | ||
currency: 'IDR', | ||
minOriginalAmount: 25000, | ||
maxDiscountAmount: 5000, | ||
startTime: '2022-03-25T00:00:00.000Z', | ||
endTime: '2022-05-25T00:00:00.000Z', | ||
}), | ||
) | ||
.then(res => { | ||
console.log('promotion created:', res); // eslint-disable-line no-console | ||
process.exit(0); | ||
}) | ||
.catch(e => { | ||
@@ -43,0 +61,0 @@ console.error(e); // eslint-disable-line no-console |
@@ -9,2 +9,16 @@ const x = require('./xendit.test'); | ||
.getCharge({ chargeID: '5e046a736113354249aab8bd' }) | ||
.then(() => | ||
card.createPromotion({ | ||
referenceId: Date.now().toString(), | ||
description: '20% discount applied for all BRI cards', | ||
binList: ['400000', '460000'], | ||
discountPercent: 20, | ||
channelCode: 'BRI', | ||
currency: 'IDR', | ||
minOriginalAmount: 25000, | ||
maxDiscountAmount: 5000, | ||
startTime: '2022-03-25T00:00:00.000Z', | ||
endTime: '2022-05-25T00:00:00.000Z', | ||
}), | ||
) | ||
.then(() => { | ||
@@ -11,0 +25,0 @@ // eslint-disable-next-line no-console |
{ | ||
"name": "xendit-node", | ||
"version": "1.19.6", | ||
"version": "1.19.7", | ||
"description": "NodeJS client for Xendit API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -26,2 +26,3 @@ # Xendit API Node.js Client | ||
+ [Create refund](#create-refund) | ||
+ [Create promotion](#create-promotion) | ||
* [Virtual Account Services](#virtual-account-services) | ||
@@ -236,2 +237,21 @@ + [Get banks with available virtual account service](#get-banks-with-available-virtual-account-service) | ||
#### Create promotion | ||
```ts | ||
card.createPromotion(data: { | ||
referenceId: string; | ||
description: string; | ||
promoCode?: string; | ||
binList?: string[]; | ||
channelCode?: string; | ||
discountPercent?: number; | ||
discountAmount?: number; | ||
currency: string; | ||
startTime: Date; | ||
endTime: Date; | ||
minOriginalAmount?: number; | ||
maxDiscountAmount?: number; | ||
}) | ||
``` | ||
### Virtual Account Services | ||
@@ -238,0 +258,0 @@ |
import { createCharge, captureCharge, getCharge } from './charge'; | ||
import { createRefund } from './refund'; | ||
import { createPromotion } from './promotion'; | ||
import { createAuthorization, reverseAuthorization } from './authorization'; | ||
@@ -19,2 +20,3 @@ import CardStatus from './card_status'; | ||
createRefund = createRefund; | ||
createPromotion = createPromotion; | ||
}; |
const { createCharge, captureCharge, getCharge } = require('./charge'); | ||
const { createPromotion } = require('./promotion'); | ||
const { | ||
@@ -35,3 +36,4 @@ createAuthorization, | ||
Card.prototype.createRefund = createRefund; | ||
Card.prototype.createPromotion = createPromotion; | ||
module.exports = Card; |
201818
172
5541
1304