Class: SuningPay::Service
- Inherits:
-
Object
- Object
- SuningPay::Service
- Defined in:
- lib/suning_pay/service.rb
Constant Summary collapse
- CURRENCY_CNY =
'CNY'
- PAYTYPE_IM =
'01'
Class Method Summary collapse
-
.post_cancel(contract_no, tunnel_data = '', options = {}) ⇒ Object
4.解约请求接口.
-
.post_pay(contract_no, out_order_no, order_type, order_amount, order_time, saler_merchant_no, goods_type, goods_name, pay_timeout, remark, tunnel_data = '', options = {:version => '2.0'}) ⇒ Object
5.支付订单请求(默认使用2.0版本).
-
.post_query_channel(product_code, options = {}) ⇒ Object
7.支持银行查询接口.
-
.post_query_merchant_order(out_order_no, order_time, options = {:version => '1.2'}) ⇒ Object
6.支付订单查询接口.
-
.post_send_msg(bank_code, card_type, card_info, tunnel_data = '', options = {}) ⇒ Object
1.签约请求_发送短信接口.
-
.post_sign(bank_code, card_type, card_info, tunnel_data = '', options = {}) ⇒ Object
3.签约请求接口(易付宝不发短信).
-
.post_validate_sign(smg_code, serial_no, tunnel_data = '', options = {}) ⇒ Object
2.签约请求_验证短信接口.
Class Method Details
.post_cancel(contract_no, tunnel_data = '', options = {}) ⇒ Object
4.解约请求接口
53 54 55 56 57 58 59 60 |
# File 'lib/suning_pay/service.rb', line 53 def self.post_cancel(contract_no, tunnel_data = '', = {}) input_hash = {:contractNo => contract_no, :tunnelData => Base64.urlsafe_encode64(tunnel_data)} post_params = SuningPay..merge().merge(input_hash) #调用查询接口 msg = SuningPay::Util.send_post('cancel', post_params) msg end |
.post_pay(contract_no, out_order_no, order_type, order_amount, order_time, saler_merchant_no, goods_type, goods_name, pay_timeout, remark, tunnel_data = '', options = {:version => '2.0'}) ⇒ Object
5.支付订单请求(默认使用2.0版本)
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/suning_pay/service.rb', line 63 def self.post_pay(contract_no, out_order_no, order_type, order_amount, order_time, saler_merchant_no, goods_type, goods_name, pay_timeout, remark, tunnel_data = '', = {:version => '2.0'}) input_hash = {:contractNo => contract_no, :outOrderNo => out_order_no, :orderType => order_type, :orderAmount => order_amount, :orderTime => order_time, :currency => CURRENCY_CNY, :salerMerchantNo => saler_merchant_no, :goodsType => goods_type, :goodsName => Base64.urlsafe_encode64(goods_name), :payTimeout => pay_timeout, :remark => Base64.urlsafe_encode64(remark), :tunnelData => Base64.urlsafe_encode64(tunnel_data)} post_params = SuningPay..merge().merge(input_hash) #调用查询接口 msg = SuningPay::Util.send_post('pay', post_params) msg end |
.post_query_channel(product_code, options = {}) ⇒ Object
7.支持银行查询接口
95 96 97 98 99 100 101 |
# File 'lib/suning_pay/service.rb', line 95 def self.post_query_channel(product_code, = {}) input_hash = {:productCode => product_code} post_params = SuningPay..merge().merge(input_hash) #调用查询接口 msg = SuningPay::Util.send_post('queryChannel', post_params) msg end |
.post_query_merchant_order(out_order_no, order_time, options = {:version => '1.2'}) ⇒ Object
6.支付订单查询接口
84 85 86 87 88 89 90 91 92 |
# File 'lib/suning_pay/service.rb', line 84 def self.post_query_merchant_order(out_order_no, order_time, = {:version => '1.2'}) input_hash = {:outOrderNo => out_order_no, :orderTime => order_time} post_params = SuningPay..merge().merge(input_hash) #调用查询接口 msg = SuningPay::Util.send_post('queryMerchantOrder.do', post_params, SuningPay::API_CODE_Q_PAY) msg end |
.post_send_msg(bank_code, card_type, card_info, tunnel_data = '', options = {}) ⇒ Object
1.签约请求_发送短信接口
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/suning_pay/service.rb', line 8 def self.post_send_msg(bank_code, card_type, card_info, tunnel_data = '', = {}) #加密cardinfo suning_pub_key = SuningPay.api_suning_public_key encr_msg = SuningPay::RSA.encrypt_msg(suning_pub_key, card_info) input_hash = {:bankCode => bank_code, :cardType => card_type, :cardInfo => encr_msg, :tunnelData => Base64.urlsafe_encode64(tunnel_data)} post_params = SuningPay..merge().merge(input_hash) #调用查询接口 msg = SuningPay::Util.send_post('sendMsg', post_params) msg end |
.post_sign(bank_code, card_type, card_info, tunnel_data = '', options = {}) ⇒ Object
3.签约请求接口(易付宝不发短信)
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/suning_pay/service.rb', line 36 def self.post_sign(bank_code, card_type, card_info, tunnel_data = '', = {}) #加密cardinfo suning_pub_key = SuningPay.api_suning_public_key encr_msg = SuningPay::RSA.encrypt_msg(suning_pub_key, card_info) input_hash = {:bankCode => bank_code, :cardType => card_type, :cardInfo => encr_msg, :tunnelData => Base64.urlsafe_encode64(tunnel_data)} post_params = SuningPay..merge().merge(input_hash) #调用查询接口 msg = SuningPay::Util.send_post('sign', post_params) msg end |
.post_validate_sign(smg_code, serial_no, tunnel_data = '', options = {}) ⇒ Object
2.签约请求_验证短信接口
25 26 27 28 29 30 31 32 33 |
# File 'lib/suning_pay/service.rb', line 25 def self.post_validate_sign(smg_code, serial_no, tunnel_data = '', = {}) input_hash = {:smgCode => smg_code, :serialNo => serial_no, :tunnelData => Base64.urlsafe_encode64(tunnel_data)} post_params = SuningPay..merge().merge(input_hash) #调用查询接口 msg = SuningPay::Util.send_post('validateSign', post_params) msg end |