-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
239 additions
and
263 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
'use strict'; | ||
|
||
let omise = require('../index')({ | ||
'publicKey': process.env.OMISE_PUBLIC_KEY, | ||
'secretKey': process.env.OMISE_SECRET_KEY, | ||
}); | ||
const omise = require('./index'); | ||
|
||
let customer = { | ||
email: '[email protected]', | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
'use strict'; | ||
|
||
let omise = require('../index')({ | ||
'publicKey': process.env.OMISE_PUBLIC_KEY, | ||
'secretKey': process.env.OMISE_SECRET_KEY, | ||
}); | ||
const omise = require('./index'); | ||
|
||
omise.customers.destroy('cust_test_4yxn6vblxh83h605oxz', function(err, resp) { | ||
omise.customers.destroy('cust_60458v5p9fhyx3z4yp7', function(err, resp) { | ||
if (err) { | ||
console.log(err); | ||
} | ||
console.log(resp); | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const dotenv = require("dotenv"); | ||
dotenv.config(); | ||
|
||
const omise = require("../index")({ | ||
publicKey: process.env.OMISE_PUBLIC_KEY, | ||
secretKey: process.env.OMISE_SECRET_KEY, | ||
host: process.env.OMISE_NODE_HOST, | ||
}); | ||
|
||
module.exports = omise; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
'use strict'; | ||
"use strict"; | ||
|
||
let omise = require('../index')({ | ||
'publicKey': process.env.OMISE_PUBLIC_KEY, | ||
'secretKey': process.env.OMISE_SECRET_KEY, | ||
}); | ||
const omise = require("./index"); | ||
|
||
omise.customers.listCards('cust_test_53reuowpjglur236wm7', | ||
{'order': 'reverse_chronological'}, | ||
function(e, resp) { | ||
omise.customers.listCards( | ||
"cust_60dw2h7vc8pwuiy9hag", | ||
{ order: "reverse_chronological" }, | ||
function (err, resp) { | ||
if (err) { | ||
console.log(err); | ||
} | ||
console.log(resp); | ||
}); | ||
} | ||
); |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
'use strict'; | ||
|
||
let omise = require('../index')({ | ||
'publicKey': process.env.OMISE_PUBLIC_KEY, | ||
'secretKey': process.env.OMISE_SECRET_KEY, | ||
}); | ||
const omise = require('./index'); | ||
|
||
omise.customers.list(function(err, resp) { | ||
omise.customers.list({limit: 2}, function(err, resp) { | ||
console.log(resp); | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use strict'; | ||
|
||
const omise = require('./index'); | ||
|
||
omise.recipients.list({limit: 2}, function(err, resp) { | ||
console.log(resp); | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,10 @@ | ||
'use strict'; | ||
|
||
const omise = require('../index')({ | ||
'publicKey': process.env.OMISE_PUBLIC_KEY, | ||
'secretKey': process.env.OMISE_SECRET_KEY, | ||
}); | ||
const omise = require('./index'); | ||
|
||
omise.balance.retrieve((err, resp) => { | ||
if (err) { | ||
console.log(err) | ||
console.log(err); | ||
} | ||
console.log(resp); | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
'use strict'; | ||
|
||
let omise = require('../index')({ | ||
'publicKey': process.env.OMISE_PUBLIC_KEY, | ||
'secretKey': process.env.OMISE_SECRET_KEY, | ||
}); | ||
const omise = require('./index'); | ||
|
||
omise.customers.retrieve('cust_test_4z33o46lqreryhqua8w', function(err, resp) { | ||
omise.customers.retrieve('cust_60dw2h7vc8pwuiy9hag', function(err, resp) { | ||
console.log(resp); | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
'use strict'; | ||
"use strict"; | ||
|
||
let omise = require('../index')({ | ||
'publicKey': process.env.OMISE_PUBLIC_KEY, | ||
'secretKey': process.env.OMISE_SECRET_KEY, | ||
}); | ||
const omise = require("./index"); | ||
|
||
let updateParams = {description: 'the other description'}; | ||
let updateParams = { description: "the other description" }; | ||
|
||
omise.customers.update('cust_test_4z2owmajzsb3c527wj7', updateParams, | ||
function(err, resp) { | ||
omise.customers.update( | ||
"cust_60dw2h7vc8pwuiy9hag", | ||
updateParams, | ||
function (err, resp) { | ||
console.log(resp); | ||
}); | ||
} | ||
); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,32 @@ | ||
import omise = require('../index'); | ||
import { Charges, Customers, Tokens } from "../index"; | ||
import omise from "./index"; | ||
|
||
let cardDetails: omise.Tokens.IRequest; | ||
cardDetails = { | ||
const cardDetails:Tokens.IRequest = { | ||
card: { | ||
city: 'Bangkok', | ||
expiration_month: 2, | ||
expiration_year: 2017, | ||
expiration_year: 2027, | ||
name: 'JOHN DOE', | ||
number: '4242424242424242', | ||
postal_code: '10320', | ||
security_code: '130', | ||
}, | ||
}; | ||
|
||
const omiseStatic = omise({ | ||
publicKey: process.env.OMISE_PUBLIC_KEY, | ||
secretKey: process.env.OMISE_SECRET_KEY, | ||
}); | ||
|
||
omiseStatic.tokens.create(cardDetails).then((token) => { | ||
return omiseStatic.customers.create({ | ||
omise.tokens.create(cardDetails).then((token: Tokens.IToken) => { | ||
return omise.customers.create({ | ||
card: token.id, | ||
description: 'John Doe (id: 30)', | ||
email: '[email protected]', | ||
}); | ||
}).then((customer) => { | ||
return omiseStatic.charges.create({ | ||
}).then((customer: Customers.ICustomer) => { | ||
return omise.charges.create({ | ||
amount: 10000, | ||
currency: 'thb', | ||
customer: customer.id, | ||
}); | ||
}).then((charge) => { | ||
}).then((charge: Charges.ICharge) => { | ||
console.log(charge); | ||
}).catch((err) => { | ||
}).catch((err: Error | null) => { | ||
console.log(err); | ||
}); |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
import omiseNode = require('../index'); | ||
|
||
const omise = omiseNode({ | ||
publicKey: process.env.OMISE_PUBLIC_KEY, | ||
secretKey: process.env.OMISE_SECRET_KEY, | ||
}); | ||
import omise from "./index"; | ||
import { Customers } from "../index"; | ||
|
||
const customer = { | ||
description: 'John Doe (id: 30)', | ||
email: '[email protected]', | ||
}; | ||
|
||
omise.customers.create(customer, (err, resp) => { | ||
omise.customers.create(customer, (err: Error | null, resp: Customers.ICustomerList) => { | ||
if (err) { | ||
console.log(err); | ||
} | ||
console.log(resp); | ||
}); |
Oops, something went wrong.