offsite_payments 2.7.28 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -13
- data/lib/offsite_payments/helper.rb +8 -0
- data/lib/offsite_payments/integrations/direc_pay.rb +1 -1
- data/lib/offsite_payments/integrations/directebanking.rb +1 -1
- data/lib/offsite_payments/integrations/hi_trust.rb +1 -1
- data/lib/offsite_payments/integrations/ipay88.rb +1 -1
- data/lib/offsite_payments/integrations/nochex.rb +1 -1
- data/lib/offsite_payments/integrations/sage_pay_form.rb +1 -1
- data/lib/offsite_payments/notification.rb +17 -1
- data/lib/offsite_payments/version.rb +1 -1
- metadata +28 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f6a0bd131074969e152ea1167518adc29141c632582b7ddc5cd2139df3cef7f
|
4
|
+
data.tar.gz: 42d36fabc39b23555e2b80b24e81bead4305fc9cd0772449eff2a885c149b181
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bdb944ecc3c33b6c9060f2dff6b76b2027d18ebdf514215f4868e57482c3cff407d44d98b22485bc0a325676c5d07a563c1867a9978c13f65b9f7e05ad40b3b
|
7
|
+
data.tar.gz: 2ff7624ee421bfacb7c7bf31efe2aa81d8fda5c8616786b1678611b7fb672f325d05615389cf1cf49dbf964459221ea77dfa112a5f9ccdbb648597b8c02139cf
|
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)
|
@@ -37,19 +40,6 @@ Or, if you're using Bundler, just add the following to your Gemfile:
|
|
37
40
|
|
38
41
|
gem 'offsite_payments'
|
39
42
|
|
40
|
-
### Money gem dependency
|
41
|
-
|
42
|
-
At the moment, `offsite_payments` gem depends on `Money` object, which was previously included by default. Since Shopify
|
43
|
-
released their own `shopify-money` gem. Because `offsite_payments` does not impose which one of those gems should be
|
44
|
-
included into your gem file, as long as one of them is included.
|
45
|
-
|
46
|
-
|
47
|
-
- For [ruby money gem](https://github.com/RubyMoney/money) add `gem 'money'` to your `Gemfile`;
|
48
|
-
- For [Shopify money gem](https://github.com/Shopify/money) add `gem 'shopify-money', require: 'money'` in your `Gemfile`.
|
49
|
-
|
50
|
-
It's important to note that either of those Money gems would need to be added to your `Gemfile` before the `offsite_payments`
|
51
|
-
one.
|
52
|
-
|
53
43
|
[API documentation](http://www.rubydoc.info/github/activemerchant/offsite_payments/master).
|
54
44
|
|
55
45
|
## Supported Integrations
|
@@ -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
|
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
|
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
|
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
|
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
|
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
|
|
@@ -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
|
-
|
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
|
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:
|
4
|
+
version: 3.0.1
|
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:
|
11
|
+
date: 2024-10-07 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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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.
|
305
|
-
signing_key:
|
310
|
+
rubygems_version: 3.5.20
|
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: []
|