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

- old
+ new

@@ -67,11 +67,26 @@ def self.micropay_order(params, options = {}) make_request(:post, micropay_order_url(params, options)) end # ==== params ==== + # (required) + # total_amt: total payment amount in cents + # out_sn: order serial number, must be uniq in all requests + # goods_name: name of goods + # token: auth token created in get_user_token + # # (optional) + # expire_time: order expires time, format YYYY-mm-dd HH:MM:SS + # goods_info + + def self.create_simple_order(params, options = {}) + make_request(:post, create_simple_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 def self.get_order(params, options ={}) @@ -114,9 +129,17 @@ def self.micropay_order_url(params, options = {}) params = handle_params(params, MICROPAY_ORDER_REQUIRED_PARAMS, options) request_uri('/order/v1/micropay', params, options) end + + CREATE_SIMPLE_ORDER_REQUIRED_PARAMS = %w( out_sn total_amt goods_name token ) + def self.create_simple_order_url(params, options = {}) + params = handle_params(params, CREATE_SIMPLE_ORDER_REQUIRED_PARAMS, options) + + request_uri('/order/v1/simple_create', 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