lib/qtpay/service.rb in qtpay-0.0.2 vs lib/qtpay/service.rb in qtpay-0.0.3

- old
+ new

@@ -57,10 +57,20 @@ def self.create_order(params, options = {}) make_request(:post, create_order_url(params, options)) end # ==== params ==== + # (required) + # auth_code: customer's authentication code being scanned + # + # other params are same as +create_order+ + + def self.micropay_order(params, options = {}) + make_request(:post, micropay_order_url(params, options)) + end + + # ==== params ==== # (optional) # token: auth token created in get_user_token, required when caller is app or h5 # order_id: either order_id or out_sn is required # out_sn: either order_id or out_sn is required @@ -96,9 +106,16 @@ CREATE_ORDER_REQUIRED_PARAMS = %w( token order_token total_amt pay_type pay_source goods_name ) def self.create_order_url(params, options = {}) params = handle_params(params, CREATE_ORDER_REQUIRED_PARAMS, options) request_uri('/order/v1/create', params, options) + end + + MICROPAY_ORDER_REQUIRED_PARAMS = %w( token order_token total_amt pay_type pay_source goods_name auth_code ) + def self.micropay_order_url(params, options = {}) + params = handle_params(params, MICROPAY_ORDER_REQUIRED_PARAMS, options) + + request_uri('/order/v1/micropay', params, options) end GET_ORDER_REQUIRED_PARAMS = %w() def self.get_order_url(params, options = {}) params = handle_params(params, GET_ORDER_REQUIRED_PARAMS, options) \ No newline at end of file