amex_enhanced_authorization 0.3.0 → 0.4.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: ec1a4a492c700a91947daad158fc2a24e240d7c36170e48ca33465aae30b09dc
4
- data.tar.gz: 7cac1d5df02f10862d964834bb2bf7b0b4a493e37f490625cdd48223d2c43c16
3
+ metadata.gz: 0f402f2265b926978d32b0976f29c7bc4d8535f6a76fc2f109d7778fcb29805f
4
+ data.tar.gz: 5363b476e36605073ff89aef3aeaeedd99bcafce9729a7a22438414360e02cd6
5
5
  SHA512:
6
- metadata.gz: 519ebbcdaf6fce451615e02dd9db8b8aa35dabda0a39d54e7d764d2bcdfd42c0b66b769db86aa67fd51c6d5f7149c4e815d497b9cd2a4c4be262be1ca1fb9970
7
- data.tar.gz: b7ba76ce6998284ffa842be4f932f1b50c90aa79fc5414b3de536e1ff53c8e294751d6cb7667e37e2faa2d966e9e65189ea15cc41b196d85219d19284227865e
6
+ metadata.gz: 43c6f84d6714511a6b2234d79697d007703fb79ef991ae6b06fa5fa5fd1a026be4ec4c0eee6b80def57620681b0354f3a56953d8a40e3c6075c1ce1d3e135c1f
7
+ data.tar.gz: acf33b2c5933588ba151cc74e8abc0d9d54a54742e97c2cbd586645fc32b4c7a608a7796f034717ac23c6123103bd99a9dcb6f6a79c6993bfaa5f0d0ab84fe7d
@@ -33,21 +33,25 @@ module AmexEnhancedAuthorization
33
33
  def purchaser_information
34
34
  @purchaser_information ||= {
35
35
  customer_email: customer_email,
36
- billing_address: ascify(billing_address),
37
- billing_postal_code: billing_postal_code,
38
- billing_first_name: billing_first_name,
39
- billing_last_name: ascify(billing_last_name),
36
+ billing_address: munge(billing_address, /[^A-Za-z0-9 ]/, 70),
37
+ billing_postal_code: munge(billing_postal_code, /[^A-Za-z0-9\- ]/, 9),
38
+ billing_first_name: munge(billing_first_name, /[^A-Za-z0-9 ]/, 30),
39
+ billing_last_name: munge(billing_last_name, /[^A-Za-z0-9 ]/, 30),
40
40
  billing_phone_number: billing_phone_number,
41
- shipto_address: shipto_address,
41
+ shipto_address: munge(shipto_address, /[^A-Za-z0-9 ]/, 50),
42
42
  shipto_postal_code: shipto_postal_code,
43
43
  shipto_first_name: shipto_first_name,
44
- shipto_last_name: ascify(shipto_last_name),
44
+ shipto_last_name: munge(shipto_last_name, /[^A-Za-z0-9 ]/, 30),
45
45
  shipto_phone_number: shipto_phone_number,
46
46
  shipto_country_code: shipto_country_code,
47
47
  device_ip: device_ip,
48
48
  }.compact
49
49
  end
50
50
 
51
+ def munge(s, exp, length)
52
+ s && ascify(s).gsub(exp, ' ')[0..(length-1)]
53
+ end
54
+
51
55
  def ascify(s)
52
56
  s && s.tr(
53
57
  "ÀÁÂÃÄÅàáâãäåĀāĂ㥹ÇçĆćĈĉĊċČčÐðĎďĐđÈÉÊËèéêëĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħÌÍÎÏìíîïĨĩĪīĬĭĮįİıĴĵĶķĸĹĺĻļĽľĿŀŁłÑñŃńŅņŇňʼnŊŋÒÓÔÕÖØòóôõöøŌōŎŏŐőŔŕŖŗŘřŚśŜŝŞşŠšſŢţŤťŦŧÙÚÛÜùúûüŨũŪūŬŭŮůŰűŲųŴŵÝýÿŶŷŸŹźŻżŽž",
@@ -1,3 +1,3 @@
1
1
  module AmexEnhancedAuthorization
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amex_enhanced_authorization
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piers Chambers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-07-17 00:00:00.000000000 Z
11
+ date: 2019-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler