Commit bcf07fe73d3d32deca0d05f10e80183b56569463
Committed by
GitHub
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,6 +95,7 @@ module WxPay | ||
95 | end | 95 | end |
96 | 96 | ||
97 | INVOKE_REFUND_REQUIRED_FIELDS = [:out_refund_no, :total_fee, :refund_fee, :op_user_id] | 97 | INVOKE_REFUND_REQUIRED_FIELDS = [:out_refund_no, :total_fee, :refund_fee, :op_user_id] |
98 | + # out_trade_no 和 transaction_id 是二选一(必填) | ||
98 | def self.invoke_refund(params, options = {}) | 99 | def self.invoke_refund(params, options = {}) |
99 | params = { | 100 | params = { |
100 | appid: options.delete(:appid) || WxPay.appid, | 101 | appid: options.delete(:appid) || WxPay.appid, |
@@ -105,6 +106,7 @@ module WxPay | @@ -105,6 +106,7 @@ module WxPay | ||
105 | params[:op_user_id] ||= params[:mch_id] | 106 | params[:op_user_id] ||= params[:mch_id] |
106 | 107 | ||
107 | check_required_options(params, INVOKE_REFUND_REQUIRED_FIELDS) | 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 | options = { | 111 | options = { |
110 | ssl_client_cert: options.delete(:apiclient_cert) || WxPay.apiclient_cert, | 112 | ssl_client_cert: options.delete(:apiclient_cert) || WxPay.apiclient_cert, |