wechat_payment 2.1.0 → 2.1.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 553d692e4ca6343ab5659e22bf5cf76c734dc1d4109cae1ceeb5426b4f1bff9a
|
4
|
+
data.tar.gz: dc9290c8e36be4e101600126b8080676fc86a5145582e7272081819c826bc5dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 874bce827cb9a321d398ae57cfb3a073c5a6368bccdcc44e0092c8a972cbf14bb248aa183ae560cf2b4532a2178d67f460d51400a4e04ebcf02a04cf57316cbd
|
7
|
+
data.tar.gz: 6bfd37db07f20ca87bfb210249e36170e4cad6fef2904106d46034e6c539b1cfae3a6e891f4cabb1276aaa5f2976592969b79667dbc94584aeab6d543f5a9f62
|
@@ -21,11 +21,13 @@ module WechatPayment
|
|
21
21
|
|
22
22
|
if order_result.success?
|
23
23
|
message = "发起支付成功"
|
24
|
-
|
24
|
+
log_content = { message:, params: order_params, result: order_result }.to_json
|
25
|
+
WechatPayment::PaymentLogger.info { log_content }
|
25
26
|
WechatPayment::SuccessResult.new(data: order_result, message:, message_kind: :payment_apply_success)
|
26
27
|
else
|
27
28
|
message = "发起支付失败"
|
28
|
-
|
29
|
+
log_content = { message: , params: order_params, result: order_result }.to_json
|
30
|
+
WechatPayment::PaymentLogger.error { log_content }
|
29
31
|
WechatPayment::FailureResult.new(error: order_result, message:, message_kind: :payment_apply_failed)
|
30
32
|
end
|
31
33
|
end
|
@@ -46,11 +48,13 @@ module WechatPayment
|
|
46
48
|
|
47
49
|
if refund_result.success?
|
48
50
|
message = '发起退款成功'
|
49
|
-
|
51
|
+
log_content = { message:, params: refund_params, result: refund_result}.to_json
|
52
|
+
WechatPayment::RefundLogger.info { log_content }
|
50
53
|
WechatPayment::SuccessResult.new(data: refund_result, message:, message_kind: :refund_apply_success)
|
51
54
|
else
|
52
55
|
message = "发起退款失败"
|
53
|
-
|
56
|
+
log_content = { message:, params: refund_params, result: refund_result }.to_json
|
57
|
+
WechatPayment::RefundLogger.error { log_content }
|
54
58
|
WechatPayment::FailureResult.new(error: refund_result, message:, message_kind: :refund_apply_failed)
|
55
59
|
end
|
56
60
|
end
|
@@ -64,18 +68,20 @@ module WechatPayment
|
|
64
68
|
def self.handle_payment_notify(notify_data)
|
65
69
|
if !WechatPayment::Sign.verify?(notify_data)
|
66
70
|
message = "回调签名验证失败"
|
67
|
-
WechatPayment::PaymentLogger.error {
|
71
|
+
WechatPayment::PaymentLogger.error { { message: , error: notify_data }.to_json }
|
68
72
|
WechatPayment::FailureResult.new(error: notify_data, message:, message_kind: :validate_sign_failed)
|
69
73
|
end
|
70
74
|
|
71
75
|
result = WechatPayment::InvokeResult.new(notify_data)
|
72
76
|
if result.success?
|
73
77
|
message = "支付执行成功"
|
74
|
-
|
78
|
+
log_content = { message:, callback: notify_data }.to_json
|
79
|
+
WechatPayment::PaymentLogger.info { log_content }
|
75
80
|
WechatPayment::SuccessResult.new(data: notify_data, message:, message_kind: :payment_exec_success)
|
76
81
|
else
|
77
82
|
message = "支付执行失败"
|
78
|
-
|
83
|
+
log_content = { message:, callback: notify_data }.to_json
|
84
|
+
WechatPayment::PaymentLogger.error { log_content }
|
79
85
|
WechatPayment::FailureResult.new(error: notify_data, message:, message_kind: :payment_exec_failed)
|
80
86
|
end
|
81
87
|
end
|
@@ -87,11 +93,13 @@ module WechatPayment
|
|
87
93
|
result = WechatPayment::InvokeResult.new(notify_data)
|
88
94
|
if result.success?
|
89
95
|
message = "退款执行成功"
|
90
|
-
|
96
|
+
log_content = { message:, callback: notify_data }.to_json
|
97
|
+
WechatPayment::RefundLogger.info { log_content }
|
91
98
|
WechatPayment::SuccessResult.new(data: notify_data, message:, message_kind: :refund_exec_success)
|
92
99
|
else
|
93
100
|
message = "退款执行失败"
|
94
|
-
|
101
|
+
log_content = { message:, callback: notify_data}.to_json
|
102
|
+
WechatPayment::RefundLogger.error { log_content }
|
95
103
|
WechatPayment::FailureResult.new(error: notify_data, message:, message_kind: :refund_exec_failed)
|
96
104
|
end
|
97
105
|
end
|
@@ -42,7 +42,13 @@ module WechatPayment
|
|
42
42
|
)
|
43
43
|
|
44
44
|
unless user_goods.save
|
45
|
-
|
45
|
+
log_content = {
|
46
|
+
message: "商品中间表 #{user_goods_model.table_name} 插入数据失败",
|
47
|
+
error: user_goods.errors.full_messages
|
48
|
+
}.to_json
|
49
|
+
|
50
|
+
WechatPayment::Logger.info { log_content }
|
51
|
+
return WechatPayment::FailureResult.new(error: user_goods.errors.full_messages,
|
46
52
|
message: "商品中间表 #{user_goods_model.table_name} 插入数据失败",
|
47
53
|
message_kind: :create_user_goods_failed)
|
48
54
|
end
|
@@ -59,7 +65,9 @@ module WechatPayment
|
|
59
65
|
WechatPayment::SuccessResult.new(data: payment_order, message:, message_kind: :create_payment_order_success)
|
60
66
|
else
|
61
67
|
message = "支付订单创建失败"
|
62
|
-
|
68
|
+
log_content = { message:, error: payment_order.errors.full_messages }.to_json
|
69
|
+
WechatPayment::Logger.error { log_content }
|
70
|
+
WechatPayment::FailureResult.new(error: user_goods.errors.full_messages, message:, message_kind: :create_payment_order_failed)
|
63
71
|
end
|
64
72
|
end
|
65
73
|
|
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.1.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -98,7 +98,6 @@ files:
|
|
98
98
|
- lib/wechat_payment/logger.rb
|
99
99
|
- lib/wechat_payment/missing_key_error.rb
|
100
100
|
- lib/wechat_payment/payment_logger.rb
|
101
|
-
- lib/wechat_payment/r_logger.rb
|
102
101
|
- lib/wechat_payment/refund_logger.rb
|
103
102
|
- lib/wechat_payment/service_result.rb
|
104
103
|
- lib/wechat_payment/sign.rb
|
@@ -126,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
125
|
- !ruby/object:Gem::Version
|
127
126
|
version: '0'
|
128
127
|
requirements: []
|
129
|
-
rubygems_version: 3.3.
|
128
|
+
rubygems_version: 3.3.13
|
130
129
|
signing_key:
|
131
130
|
specification_version: 4
|
132
131
|
summary: Summary of WechatPayment.
|
@@ -1,36 +0,0 @@
|
|
1
|
-
module WechatPayment
|
2
|
-
class RLogger
|
3
|
-
def initialize
|
4
|
-
raise Exceptions::InitializeDenied.new("please use 'ILogger.make' instead of 'ILogger.new'")
|
5
|
-
end
|
6
|
-
|
7
|
-
class << self
|
8
|
-
def make(log_file)
|
9
|
-
@logger ||= {}
|
10
|
-
|
11
|
-
log_file_name = if log_file.class.in? [String, Symbol]
|
12
|
-
log_file_name = log_file.to_sym
|
13
|
-
|
14
|
-
unless log_file_name.to_s.end_with? ".log"
|
15
|
-
log_file_name = "#{log_file_name}.log"
|
16
|
-
end
|
17
|
-
|
18
|
-
"#{root_path}/#{log_file_name}"
|
19
|
-
elsif log_file.respond_to? :to_path
|
20
|
-
log_file.to_path
|
21
|
-
else
|
22
|
-
raise Exceptions::UnsupportdParamType.new("log file parameter only support 'File' or 'String' Type.")
|
23
|
-
end
|
24
|
-
|
25
|
-
# 如果已经存在日志对象,则返回已有的日志对象
|
26
|
-
@logger[log_file_name] ||= ::Logger.new(log_file_name)
|
27
|
-
end
|
28
|
-
|
29
|
-
def root_path
|
30
|
-
@root ||= "#{Rails.root}/log"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
|
35
|
-
end
|
36
|
-
end
|