better_offsite_payments 2.3.0
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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +76 -0
- data/lib/offsite_payments.rb +39 -0
- data/lib/offsite_payments/action_view_helper.rb +72 -0
- data/lib/offsite_payments/helper.rb +120 -0
- data/lib/offsite_payments/integrations.rb +14 -0
- data/lib/offsite_payments/integrations/a1agregator.rb +245 -0
- data/lib/offsite_payments/integrations/authorize_net_sim.rb +580 -0
- data/lib/offsite_payments/integrations/bit_pay.rb +150 -0
- data/lib/offsite_payments/integrations/bogus.rb +32 -0
- data/lib/offsite_payments/integrations/chronopay.rb +283 -0
- data/lib/offsite_payments/integrations/citrus.rb +227 -0
- data/lib/offsite_payments/integrations/coinbase.rb +172 -0
- data/lib/offsite_payments/integrations/direc_pay.rb +332 -0
- data/lib/offsite_payments/integrations/directebanking.rb +237 -0
- data/lib/offsite_payments/integrations/doku.rb +171 -0
- data/lib/offsite_payments/integrations/dotpay.rb +166 -0
- data/lib/offsite_payments/integrations/dwolla.rb +160 -0
- data/lib/offsite_payments/integrations/e_payment_plans.rb +146 -0
- data/lib/offsite_payments/integrations/easy_pay.rb +137 -0
- data/lib/offsite_payments/integrations/epay.rb +161 -0
- data/lib/offsite_payments/integrations/first_data.rb +133 -0
- data/lib/offsite_payments/integrations/gestpay.rb +205 -0
- data/lib/offsite_payments/integrations/hi_trust.rb +179 -0
- data/lib/offsite_payments/integrations/ipay88.rb +251 -0
- data/lib/offsite_payments/integrations/klarna.rb +275 -0
- data/lib/offsite_payments/integrations/liqpay.rb +216 -0
- data/lib/offsite_payments/integrations/maksuturva.rb +231 -0
- data/lib/offsite_payments/integrations/megakassa.rb +184 -0
- data/lib/offsite_payments/integrations/mollie.rb +32 -0
- data/lib/offsite_payments/integrations/mollie_ideal.rb +194 -0
- data/lib/offsite_payments/integrations/mollie_mistercash.rb +143 -0
- data/lib/offsite_payments/integrations/molpay.rb +193 -0
- data/lib/offsite_payments/integrations/moneybookers.rb +199 -0
- data/lib/offsite_payments/integrations/nochex.rb +228 -0
- data/lib/offsite_payments/integrations/pag_seguro.rb +268 -0
- data/lib/offsite_payments/integrations/paxum.rb +114 -0
- data/lib/offsite_payments/integrations/pay_fast.rb +269 -0
- data/lib/offsite_payments/integrations/paydollar.rb +142 -0
- data/lib/offsite_payments/integrations/payflow_link.rb +194 -0
- data/lib/offsite_payments/integrations/paypal.rb +362 -0
- data/lib/offsite_payments/integrations/paypal_payments_advanced.rb +23 -0
- data/lib/offsite_payments/integrations/paysbuy.rb +71 -0
- data/lib/offsite_payments/integrations/payu_in.rb +276 -0
- data/lib/offsite_payments/integrations/payu_in_paisa.rb +46 -0
- data/lib/offsite_payments/integrations/platron.rb +153 -0
- data/lib/offsite_payments/integrations/pxpay.rb +273 -0
- data/lib/offsite_payments/integrations/quickpay.rb +232 -0
- data/lib/offsite_payments/integrations/rbkmoney.rb +110 -0
- data/lib/offsite_payments/integrations/realex_offsite.rb +317 -0
- data/lib/offsite_payments/integrations/robokassa.rb +154 -0
- data/lib/offsite_payments/integrations/sage_pay_form.rb +431 -0
- data/lib/offsite_payments/integrations/two_checkout.rb +329 -0
- data/lib/offsite_payments/integrations/universal.rb +190 -0
- data/lib/offsite_payments/integrations/valitor.rb +200 -0
- data/lib/offsite_payments/integrations/verkkomaksut.rb +143 -0
- data/lib/offsite_payments/integrations/web_pay.rb +186 -0
- data/lib/offsite_payments/integrations/webmoney.rb +119 -0
- data/lib/offsite_payments/integrations/wirecard_checkout_page.rb +359 -0
- data/lib/offsite_payments/integrations/world_pay.rb +280 -0
- data/lib/offsite_payments/integrations/yandex_money.rb +175 -0
- data/lib/offsite_payments/notification.rb +71 -0
- data/lib/offsite_payments/return.rb +37 -0
- data/lib/offsite_payments/version.rb +3 -0
- metadata +297 -0
@@ -0,0 +1,71 @@
|
|
1
|
+
module OffsitePayments #:nodoc:
|
2
|
+
class Notification
|
3
|
+
attr_accessor :params
|
4
|
+
attr_accessor :raw
|
5
|
+
|
6
|
+
# set this to an array in the subclass, to specify which IPs are allowed
|
7
|
+
# to send requests
|
8
|
+
class_attribute :production_ips
|
9
|
+
|
10
|
+
# * *Args* :
|
11
|
+
# - +doc+ -> raw post string
|
12
|
+
# - +options+ -> custom options which individual implementations can
|
13
|
+
# utilize
|
14
|
+
def initialize(post, options = {})
|
15
|
+
@options = options
|
16
|
+
empty!
|
17
|
+
parse(post)
|
18
|
+
end
|
19
|
+
|
20
|
+
def status
|
21
|
+
raise NotImplementedError, "Must implement this method in the subclass"
|
22
|
+
end
|
23
|
+
|
24
|
+
# the money amount we received in X.2 decimal.
|
25
|
+
def gross
|
26
|
+
raise NotImplementedError, "Must implement this method in the subclass"
|
27
|
+
end
|
28
|
+
|
29
|
+
def gross_cents
|
30
|
+
(gross.to_f * 100.0).round
|
31
|
+
end
|
32
|
+
|
33
|
+
# This combines the gross and currency and returns a proper Money object.
|
34
|
+
# this requires the money library located at http://rubymoney.github.io/money/
|
35
|
+
def amount
|
36
|
+
return Money.new(gross_cents, currency) rescue ArgumentError
|
37
|
+
return Money.new(gross_cents) # maybe you have an own money object which doesn't take a currency?
|
38
|
+
end
|
39
|
+
|
40
|
+
# reset the notification.
|
41
|
+
def empty!
|
42
|
+
@params = Hash.new
|
43
|
+
@raw = ""
|
44
|
+
end
|
45
|
+
|
46
|
+
# Check if the request comes from an official IP
|
47
|
+
def valid_sender?(ip)
|
48
|
+
return true if OffsitePayments.mode == :test || production_ips.blank?
|
49
|
+
production_ips.include?(ip)
|
50
|
+
end
|
51
|
+
|
52
|
+
def test?
|
53
|
+
false
|
54
|
+
end
|
55
|
+
|
56
|
+
def iso_currency
|
57
|
+
ActiveUtils::CurrencyCode.standardize(currency)
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
# Take the posted data and move the relevant data into a hash
|
63
|
+
def parse(post)
|
64
|
+
@raw = post.to_s
|
65
|
+
for line in @raw.split('&')
|
66
|
+
key, value = *line.scan( %r{^([A-Za-z0-9_.-]+)\=(.*)$} ).flatten
|
67
|
+
params[key] = CGI.unescape(value.to_s) if key.present?
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module OffsitePayments #:nodoc:
|
2
|
+
class Return
|
3
|
+
attr_accessor :params
|
4
|
+
attr_reader :notification
|
5
|
+
|
6
|
+
def initialize(query_string, options = {})
|
7
|
+
@params = parse(query_string)
|
8
|
+
@options = options
|
9
|
+
end
|
10
|
+
|
11
|
+
# Successful by default. Overridden in the child class
|
12
|
+
def success?
|
13
|
+
true
|
14
|
+
end
|
15
|
+
|
16
|
+
# Not cancelled by default. Overridden in the child class.
|
17
|
+
def cancelled?
|
18
|
+
false
|
19
|
+
end
|
20
|
+
|
21
|
+
def message
|
22
|
+
end
|
23
|
+
|
24
|
+
def parse(query_string)
|
25
|
+
return {} if query_string.blank?
|
26
|
+
|
27
|
+
query_string.split('&').inject({}) do |memo, chunk|
|
28
|
+
next if chunk.empty?
|
29
|
+
key, value = chunk.split('=', 2)
|
30
|
+
next if key.empty?
|
31
|
+
value = value.nil? ? nil : CGI.unescape(value)
|
32
|
+
memo[CGI.unescape(key)] = value
|
33
|
+
memo
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,297 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: better_offsite_payments
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yuri Mikhaylov
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-05-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.2.14
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.1'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.2.14
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5.1'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: i18n
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0.5'
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0.5'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: money
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "<"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 7.0.0
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "<"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 7.0.0
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: builder
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 2.1.2
|
68
|
+
- - "<"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 4.0.0
|
71
|
+
type: :runtime
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 2.1.2
|
78
|
+
- - "<"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 4.0.0
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: active_utils
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - "~>"
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 3.2.0
|
88
|
+
type: :runtime
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - "~>"
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 3.2.0
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: nokogiri
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - "~>"
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '1.4'
|
102
|
+
type: :runtime
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - "~>"
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '1.4'
|
109
|
+
- !ruby/object:Gem::Dependency
|
110
|
+
name: actionpack
|
111
|
+
requirement: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: 3.2.20
|
116
|
+
- - "<"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '5.1'
|
119
|
+
type: :runtime
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 3.2.20
|
126
|
+
- - "<"
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '5.1'
|
129
|
+
- !ruby/object:Gem::Dependency
|
130
|
+
name: rake
|
131
|
+
requirement: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
type: :development
|
137
|
+
prerelease: false
|
138
|
+
version_requirements: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
- !ruby/object:Gem::Dependency
|
144
|
+
name: test-unit
|
145
|
+
requirement: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - "~>"
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '3.0'
|
150
|
+
type: :development
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - "~>"
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '3.0'
|
157
|
+
- !ruby/object:Gem::Dependency
|
158
|
+
name: mocha
|
159
|
+
requirement: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - "~>"
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '1.0'
|
164
|
+
type: :development
|
165
|
+
prerelease: false
|
166
|
+
version_requirements: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - "~>"
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '1.0'
|
171
|
+
- !ruby/object:Gem::Dependency
|
172
|
+
name: rails
|
173
|
+
requirement: !ruby/object:Gem::Requirement
|
174
|
+
requirements:
|
175
|
+
- - ">="
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: 3.2.14
|
178
|
+
type: :development
|
179
|
+
prerelease: false
|
180
|
+
version_requirements: !ruby/object:Gem::Requirement
|
181
|
+
requirements:
|
182
|
+
- - ">="
|
183
|
+
- !ruby/object:Gem::Version
|
184
|
+
version: 3.2.14
|
185
|
+
- !ruby/object:Gem::Dependency
|
186
|
+
name: thor
|
187
|
+
requirement: !ruby/object:Gem::Requirement
|
188
|
+
requirements:
|
189
|
+
- - ">="
|
190
|
+
- !ruby/object:Gem::Version
|
191
|
+
version: '0'
|
192
|
+
type: :development
|
193
|
+
prerelease: false
|
194
|
+
version_requirements: !ruby/object:Gem::Requirement
|
195
|
+
requirements:
|
196
|
+
- - ">="
|
197
|
+
- !ruby/object:Gem::Version
|
198
|
+
version: '0'
|
199
|
+
description: Offsite Payments is a simple abstraction library used in and sponsored
|
200
|
+
by Shopify. It is written by Tobias Luetke, Cody Fauser, and contributors. The aim
|
201
|
+
of the project is to put as simple an abstraction as possible on top of offsite
|
202
|
+
(often called hosted) payment pages, and allow contributors to easily help services
|
203
|
+
such as Shopify extend the number of offsite payment services they support.
|
204
|
+
email: me@yurijmi.ru
|
205
|
+
executables: []
|
206
|
+
extensions: []
|
207
|
+
extra_rdoc_files: []
|
208
|
+
files:
|
209
|
+
- MIT-LICENSE
|
210
|
+
- README.md
|
211
|
+
- lib/offsite_payments.rb
|
212
|
+
- lib/offsite_payments/action_view_helper.rb
|
213
|
+
- lib/offsite_payments/helper.rb
|
214
|
+
- lib/offsite_payments/integrations.rb
|
215
|
+
- lib/offsite_payments/integrations/a1agregator.rb
|
216
|
+
- lib/offsite_payments/integrations/authorize_net_sim.rb
|
217
|
+
- lib/offsite_payments/integrations/bit_pay.rb
|
218
|
+
- lib/offsite_payments/integrations/bogus.rb
|
219
|
+
- lib/offsite_payments/integrations/chronopay.rb
|
220
|
+
- lib/offsite_payments/integrations/citrus.rb
|
221
|
+
- lib/offsite_payments/integrations/coinbase.rb
|
222
|
+
- lib/offsite_payments/integrations/direc_pay.rb
|
223
|
+
- lib/offsite_payments/integrations/directebanking.rb
|
224
|
+
- lib/offsite_payments/integrations/doku.rb
|
225
|
+
- lib/offsite_payments/integrations/dotpay.rb
|
226
|
+
- lib/offsite_payments/integrations/dwolla.rb
|
227
|
+
- lib/offsite_payments/integrations/e_payment_plans.rb
|
228
|
+
- lib/offsite_payments/integrations/easy_pay.rb
|
229
|
+
- lib/offsite_payments/integrations/epay.rb
|
230
|
+
- lib/offsite_payments/integrations/first_data.rb
|
231
|
+
- lib/offsite_payments/integrations/gestpay.rb
|
232
|
+
- lib/offsite_payments/integrations/hi_trust.rb
|
233
|
+
- lib/offsite_payments/integrations/ipay88.rb
|
234
|
+
- lib/offsite_payments/integrations/klarna.rb
|
235
|
+
- lib/offsite_payments/integrations/liqpay.rb
|
236
|
+
- lib/offsite_payments/integrations/maksuturva.rb
|
237
|
+
- lib/offsite_payments/integrations/megakassa.rb
|
238
|
+
- lib/offsite_payments/integrations/mollie.rb
|
239
|
+
- lib/offsite_payments/integrations/mollie_ideal.rb
|
240
|
+
- lib/offsite_payments/integrations/mollie_mistercash.rb
|
241
|
+
- lib/offsite_payments/integrations/molpay.rb
|
242
|
+
- lib/offsite_payments/integrations/moneybookers.rb
|
243
|
+
- lib/offsite_payments/integrations/nochex.rb
|
244
|
+
- lib/offsite_payments/integrations/pag_seguro.rb
|
245
|
+
- lib/offsite_payments/integrations/paxum.rb
|
246
|
+
- lib/offsite_payments/integrations/pay_fast.rb
|
247
|
+
- lib/offsite_payments/integrations/paydollar.rb
|
248
|
+
- lib/offsite_payments/integrations/payflow_link.rb
|
249
|
+
- lib/offsite_payments/integrations/paypal.rb
|
250
|
+
- lib/offsite_payments/integrations/paypal_payments_advanced.rb
|
251
|
+
- lib/offsite_payments/integrations/paysbuy.rb
|
252
|
+
- lib/offsite_payments/integrations/payu_in.rb
|
253
|
+
- lib/offsite_payments/integrations/payu_in_paisa.rb
|
254
|
+
- lib/offsite_payments/integrations/platron.rb
|
255
|
+
- lib/offsite_payments/integrations/pxpay.rb
|
256
|
+
- lib/offsite_payments/integrations/quickpay.rb
|
257
|
+
- lib/offsite_payments/integrations/rbkmoney.rb
|
258
|
+
- lib/offsite_payments/integrations/realex_offsite.rb
|
259
|
+
- lib/offsite_payments/integrations/robokassa.rb
|
260
|
+
- lib/offsite_payments/integrations/sage_pay_form.rb
|
261
|
+
- lib/offsite_payments/integrations/two_checkout.rb
|
262
|
+
- lib/offsite_payments/integrations/universal.rb
|
263
|
+
- lib/offsite_payments/integrations/valitor.rb
|
264
|
+
- lib/offsite_payments/integrations/verkkomaksut.rb
|
265
|
+
- lib/offsite_payments/integrations/web_pay.rb
|
266
|
+
- lib/offsite_payments/integrations/webmoney.rb
|
267
|
+
- lib/offsite_payments/integrations/wirecard_checkout_page.rb
|
268
|
+
- lib/offsite_payments/integrations/world_pay.rb
|
269
|
+
- lib/offsite_payments/integrations/yandex_money.rb
|
270
|
+
- lib/offsite_payments/notification.rb
|
271
|
+
- lib/offsite_payments/return.rb
|
272
|
+
- lib/offsite_payments/version.rb
|
273
|
+
homepage: https://github.com/yurijmi/better_offsite_payments
|
274
|
+
licenses:
|
275
|
+
- MIT
|
276
|
+
metadata: {}
|
277
|
+
post_install_message:
|
278
|
+
rdoc_options: []
|
279
|
+
require_paths:
|
280
|
+
- lib
|
281
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
282
|
+
requirements:
|
283
|
+
- - ">="
|
284
|
+
- !ruby/object:Gem::Version
|
285
|
+
version: '0'
|
286
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
287
|
+
requirements:
|
288
|
+
- - ">="
|
289
|
+
- !ruby/object:Gem::Version
|
290
|
+
version: '0'
|
291
|
+
requirements: []
|
292
|
+
rubyforge_project:
|
293
|
+
rubygems_version: 2.5.1
|
294
|
+
signing_key:
|
295
|
+
specification_version: 4
|
296
|
+
summary: Framework and tools for dealing with offsite (hosted) payment pages.
|
297
|
+
test_files: []
|