offsite_payments 2.7.28 → 3.0.0

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: 7d6f15a62a3d0c2744b89d969b27b4211d3308edd81175447fd2c9609c191787
4
- data.tar.gz: cb1dff98006362f1f80fb9d9957dff0e049d6a401658f4544c112f538de1c5ee
3
+ metadata.gz: 5a045a98fd10c22d309a48cf2ecf4d9d6fc612d28adac50bd3896d6a2db34f49
4
+ data.tar.gz: a6982ef987e443c0eae1d1f78bfc35bba6bdecea24f8a2ca177b36509225cab1
5
5
  SHA512:
6
- metadata.gz: 572f3afcfb7d6d22cbf0097d778996d727091e831a534f1e1f9f6e7a2063cac9091588026ffb9430664138c906fadba86b4d52d7a6499bb7cdcc576d8ab22c3f
7
- data.tar.gz: e0701df36a24581fa8530529f017e3eb550c4e76abab0ca74265637e5cf57109d6094c661f0fa7f92f29876b7388594d6ac744f980608f1193133b3bb75ac516
6
+ metadata.gz: 4cc1411ae98b5e8c9ede9f4c4e7ef759186a779b95917c2e2e18ad160077dbd5baa83d1e4354b8deeffc4a1f7fa10ae2f7858dca46c46989b2263b513d047904
7
+ data.tar.gz: ad859cda068445f86b5afe022305c0766bae7045b34278c3ece6dafc894bc4eb945bc8ddf1e527804c97137b15f64dbcab7844208fc1b679b13b0d324c152ec2
data/README.md CHANGED
@@ -1,3 +1,6 @@
1
+ > [!CAUTION]
2
+ > This gem is not actively maintained, and many of the integrations have not been updated in years. It is deprecated at Shopify, and should not be used.
3
+
1
4
  # Offsite Payments
