Created
February 6, 2016 18:23
-
-
Save wozozo/8517f743232afbf79989 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Charge from './charge'; | |
import Customer from './customer'; | |
import Plan from './plan'; | |
import Subscription from './subscription'; | |
import Token from './token'; | |
import Transfer from './transfer'; | |
import Event from './event'; | |
import Account from './account'; | |
export default class Payjp { | |
constructor(apikey, config = {}) { | |
if (!apikey) { | |
throw new Error('Please set apikey.'); | |
} | |
this.apikey = apikey; | |
this.config = ((config) => { | |
return { | |
apibase: config.apibase || 'https://api.pay.jp/v1' | |
}; | |
})(config); | |
this.charges = new Charge(this); | |
this.customers = new Customer(this); | |
this.plans = new Plan(this); | |
this.subscriptions = new Subscription(this); | |
this.tokens = new Token(this); | |
this.transfers = new Transfer(this); | |
this.events = new Event(this); | |
this.accounts = new Account(this); | |
} | |
call constructor(apikey, config = {}) { // eslint-disable-line | |
return new Payjp(apikey, config); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment