wechat_payment 2.0.10 → 2.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8712e877d54c4964bc93daf8e3fa4df1bc57cbc794811cbfbf096661297d68ec
4
- data.tar.gz: '0878c15e6c7a6b13a8aff61753bf87c31328d0d3686d5b3900ac0e5c199a2589'
3
+ metadata.gz: 383f51dd9ca42a1ef6dd1231871e604fc7d985fba7990b5750759e698c5b9e8b
4
+ data.tar.gz: 4adbdbfbc709dc96cf6df6a038f721589fa7f11b7dfb8d744685b01bc16060b1
5
5
  SHA512:
6
- metadata.gz: 4cafd39213ccee668a34e2650699663444d1df8d627e070f87e30e8a24433a695f0c2b638d135867e6bfb40dcf4e626c0110017662d429d9943ef54933683cf8
7
- data.tar.gz: ade54ef7701156d7fa899df557d1b5b3333693790ff03d117462eea1d94b524bee9841d3ade7d51b70d10a03a00df27a129032bd519219ff7d892054d4658228
6
+ metadata.gz: 90b55232826903f31a1aca89a4d67e620ff3a9ba73f62c7d53916f2da30b12fe3612827c5883974f8cec8a1c7bd6efad715988f3c732baa333f8c690985b32cd
7
+ data.tar.gz: aa71fc09c2d6fe3e8b0db85758c3a9aa4a42a0f1d38fa01691357171590b8608db3635b6240a224110f95830f512cd58a9307e71f9f0f8a49ff2820ef7151152
@@ -10,7 +10,7 @@ module WechatPayment
10
10
  if process_result.success?
11
11
  render xml: { return_code: "SUCCESS" }.to_xml(root: 'xml', dasherize: false)
12
12
  else
13
- render xml: { return_code: "FAIL", return_msg: process_result.errors.first }.to_xml(root: 'xml', dasherize: false)
13
+ render xml: { return_code: "FAIL", return_msg: process_result.error.first }.to_xml(root: 'xml', dasherize: false)
14
14
  end
15
15
  end
16
16
 
@@ -21,7 +21,7 @@ module WechatPayment
21
21
  if refund_result.success?
22
22
  render xml: {return_code: "SUCCESS"}.to_xml(root: 'xml', dasherize: false)
23
23
  else
24
- render xml: {return_code: "FAIL", return_msg: refund_result.errors.first}.to_xml(root: 'xml', dasherize: false)
24
+ render xml: {return_code: "FAIL", return_msg: refund_result.error.first}.to_xml(root: 'xml', dasherize: false)
25
25
  end
26
26
 
27
27
  end
@@ -1,5 +1,5 @@
1
1
 
2
- class PaymentOrdersController < ApplicationController
2
+ class WechatPayment::PaymentOrdersController < ApplicationController
3
3
  def index
4
4
  @payment_orders = WechatPayment::PaymentOrder.by_state(params[:state])
5
5
 
@@ -28,7 +28,7 @@ module WechatPayment
28
28
  # 生成交易编号
29
29
  def gen_out_trade_no
30
30
  loop do
31
- out_trade_no = "#{Time.current.to_i}#{SecureRandom.random_number(999_999_999)}"
31
+ out_trade_no = "#{WechatPayment.order_no_prefix}#{Time.current.to_i}#{SecureRandom.random_number(999_999_999)}"
32
32
  records_count = WechatPayment::PaymentOrder.where(out_trade_no: out_trade_no).count
33
33
  if records_count == 0
34
34
  self.out_trade_no = out_trade_no
@@ -15,7 +15,7 @@ module WechatPayment
15
15
  if order_result.success?
16
16
  payment_order.payment_apply_success(order_result.data)
17
17
  else
18
- payment_order.payment_apply_failure(order_result.errors)
18
+ payment_order.payment_apply_failure(order_result.error)
19
19
  end
20
20
 
21
21
  order_result
@@ -33,7 +33,7 @@ module WechatPayment
33
33
  if refund_result.success?
34
34
  refund_order.refund_apply_success(refund_result.data)
35
35
  else
36
- refund_order.refund_apply_failure(refund_result.errors)
36
+ refund_order.refund_apply_failure(refund_result.error)
37
37
  end
38
38
 
39
39
  refund_result
@@ -49,7 +49,7 @@ module WechatPayment
49
49
  payment_order.payment_exec_success(result.data)
50
50
  end
51
51
  else
52
- payment_order.payment_exec_failure(result.errors)
52
+ payment_order.payment_exec_failure(result.error)
53
53
  end
54
54
 
55
55
  result
@@ -65,7 +65,7 @@ module WechatPayment
65
65
  refund_order.refund_exec_success(result.data)
66
66
  end
67
67
  else
68
- refund_order.refund_exec_failure(result.errors)
68
+ refund_order.refund_exec_failure(result.error)
69
69
  end
70
70
 
71
71
  result
@@ -16,4 +16,7 @@ WechatPayment.setup do |config|
16
16
  config.sub_appid = "wx8f9f912623456789"
17
17
  config.sub_mch_id = "1234911291"
18
18
  config.sub_app_secret = "88888231e2f3a21152d163f61b99999"
19
+
20
+ # 生成的订单编号前缀
21
+ # config.order_no_prefix = "wx_"
19
22
  end
@@ -65,7 +65,7 @@ module WechatPayment
65
65
  WechatPayment::ServiceResult.new(success: true, data: refund_result)
66
66
  else
67
67
  refund_logger.error "{params: #{refund_params}, result: #{refund_result}"
68
- WechatPayment::ServiceResult.new(success: false, errors: refund_result)
68
+ WechatPayment::ServiceResult.new(success: false, error: refund_result)
69
69
  end
70
70
  end
71
71
 
@@ -77,7 +77,7 @@ module WechatPayment
77
77
  # 处理支付回调
78
78
  def self.handle_payment_notify(notify_data)
79
79
  if !WechatPayment::Sign.verify?(notify_data)
80
- payment_logger.error("{msg: 签名验证失败, errors: #{notify_data}}")
80
+ payment_logger.error("{msg: 签名验证失败, error: #{notify_data}}")
81
81
  WechatPayment::ServiceResult.new(success: false, error: notify_data, message: "回调签名验证失败")
82
82
  end
83
83
 
@@ -1,3 +1,3 @@
1
1
  module WechatPayment
2
- VERSION = '2.0.10'
2
+ VERSION = '2.0.14'
3
3
  end
@@ -5,7 +5,7 @@ module WechatPayment
5
5
 
6
6
  class << self
7
7
  attr_reader :apiclient_cert, :apiclient_key
8
- attr_accessor :appid, :app_secret, :mch_id, :sub_appid, :sub_app_secret, :sub_mch_id, :key, :cert_path, :host
8
+ attr_accessor :appid, :app_secret, :mch_id, :sub_appid, :sub_app_secret, :sub_mch_id, :key, :cert_path, :host, :order_no_prefix
9
9
  end
10
10
 
11
11
  def self.setup
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wechat_payment
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.10
4
+ version: 2.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - ian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-20 00:00:00.000000000 Z
11
+ date: 2022-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails