transact_pro 1.0.1 → 1.1.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
  SHA1:
3
- metadata.gz: 5e0c11b8d32a495c71ac5e199de11613ec198eef
4
- data.tar.gz: a429f2ccd3d0e8408cf990c539252e0366652009
3
+ metadata.gz: 28c8b3d76c94dc391ef973641485bdadfa1d8bae
4
+ data.tar.gz: 2e3654bc9f6ce94bced070728fca7fc43f47b329
5
5
  SHA512:
6
- metadata.gz: badc55835ad825b602e29b3e450b042dc07efa94e84e4332effcebdd2e1df2ac777a9dfeb6faed9e9f97e1d2fff4b1e94aef8a18ef4c1042e581e03abdc71805
7
- data.tar.gz: 5947d7bb9016dff19f9d38a88d00398e779a8662fb88ded1a3fe2bb16523e1a546d7ccdab5245ad3d4853eb6f3f40b5f53296fe8b7221a6d909f1821eb494a4c
6
+ metadata.gz: 5e5d6f17b3c13117ca3f596eab5bf93539bfbe6e03283c6f2a207a5e7f54a3c44224af271b2760be9a78be9ea402179f5e50c7b17107cc7fce459885067c6df6
7
+ data.tar.gz: b71036ee0ae165a40cec6093ae27d31c280259d790fedeeb28b8c971a8d19fbe0470b11884329a992646667d17491d033dcef30a84c6d12e87b4923395e4d2b7
data/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
+ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [1.1.0] - 2018-02-20
8
+ ### Added
9
+ - `LOOSENED_VALIDATIONS` gateway option.
10
+
11
+ ### Removed
12
+ - Requests, especially :init* types no longer have placeholder defaults, use `LOOSENED_VALIDATIONS` instead.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- transact_pro (1.0.1)
4
+ transact_pro (1.1.0)
5
5
  rest-client (~> 2.0.2)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  Lightweight Ruby wrapper for communicating with TransactPro 1stpayments.net card payment API.
7
7
 
8
8
  ### What can this gem do?
9
- Currently core functionality is supported - single and recurring SMS payments with card details entered gateway-side or with HostedFields approach (zero hassle with [PCI compliance](https://www.pcisecuritystandards.org)), and payment outcome check request.
9
+ Currently core functionality is supported - single and recurring SMS payments with card details entered gateway-side, and payment outcome check request.
10
10
  As of v1.0.0 (2018-01-04) the full functionality status list is:
11
11
 
12
12
  | Functionality | method name | Page in doc | Support in gem | response data |
@@ -71,6 +71,14 @@ options = {
71
71
  ACCOUNT_3D: "CS01", # default routing string of Account to be used for 3D transactions
72
72
  ACCOUNT_NON3D: "CS02", # default routing string of Account to be used for non-3D transactions
73
73
  ACCOUNT_RECURRING: "CS03", # default routing string of Account to be used for recurring payment execution
74
+ LOOSENED_VALIDATIONS: false, # set to true if you have arranged a custom subset of parameters to be sufficient for SMS requests. Disables mandation of these fields:
75
+ # name_on_card: {mandatory: false, format: NAME_ON_CARD},
76
+ # street: {mandatory: false, format: STREET},
77
+ # zip: {mandatory: false, format: ZIP},
78
+ # city: {mandatory: false, format: CITY},
79
+ # country: {mandatory: false, format: COUNTRY},
80
+ # state: {mandatory: false, format: STATE},
81
+ # phone: {mandatory: false, format: PHONE},
74
82
 
75
83
  # The gem has the environment-specific endpoint uris in defaults,
76
84
  # you may only need this if the domains used by TransactPro suddenly change
@@ -35,6 +35,7 @@ class TransactPro::Request
35
35
  def details
36
36
  return @details if defined?(@details)
37
37
 
38
+ # DEPRECATED
38
39
  @defaults ||= TransactPro::RequestSpecs.const_get(
39
40
  "#{method.to_s.upcase}_DEFAULTS"
40
41
  )
@@ -42,9 +43,7 @@ class TransactPro::Request
42
43
  @request_options ||= @defaults.merge(options)
43
44
  @request_options[:rs] = routing_string
44
45
 
45
- @spec ||= TransactPro::RequestSpecs.const_get(
46
- "#{method.to_s.upcase}_SPEC"
47
- )
46
+ @spec ||= spec_to_use
48
47
 
49
48
  @postable_params = {}
50
49
  @spec.each do |k, spec|
@@ -104,4 +103,20 @@ class TransactPro::Request
104
103
  method == :init_recurring_registration ? :init : method
105
104
  end
106
105
 
106
+ def spec_to_use
107
+ loosened_const = "LOOSENED_#{method.to_s.upcase}_SPEC" #=> "LOOSENED_INIT_SPEC"
108
+ const = "#{method.to_s.upcase}_SPEC" #=> "INIT_SPEC"
109
+
110
+ const =
111
+ if options[:LOOSENED_VALIDATIONS]
112
+ begin
113
+ TransactPro::RequestSpecs.const_get(loosened_const)
114
+ rescue
115
+ TransactPro::RequestSpecs.const_get(const)
116
+ end
117
+ else
118
+ TransactPro::RequestSpecs.const_get(const)
119
+ end
120
+ end
121
+
107
122
  end
@@ -103,17 +103,27 @@ module TransactPro
103
103
  }.freeze
104
104
 
105
105
  INIT_DEFAULTS = {
106
- name_on_card: "John Doe",
107
- street: "NA", zip: "NA", city: "NA", country: "NA", state: "NA",
108
- email: "john_doe@example.com", phone: "00371000000"
106
+ # noop, was used to provide placeholder values to requests
109
107
  }.freeze
110
108
 
109
+ LOOSENED_INIT_SPEC = INIT_SPEC.dup.merge(
110
+ name_on_card: {mandatory: false, format: NAME_ON_CARD},
111
+ street: {mandatory: false, format: STREET},
112
+ zip: {mandatory: false, format: ZIP},
113
+ city: {mandatory: false, format: CITY},
114
+ country: {mandatory: false, format: COUNTRY},
115
+ state: {mandatory: false, format: STATE},
116
+ phone: {mandatory: false, format: PHONE},
117
+ ).freeze
118
+
111
119
  INIT_RECURRING_REGISTRATION_SPEC = INIT_SPEC.
112
120
  # method: :init_recurring_registration
113
121
  dup.merge(save_card: {mandatory: true, format: %r'\d+'}).freeze
114
122
  INIT_RECURRING_REGISTRATION_DEFAULTS = INIT_DEFAULTS.
115
123
  dup.merge(save_card: "1").freeze
116
124
 
125
+ LOOSENED_INIT_RECURRING_REGISTRATION_SPEC = LOOSENED_INIT_SPEC
126
+
117
127
  # 32. Table
118
128
  # Field Format Description
119
129
  # guid ans(19) Your merchant GUID
@@ -1,3 +1,3 @@
1
1
  module TransactPro
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
data/lib/transact_pro.rb CHANGED
@@ -12,6 +12,7 @@ module TransactPro
12
12
 
13
13
  DEFAULTS = {
14
14
  TEST: false,
15
+ LOOSENED_VALIDATIONS: false,
15
16
  PRODUCTION_ENV: {
16
17
  API_URI: "https://www2.1stpayments.net/gwprocessor2.php",
17
18
  HOSTED_FIELDS_JS_URI: "https://www2.1stpayments.net/hostedfields/hosted-fields-1.0.5.js",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: transact_pro
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Epigene
@@ -133,6 +133,7 @@ files:
133
133
  - .circleci/config.yml
134
134
  - .gitignore
135
135
  - .rspec
136
+ - CHANGELOG.md
136
137
  - CODE_OF_CONDUCT.md
137
138
  - Gemfile
138
139
  - Gemfile.lock
@@ -169,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
170
  version: '0'
170
171
  requirements: []
171
172
  rubyforge_project:
172
- rubygems_version: 2.4.8
173
+ rubygems_version: 2.6.14
173
174
  signing_key:
174
175
  specification_version: 4
175
176
  summary: Ruby wrapper for communicating with TransactPro 1stpayments.net card payment