Commit bcf07fe73d3d32deca0d05f10e80183b56569463

Authored by Jun Jiang
Committed by GitHub
2 parents 7078c92a cb635026
Exists in master

Merge pull request #58 from houdl/fix_invoke_refund

invoke_refund must have one transaction_idout_trade_no or transaction_id
Showing 1 changed file with 2 additions and 0 deletions   Show diff stats
lib/wx_pay/service.rb
... ... @@ -95,6 +95,7 @@ module WxPay
95 95 end
96 96  
97 97 INVOKE_REFUND_REQUIRED_FIELDS = [:out_refund_no, :total_fee, :refund_fee, :op_user_id]
  98 + # out_trade_no 和 transaction_id 是二选一(必填)
98 99 def self.invoke_refund(params, options = {})
99 100 params = {
100 101 appid: options.delete(:appid) || WxPay.appid,
... ... @@ -105,6 +106,7 @@ module WxPay
105 106 params[:op_user_id] ||= params[:mch_id]
106 107  
107 108 check_required_options(params, INVOKE_REFUND_REQUIRED_FIELDS)
  109 + warn("WxPay Warn: missing required option: out_trade_no or transaction_id must have one") if ([:out_trade_no, :transaction_id] & params.keys) == []
108 110  
109 111 options = {
110 112 ssl_client_cert: options.delete(:apiclient_cert) || WxPay.apiclient_cert,
... ...