Mercurial Hosting > luan
diff stripe/src/luan/modules/stripe/Stripe.luan @ 503:92c3d22745b8
make _ENV optional
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 20 May 2015 23:24:46 -0600 |
parents | 56c23aa70045 |
children | ca169567ce07 |
line wrap: on
line diff
--- a/stripe/src/luan/modules/stripe/Stripe.luan Tue May 19 17:57:20 2015 -0600 +++ b/stripe/src/luan/modules/stripe/Stripe.luan Wed May 20 23:24:46 2015 -0600 @@ -7,9 +7,11 @@ local Customer = require "java:com.stripe.model.Customer" local Charge = require "java:com.stripe.model.Charge" -currency = "usd" +local M = {} -function init(api_key) +M.currency = "usd" + +function M.init(api_key) Stripe.apiKey = api_key end @@ -53,22 +55,24 @@ end -function create_customer(params) +function M.create_customer(params) local java_customer = Customer.create(params) return customer_table(java_customer) end -function retrieve_customer(id) +function M.retrieve_customer(id) local java_customer = Customer.retrieve(id) return customer_table(java_customer) end -function create_charge(params) +function M.create_charge(params) params.amount or error "missing parameter 'amount'" params.amount = assert_integer(params.amount) - params.currency = params.currency or currency + params.currency = params.currency or M.currency local java_charge = Charge.create(params) return charge_table(java_charge) end +return M + -- http://javadox.com/com.stripe/stripe-java/1.2.1/overview-summary.html