wechat_payment 2.0.2 → 2.0.3

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: c61c4ab32413e5389896bde1f772149d3df02e74c4cdcd76973ed942c6e25009
4
- data.tar.gz: b5d53616d2f40fa7c112ca57319f5d4c29606053ae291fb09aee8a8280674ea5
3
+ metadata.gz: 3ccc823e0ae167b60ffa78ba54e98c559c95c0019167a3c2e5033db6718f741b
4
+ data.tar.gz: 68e1de8aa02ac29ebc7d6012173dfdaa0162c493dbcb08f36e55db7909ef38b3
5
5
  SHA512:
6
- metadata.gz: 9265a884ffd5b9a544644400bac0e2c89c75b87803fb95d9542e8e0cbfce76c8688928b9aad3aeaf54c67b261a0c7cb99d0f2021a749a7207cd4a35a40380c0c
7
- data.tar.gz: 95e24b9a3941112ad5698a3cbbdf313c38f4755d0a2ecc0dcaca0c2ce4ddf62b4045bddac81b7fcdf24b394a4ede23d512b5db232436975f0165c60c08490df8
6
+ metadata.gz: 6dc4007ff8cbdd1cc8d347ed4d9193e43cddcf683192dae186ecf2b1f4511ce288acf40cffa6f10c66268382fb140f65d984ed9539a27388d6c258022f9c8b3b
7
+ data.tar.gz: 7655b449f9e31b5e481b174648ee6019753607addceb45ee0e4e848ce0d3aec11da6ddf1007694c80a51a005c817a3c927f910b3c95310830209ed1e05201d52
@@ -73,9 +73,16 @@ module WechatPayment
73
73
  # "orderId": 17
74
74
  # }
75
75
  def pay
76
+ if payment_params.present?
77
+ return ServiceResult.new(success: true, data: payment_params, message: "获取支付参数成功")
78
+ end
79
+
76
80
  order_result = WechatPayment::Service.new(self).order
77
81
  if order_result.success?
78
82
  payload = WechatPayment::Client.gen_js_pay_payload(order_result.data).merge(orderId: id).with_indifferent_access
83
+
84
+ update(payment_params: payload)
85
+
79
86
  WechatPayment::ServiceResult.new(success: true, data: payload)
80
87
  else
81
88
  order_result
@@ -203,7 +210,8 @@ module WechatPayment
203
210
  update(
204
211
  state: :paid,
205
212
  transaction_id: result["transaction_id"],
206
- paid_at: Time.current
213
+ paid_at: Time.current,
214
+ payment_params: nil
207
215
  )
208
216
 
209
217
  if goods.respond_to? :payment_exec_success
@@ -14,6 +14,7 @@ class CreateWechatPaymentPaymentOrders < ActiveRecord::Migration[6.1]
14
14
  t.string :state
15
15
  t.datetime :paid_at
16
16
  t.datetime :refunded_at
17
+ t.jsonb :payment_params
17
18
 
18
19
  t.timestamps
19
20
  end
@@ -1,3 +1,3 @@
1
1
  module WechatPayment
2
- VERSION = '2.0.2'
2
+ VERSION = '2.0.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wechat_payment
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ian