lib/suning_pay/service.rb in suning_pay-0.2.1 vs lib/suning_pay/service.rb in suning_pay-0.2.2

- old
+ new

@@ -3,11 +3,11 @@ class Service CURRENCY_CNY = 'CNY' PAYTYPE_IM = '01' #1.签约请求_发送短信接口 - def self.post_send_msg(bank_code, card_type, card_info, tunnel_data=nil, options = {}) + def self.post_send_msg(bank_code, card_type, card_info, tunnel_data = '', options = {}) #加密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, @@ -20,22 +20,22 @@ msg = SuningPay::Util.send_post('sendMsg', post_params) msg end #2.签约请求_验证短信接口 - def self.post_validate_sign(smg_code, serial_no, tunnel_data=nil, options = {}) + def self.post_validate_sign(smg_code, serial_no, tunnel_data = '', options = {}) input_hash = {:smgCode => smg_code, :serialNo => serial_no, :tunnelData => Base64.urlsafe_encode64(tunnel_data)} post_params = SuningPay.client_options.merge(options).merge(input_hash) #调用查询接口 msg = SuningPay::Util.send_post('validateSign', post_params) msg end #3.签约请求接口(易付宝不发短信) - def self.post_sign(bank_code, card_type, card_info, tunnel_data=nil, options = {}) + def self.post_sign(bank_code, card_type, card_info, tunnel_data = '', options = {}) #加密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, @@ -44,24 +44,24 @@ :tunnelData => Base64.urlsafe_encode64(tunnel_data)} post_params = SuningPay.client_options.merge(options).merge(input_hash) #调用查询接口 msg = SuningPay::Util.send_post('sign', post_params) - + msg end #4.解约请求接口 - def self.post_cancel(contract_no, tunnel_data=nil, options = {}) + def self.post_cancel(contract_no, tunnel_data = '', options = {}) input_hash = {:contractNo => contract_no, :tunnelData => Base64.urlsafe_encode64(tunnel_data)} post_params = SuningPay.client_options.merge(options).merge(input_hash) #调用查询接口 msg = SuningPay::Util.send_post('cancel', post_params) msg end #5.支付订单请求 - 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=nil, options = {}) + 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 = '', options = {}) input_hash = {:contractNo => contract_no, :outOrderNo => out_order_no, :orderType => order_type, :orderAmount => order_amount, :orderTime => order_time,