allinpay_cnp 0.1.4 → 0.1.5

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: 761b711ff19735de05c502045113231b46fcfeb9d19846250332b7f0ac5796b8
4
- data.tar.gz: 2989b6abb28969795fb0bac8ba1f5d70a5dca67e9763df79dc70dc9353e02932
3
+ metadata.gz: eeeda5ea5ef28fb25989946746361e94d696c5c550175502a5b21758a04892dc
4
+ data.tar.gz: 034452c2f863fcc6d66ceb4d925d386a1644e1a93a3c5c61fcaeda02170f90fb
5
5
  SHA512:
6
- metadata.gz: 3ab98fa0152a023bc8f81154d8cc5d3318f2068f0581d34b0fbde9a87ed83b92d1409818e5ea7284d8352df49dfe2089983d4db0fcc2b32e6f37a64ab7007e73
7
- data.tar.gz: fcd529d01f205b5e2801e61ae68bfb1ba16645513cdb54c81e3dee009468d5a0d7ec0ae5fe64a4f6ccd63e8776bd522ccab767fd83e902afddc851a08c493012
6
+ metadata.gz: c07e269b643265cee50a9db7a446ea6ae44d85ec1e5bcad13ab647e7ac523f4a9cc3c38f2975ac64fccb9e51af61ef573988085864be7737fa31ae52c471d600
7
+ data.tar.gz: 01e7e53b849f4ee10f39618372228e9f52d961739f9dbdfce34dcdf82f9f554794cfbaf97a1d24d6e8e5856ba0df28aa8e3c77e5cdff44e4629ecbf310dc5504
@@ -32,10 +32,12 @@ module AllinpayCnp
32
32
 
33
33
  params = {
34
34
  version: VERSION,
35
+ instNo: inst_no_param,
35
36
  mchtId: merchant_no,
36
37
  transType: 'Query',
38
+ accessOrderId: generate_order_id,
37
39
  oriAccessOrderId: ori_access_order_id
38
- }
40
+ }.compact
39
41
  request.post(:quickpay, params)
40
42
  end
41
43
 
@@ -49,6 +51,7 @@ module AllinpayCnp
49
51
 
50
52
  params = {
51
53
  version: VERSION,
54
+ instNo: inst_no_param,
52
55
  mchtId: merchant_no,
53
56
  transType: 'Refund',
54
57
  accessOrderId: access_order_id,
@@ -71,6 +74,11 @@ module AllinpayCnp
71
74
  Time.now.to_i.to_s
72
75
  end
73
76
 
77
+ def inst_no_param
78
+ val = config.inst_no
79
+ (val.nil? || val.to_s.strip.empty?) ? nil : val.to_s.strip
80
+ end
81
+
74
82
  def config
75
83
  AllinpayCnp.config
76
84
  end
@@ -80,7 +88,7 @@ module AllinpayCnp
80
88
  end
81
89
 
82
90
  def build_unified_pay_params(access_order_id:, amount:, currency:, urls:, merchant_no: nil, **options)
83
- build_base_params(access_order_id, amount, currency, urls, options)
91
+ build_base_params(access_order_id, amount, currency, urls, options, merchant_no)
84
92
  .merge(build_shipping_params(options))
85
93
  .merge(build_billing_params(options))
86
94
  .compact
@@ -95,11 +103,12 @@ module AllinpayCnp
95
103
  def build_order_core_params(access_order_id, amount, currency, merchant_no = nil)
96
104
  {
97
105
  version: VERSION,
106
+ instNo: inst_no_param,
98
107
  mchtId: merchant_no || config.merchant_id,
99
108
  accessOrderId: access_order_id,
100
109
  amount: amount.to_s,
101
110
  currency: currency
102
- }
111
+ }.compact
103
112
  end
104
113
 
105
114
  def notify_return_urls(urls)
@@ -16,7 +16,7 @@ module AllinpayCnp
16
16
  def http_success?
17
17
  return false if @error
18
18
 
19
- @http_response&.success?
19
+ @http_response&.success? == true
20
20
  end
21
21
 
22
22
  def success?
@@ -52,7 +52,7 @@ module AllinpayCnp
52
52
  if key_content.include?('-----BEGIN')
53
53
  OpenSSL::PKey::RSA.new(key_content)
54
54
  else
55
- pem = '-----BEGIN PRIVATE KEY-----\n#{key_content}\n-----END PRIVATE KEY-----'
55
+ pem = "-----BEGIN PRIVATE KEY-----\n#{key_content}\n-----END PRIVATE KEY-----"
56
56
  OpenSSL::PKey::RSA.new(pem)
57
57
  end
58
58
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AllinpayCnp
4
- VERSION = '0.1.4'
4
+ VERSION = '0.1.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: allinpay_cnp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - DrinE
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-03 00:00:00.000000000 Z
11
+ date: 2026-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday