wechat_payment 2.0.4 → 2.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e310951e27fb21bc10f6f7c014d311dbef25b86229fb13c7f509e2670173185d
4
- data.tar.gz: f8385506631a6d621ad60a81cf3a7eca42bdfb27f811765e3b2c850fb97cde0a
3
+ metadata.gz: 87f4044d658d3093db1078f065765d207441d6556419de26fd6e7f88169a8467
4
+ data.tar.gz: 3bc5fbf36af300ca50c15e1ae37523df59da4aa6169f7cac57b696a59a8bfdb1
5
5
  SHA512:
6
- metadata.gz: 2e7ad1adc3f4e8cc1b720cc8cc78986320e76638ae66518657c0bf844dd21facc1e3bd83c65a1421b491780e2ccc2a33d19935a1279623da64bbce69c70f21cf
7
- data.tar.gz: b97d318c5628de5eeeb183f9a1dbb4dc37ba0a210534f302ba1c9e1c2e7950ed7208c1e2db9b91d12cbb4f12d60e6ffe4f573fc123a8fcb8469bd06bb69fa64a
6
+ metadata.gz: d87869b6dab7c779d1ec4a5f5de801989b5058f9e7f34e7eff4455fc641e2196e2ebc0d2894df5486ec8d1d829fca8e39cf65c91deac5f9c8d16096e774c86cb
7
+ data.tar.gz: 9cb4c3a15a3422ecfeb1a26d7eaafd20b7274de371b1241c42723b52bec8c7398a8ef56633986b977ebdc5172cdb0f63a73f8f961b11c95fcae7c6c860c7c304
@@ -14,10 +14,10 @@ module WechatPayment
14
14
 
15
15
  enum state: {
16
16
  paid: "paid",
17
- pending: "pending",
17
+ pending_pay: "pending_pay",
18
18
  refunded: "refunded",
19
19
  failed: "failed"
20
- }, _default: "pending"
20
+ }, _default: "pending_pay"
21
21
 
22
22
  # 将部分用户信息保存至订单
23
23
  def set_customer_info
@@ -109,7 +109,7 @@ module WechatPayment
109
109
 
110
110
  # 已退款的金额(包括正在退款的金额)
111
111
  def refunded_fee
112
- refund_orders.where(state: [:pending, :refunded]).sum(:refund_fee)
112
+ refund_orders.where(state: [:pending_refund, :refunded]).sum(:refund_fee)
113
113
  end
114
114
 
115
115
  # 实际已退的金额
@@ -8,10 +8,10 @@ module WechatPayment
8
8
  belongs_to :customer, polymorphic: true
9
9
 
10
10
  enum state: {
11
- pending: "pending",
11
+ pending_refund: "pending_refund",
12
12
  refunded: "refunded",
13
13
  failed: "failed"
14
- }, _default: :pending
14
+ }, _default: "pending_refund"
15
15
 
16
16
  # 生成退款编号
17
17
  def gen_out_refund_no
@@ -62,7 +62,7 @@ module WechatPayment
62
62
 
63
63
  update(
64
64
  refund_id: result["refund_id"],
65
- state: :pending
65
+ state: :pending_refund
66
66
  )
67
67
 
68
68
  result
@@ -44,7 +44,7 @@ module WechatPayment
44
44
  result = WechatPayment::Client.handle_payment_notify(notify_data)
45
45
  payment_order = WechatPayment::PaymentOrder.find_by(out_trade_no: notify_data["out_trade_no"])
46
46
 
47
- if result.success? && payment_order.pending?
47
+ if result.success? && payment_order.pending_pay?
48
48
  payment_order.with_lock do
49
49
  payment_order.payment_exec_success(result.data)
50
50
  end
@@ -60,7 +60,7 @@ module WechatPayment
60
60
  result = WechatPayment::Client.handle_refund_notify(notify_data)
61
61
  refund_order = WechatPayment::RefundOrder.find_by(out_refund_no: result.data["out_refund_no"])
62
62
 
63
- if result.success? && refund_order.pending?
63
+ if result.success? && refund_order.pending_refund?
64
64
  refund_order.with_lock do
65
65
  refund_order.refund_exec_success(result.data)
66
66
  end
@@ -49,20 +49,20 @@ module WechatPayment
49
49
 
50
50
  # 重新支付,应用场景是: 用户取消了支付后,使用最后一张订单进行支付
51
51
  # @return [WechatPayment::ServiceResult]
52
- def repay
53
- # 如果不是待支付状态
54
- unless pending?
55
- WechatPayment::ServiceResult.new(message: "当前状态不可支付")
56
- end
57
-
58
- result = payment_orders.last.repay
59
-
60
- if result.success?
61
- WechatPayment::ServiceResult.new(success: true, data: result.data[:js_payload])
62
- else
63
- WechatPayment::ServiceResult.new(message: result.errors.first[:err_code_des])
64
- end
65
- end
52
+ # def repay
53
+ # # 如果不是待支付状态
54
+ # unless pending?
55
+ # WechatPayment::ServiceResult.new(message: "当前状态不可支付")
56
+ # end
57
+
58
+ # result = payment_orders.last.repay
59
+
60
+ # if result.success?
61
+ # WechatPayment::ServiceResult.new(success: true, data: result.data[:js_payload])
62
+ # else
63
+ # WechatPayment::ServiceResult.new(message: result.errors.first[:err_code_des])
64
+ # end
65
+ # end
66
66
 
67
67
 
68
68
  # 退款
@@ -1,3 +1,3 @@
1
1
  module WechatPayment
2
- VERSION = '2.0.4'
2
+ VERSION = '2.0.8'
3
3
  end
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.4
4
+ version: 2.0.8
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-19 00:00:00.000000000 Z
11
+ date: 2022-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails