offsite_payments 2.6.4 → 2.6.6

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
  SHA1:
3
- metadata.gz: c342679456bad0cbf25b70884fabc8782e052bb4
4
- data.tar.gz: 7c6e3c378e23a756853f77e9f6749a45d7145adb
3
+ metadata.gz: d95d9848319381dc986f633e7c42190e402ba680
4
+ data.tar.gz: a6a611b91129bf5775ea30234552588e4c16c013
5
5
  SHA512:
6
- metadata.gz: f3c061506c94b8d8aeb99e94a729683864bf5c4e703a06b41cc1edcb70196a0aef6659a8062fa6afb1bcec49c7455a8ccbea8f89c133c6098b7a7b6b1b8dc71e
7
- data.tar.gz: d417b32eb15615ea3fc434989e992992c28209b8700655b43824bb301b7090ae5c0306bfbbdb900128fec7bc110fcb2a1d704d090dc8600472548e626b38d10e
6
+ metadata.gz: 7d72aad14eb351f2746ef51831f01663d26c85108f07611ba6900bba629d06fbb865cf9c48f6ddf0345df7ece0582a8abfec8dbd0039afeb8f1e79e429bbbfc5
7
+ data.tar.gz: 921ef5f43c384142dff5d6b9f4afbb0cafbd02f7bb89b968c825b016fffdbbdb6f9f1a21cdb5b1ddf9dab97354812b38ec876d236a4acba6deb1670421a98da1
@@ -51,9 +51,6 @@ module OffsitePayments #:nodoc:
51
51
  mapping :account, 'MID'
52
52
  mapping :order, 'MERC_UNQ_REF'
53
53
 
54
- mapping :customer, :email => 'CUST_ID'
55
-
56
-
57
54
  mapping :credential3, 'INDUSTRY_TYPE_ID'
58
55
  mapping :credential4, 'WEBSITE'
59
56
  mapping :channel_id, 'CHANNEL_ID'
@@ -71,6 +68,17 @@ module OffsitePayments #:nodoc:
71
68
  self.pg = 'CC'
72
69
  end
73
70
 
71
+ def customer(options = {})
72
+ customer_id =
73
+ if options[:email].present?
74
+ sanitize_field(options[:email])
75
+ else
76
+ sanitize_field(options[:phone])
77
+ end
78
+
79
+ add_field('CUST_ID', customer_id)
80
+ end
81
+
74
82
  def form_fields
75
83
  sanitize_fields
76
84
  @fields.merge(mappings[:checksum] => encrypt_checksum)
@@ -88,9 +96,13 @@ module OffsitePayments #:nodoc:
88
96
 
89
97
  def sanitize_fields
90
98
  %w(email phone).each do |field|
91
- @fields[field].gsub!(/[^a-zA-Z0-9\-_@\/\s.]/, '') if @fields[field]
99
+ sanitize_field(@fields[field])
92
100
  end
93
101
  end
102
+
103
+ def sanitize_field(field)
104
+ field.gsub!(/[^a-zA-Z0-9\-_@\/\s.]/, '') if field
105
+ end
94
106
  end
95
107
 
96
108
  class Notification < OffsitePayments::Notification
@@ -187,6 +199,8 @@ module OffsitePayments #:nodoc:
187
199
  end
188
200
 
189
201
  def checksum_ok?
202
+ return false if checksum.nil?
203
+
190
204
  normalized_data = checksum.delete("\n").tr(' ', '+')
191
205
  encrypted_data = Base64.strict_decode64(normalized_data)
192
206
 
@@ -1,3 +1,3 @@
1
1
  module OffsitePayments
2
- VERSION = "2.6.4"
2
+ VERSION = "2.6.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: offsite_payments
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.4
4
+ version: 2.6.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-08 00:00:00.000000000 Z
11
+ date: 2018-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -17,9 +17,6 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 3.2.14
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '5.2'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,9 +24,6 @@ dependencies:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: 3.2.14
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '5.2'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: i18n
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -115,7 +109,7 @@ dependencies:
115
109
  version: 3.2.20
116
110
  - - "<"
117
111
  - !ruby/object:Gem::Version
118
- version: '5.2'
112
+ version: '6.0'
119
113
  type: :runtime
120
114
  prerelease: false
121
115
  version_requirements: !ruby/object:Gem::Requirement
@@ -125,7 +119,7 @@ dependencies:
125
119
  version: 3.2.20
126
120
  - - "<"
127
121
  - !ruby/object:Gem::Version
128
- version: '5.2'
122
+ version: '6.0'
129
123
  - !ruby/object:Gem::Dependency
130
124
  name: rake
131
125
  requirement: !ruby/object:Gem::Requirement