xendit-node
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -13,2 +13,3 @@ console.log('Starting integration test...'); // eslint-disable-line no-console | ||
require('./qr_code.test')(), | ||
require('./platform.test')(), | ||
]) | ||
@@ -15,0 +16,0 @@ .then(() => { |
{ | ||
"name": "xendit-node", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "NodeJS client for Xendit API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -66,2 +66,7 @@ # Xendit API Node.js Client | ||
+ [Simulate payment (only in dev mode)](#simulate-payment-only-in-dev-mode) | ||
* [XenPlatform Service](#xenplatform-service) | ||
+ [Create sub-accounts](#create-sub-accounts) | ||
+ [Set Callback URL](#set-callback-url) | ||
+ [Create transfers](#create-transfers) | ||
+ [Create fee rules](#create-fee-rules) | ||
- [Contributing](#contributing) | ||
@@ -760,2 +765,76 @@ | ||
### XenPlatform Service | ||
Instanitiate Platform service using constructor that has been injected with Xendit keys | ||
```js | ||
const { Platform } = x; | ||
const platformSpecificOptions = {}; | ||
const p = new Platform(platformSpecificOptions); | ||
``` | ||
Example: Creating a sub-account | ||
```js | ||
p.createAccount({ | ||
accountEmail: 'example@gmail.com', | ||
type: 'MANAGED', | ||
}) | ||
.then(({ user_id }) => { | ||
console.log(`Account created with ID: ${user_id}`); | ||
}) | ||
.catch(e => { | ||
console.error(`Account creation failed with message: ${e.message}`); | ||
}); | ||
``` | ||
Refer to [Xendit API Reference](https://xendit.github.io/apireference/#credit-cards) for more info about methods' parameters | ||
#### Create sub-accounts | ||
```ts | ||
p.createAccount(data: { | ||
accountEmail: string; | ||
type: AccountTypes; | ||
businessProfile?: { | ||
businessName: string; | ||
}; | ||
}) | ||
``` | ||
#### Set Callback URL | ||
```ts | ||
p.setCallbackURL(data: { | ||
type: string; | ||
url: string; | ||
forUserID?: string; | ||
}) | ||
``` | ||
#### Create transfers | ||
```ts | ||
p.createTransfer(data: { | ||
reference: string; | ||
amount: number; | ||
sourceUserID: string; | ||
destinationUserID: string; | ||
}) | ||
``` | ||
#### Create fee rules | ||
```ts | ||
p.createFeeRule(data: { | ||
name: string; | ||
description?: string; | ||
routes: Array<{ | ||
unit: string; | ||
amount: number; | ||
currency: string; | ||
}>; | ||
}) | ||
``` | ||
## Contributing | ||
@@ -762,0 +841,0 @@ |
@@ -0,1 +1,2 @@ | ||
import Errors from './errors'; | ||
import { CardService } from './card'; | ||
@@ -12,6 +13,7 @@ import { VAService } from './va'; | ||
import { QrCode } from './qr_code'; | ||
import { PlatformService } from './platform'; | ||
declare class Xendit { | ||
constructor(opts: XenditOptions); | ||
static Errors; | ||
static Errors: typeof Errors; | ||
Card: typeof CardService; | ||
@@ -27,3 +29,4 @@ VirtualAcc: typeof VAService; | ||
QrCode: typeof QrCode; | ||
Platform: typeof PlatformService; | ||
} | ||
export = Xendit; |
@@ -11,2 +11,3 @@ const { CardService } = require('./card'); | ||
const { QrCode } = require('./qr_code'); | ||
const { PlatformService } = require('./platform'); | ||
const Errors = require('./errors'); | ||
@@ -40,2 +41,3 @@ | ||
this.QrCode = QrCode._constructorWithInjectedXenditOpts(this.opts); | ||
this.Platform = PlatformService._constructorWithInjectedXenditOpts(this.opts); | ||
} | ||
@@ -42,0 +44,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
114525
115
2927
858