2
5
  [![Build Status](https://github.com/activemerchant/offsite_payments/workflows/CI/badge.svg?branch=master)](https://github.com/activemerchant/offsite_payments/actions?query=workflow%3ACI)
3
6
  [![Code Climate](https://codeclimate.com/github/activemerchant/offsite_payments/badges/gpa.svg)](https://codeclimate.com/github/activemerchant/offsite_payments)
@@ -1,5 +1,13 @@
1
1
  module OffsitePayments #:nodoc:
2
+ module MoneyCompatibility
3
+ def to_cents(money)
4
+ money.try(:cents) || money.try(:subunits) || money
5
+ end
6
+ end
7
+
2
8
  class Helper #:nodoc:
9
+ include MoneyCompatibility
10
+
3
11
  attr_reader :fields
4
12
  class_attribute :service_url
5
13
  class_attribute :mappings
@@ -97,7 +97,7 @@ module OffsitePayments #:nodoc:
97
97
 
98
98
  # Need to format the amount to have 2 decimal places
99
99
  def amount=(money)
100
- cents = money.respond_to?(:cents) ? money.cents : money
100
+ cents = to_cents(money)
101
101
  raise ArgumentError, "amount must be a Money object or an integer" if money.is_a?(String)
102
102
  raise ActionViewHelperError, "amount must be greater than $0.00" if cents.to_i <= 0
103
103
 
@@ -89,7 +89,7 @@ module OffsitePayments #:nodoc:
89
89
 
90
90
  # Need to format the amount to have 2 decimal places
91
91
  def amount=(money)
92
- cents = money.respond_to?(:cents) ? money.cents : money
92
+ cents = to_cents(money)
93
93
  raise ArgumentError, "amount must be a Money object or an integer" if money.is_a?(String)
94
94
  raise ActionViewHelperError, "amount must be greater than $0.00" if cents.to_i <= 0
95
95
 
@@ -43,7 +43,7 @@ module OffsitePayments #:nodoc:
43
43
  mapping :amount, 'amount'
44
44
 
45
45
  def amount=(money)
46
- cents = money.respond_to?(:cents) ? money.cents : money
46
+ cents = to_cents(money)
47
47
  raise ArgumentError, "amount must be a Money object or an integer" if money.is_a?(String)
48
48
  raise ActionViewHelperError, "amount must be greater than $0.00" if cents.to_i <= 0
49
49
 
@@ -66,7 +66,7 @@ module OffsitePayments #:nodoc:
66
66
  end
67
67
 
68
68
  def amount=(money)
69
- @amount_in_cents = money.respond_to?(:cents) ? money.cents : money
69
+ @amount_in_cents = to_cents(money)
70
70
  raise ArgumentError, "amount must be a Money object or an integer" if money.is_a?(String)
71
71
  raise ActionViewHelperError, "amount must be greater than $0.00" if @amount_in_cents.to_i <= 0
72
72
 
@@ -94,7 +94,7 @@ module OffsitePayments #:nodoc:
94
94
 
95
95
  # Need to format the amount to have 2 decimal places
96
96
  def amount=(money)
97
- cents = money.respond_to?(:cents) ? money.cents : money
97
+ cents = to_cents(money)
98
98
  raise ArgumentError, "amount must be a Money object or an integer" if money.is_a?(String)
99
99
  raise ActionViewHelperError, "amount must be greater than $0.00" if cents.to_i <= 0
100
100
 
@@ -367,7 +367,7 @@ module OffsitePayments #:nodoc:
367
367
 
368
368
  # Used by composition methods, but not supplied by SagePay.
369
369
  def currency
370
- nil
370
+ Money::NULL_CURRENCY
371
371
  end
372
372
 
373
373
  def test?
@@ -63,7 +63,23 @@ module OffsitePayments #:nodoc:
63
63
  @raw = post.to_s
64
64
  for line in @raw.split('&')
65
65
  key, value = *line.scan( %r{^([A-Za-z0-9_.-]+)\=(.*)$} ).flatten
66
- params[key] = CGI.unescape(value.to_s) if key.present?
66
+ if key.present?
67
+ value = CGI.unescape(value.to_s)
68
+
69
+ # Paypal tend to send data encoded in ISO-8859-1
70
+ unless value.valid_encoding?
71
+ iso_value = value.dup.force_encoding(Encoding::ISO_8859_1)
72
+ if iso_value.valid_encoding?
73
+ value = iso_value.encode(Encoding::UTF_8)
74
+ else
75
+ # To be safe, if we get something even weirder, we ensure
76
+ # we return a UTF-8 strings.
77
+ value = value.b.encode(Encoding::UTF_8, replace: "?")
78
+ end
79
+ end
80
+
81
+ params[key] = value
82
+ end
67
83
  end
68
84
  end
69
85
  end
@@ -1,3 +1,3 @@
1
1
  module OffsitePayments
2
- VERSION = "2.7.28"
2
+ VERSION = "3.0.0"
3
3
  end
metadata CHANGED
@@ -1,29 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: offsite_payments
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.28
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-11 00:00:00.000000000 Z
11
+ date: 2024-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: shopify-money
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: activesupport
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - ">="
18
32
  - !ruby/object:Gem::Version
19
- version: 5.2.3
33
+ version: 7.2.0
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
38
  - - ">="
25
39
  - !ruby/object:Gem::Version
26
- version: 5.2.3
40
+ version: 7.2.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: i18n
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -62,14 +76,14 @@ dependencies:
62
76
  name: active_utils
63
77
  requirement: !ruby/object:Gem::Requirement
64
78
  requirements:
65
- - - "~>"
79
+ - - ">="
66
80
  - !ruby/object:Gem::Version
67
81
  version: 3.3.0
68
82
  type: :runtime
69
83
  prerelease: false
70
84
  version_requirements: !ruby/object:Gem::Requirement
71
85
  requirements:
72
- - - "~>"
86
+ - - ">="
73
87
  - !ruby/object:Gem::Version
74
88
  version: 3.3.0
75
89
  - !ruby/object:Gem::Dependency
@@ -92,28 +106,28 @@ dependencies:
92
106
  requirements:
93
107
  - - ">="
94
108
  - !ruby/object:Gem::Version
95
- version: 5.2.3
109
+ version: 7.2.0
96
110
  type: :runtime
97
111
  prerelease: false
98
112
  version_requirements: !ruby/object:Gem::Requirement
99
113
  requirements:
100
114
  - - ">="
101
115
  - !ruby/object:Gem::Version
102
- version: 5.2.3
116
+ version: 7.2.0
103
117
  - !ruby/object:Gem::Dependency
104
118
  name: actionview
105
119
  requirement: !ruby/object:Gem::Requirement
106
120
  requirements:
107
121
  - - ">="
108
122
  - !ruby/object:Gem::Version
109
- version: 5.1.6.2
123
+ version: 7.2.0
110
124
  type: :runtime
111
125
  prerelease: false
112
126
  version_requirements: !ruby/object:Gem::Requirement
113
127
  requirements:
114
128
  - - ">="
115
129
  - !ruby/object:Gem::Version
116
- version: 5.1.6.2
130
+ version: 7.2.0
117
131
  - !ruby/object:Gem::Dependency
118
132
  name: rake
119
133
  requirement: !ruby/object:Gem::Requirement
@@ -278,15 +292,7 @@ licenses:
278
292
  - MIT
279
293
  metadata:
280
294
  allowed_push_host: https://rubygems.org
281
- post_install_message: "\n In order to use `offsite_payments` gem, you need to either
282
- install or add to your Gemfile\n one of the two options for Money gem:\n -
283
- `gem 'money'`\n - `gem 'shopify-money', require: 'money'`\n\n Regardless
284
- of which gem you choose, please add them *before* `offsite_payments`.\n For more
285
- info, go to https://github.com/activemerchant/offsite_payments#money-gem-dependency\n\n
286
- \ It's also important to note that all Money object usage inside `offsite_payments`
287
- is being\n deprecated. We encourage you to use your own Money object inside your
288
- app instead of relying\n on `offsite_payments` doing it for you, e.g. `Money.from_amount(notification.gross)`\n
289
- \ "
295
+ post_install_message:
290
296
  rdoc_options: []
291
297
  require_paths:
292
298
  - lib
@@ -301,8 +307,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
301
307
  - !ruby/object:Gem::Version
302
308
  version: '0'
303
309
  requirements: []
304
- rubygems_version: 3.0.3
305
- signing_key:
310
+ rubygems_version: 3.5.18
311
+ signing_key:
306
312
  specification_version: 4
307
313
  summary: Framework and tools for dealing with offsite (hosted) payment pages.
308
314
  test_files: []