amex_tokenization_client 0.1.3 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 800325436774bd5e89010628c690c6e0c5dd535008832b78a747613f721802d9
4
- data.tar.gz: bfaaa00543d0bdac82497d1617c7eecca48f31401918f5809fc290ef80e05501
3
+ metadata.gz: f4b22d2643081e886bb2e2003b233bb8cd3568335f1d8eeff68bae247971ad35
4
+ data.tar.gz: fc5a75e944c8e6f404fb9125586ed524811c43c37a5b1e1cff023ff159b05d29
5
5
  SHA512:
6
- metadata.gz: c16ab5bf9d2f50b18ec217d44ffa30524cedb9d20b3092d2546b3e1e99fd148cdc74e99024895b737fca0094c036310d262d0e488c3dcb59b2af4a748f9a794a
7
- data.tar.gz: 53dfd5e16c9fbb24e6bd49954860756d70c094813cfc6e8459d865f0cda5f5feabae665c1d3a9e9dd8096572dd9d95bd925525467894ade6562f32271cc2388b
6
+ metadata.gz: 1526310333acc3a32dc2a8cab1876d92e61553f081a31bfe8420892fcd0706672e9e9659b4555b8f1b6685ebb0bd63ea2d5a6e5326444c062eb0167f8a166d5a
7
+ data.tar.gz: e5241d9fbaa8a764efb78717ed5dcf0134e568be4753107b3ea08ab5944ecc2ffaf7b4d06205203ee44661b143b56fc043a1a5b64235ef2bdc26ffbe325931e3
@@ -0,0 +1,12 @@
1
+ # Contributing
2
+
3
+ Bug reports and pull requests are [welcome on GitHub](https://github.com/varyonic/amex_enhanced_authorization).
4
+
5
+ ## Development
6
+
7
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
8
+
9
+ To install this gem onto your local machine, run `bundle exec rake install`.
10
+
11
+ To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`,
12
+ which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
data/README.md CHANGED
@@ -1,9 +1,11 @@
1
1
  # AmexTokenizationClient
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/amex_tokenization_client.svg)](https://badge.fury.io/rb/amex_tokenization_client)
4
- [![Travis CI Status](https://secure.travis-ci.org/varyonic/amex-api-ruby-client.svg)](https://travis-ci.org/varyonic/amex-api-ruby-client)
4
+ [![Travis CI Status](https://secure.travis-ci.org/varyonic/amex_enhanced_authorization.svg)](https://travis-ci.org/varyonic/amex_enhanced_authorization)
5
5
 
6
- Unofficial Ruby wrapper for the American Express Tokenization Service (AETS).
6
+ Unofficial Ruby wrapper for the American Express Tokenization Service (AETS)
7
+ published via the [amex developer portal](https://developer.americanexpress.com/products/amex-token-service/overview),
8
+ see also [amex-api-java-client-core](https://github.com/americanexpress/amex-api-java-client-core).
7
9
 
8
10
  ## Installation
9
11
 
@@ -19,18 +21,16 @@ And then execute:
19
21
 
20
22
  ## Usage
21
23
 
22
- TODO: Write usage instructions here
24
+ See [specs](https://github.com/varyonic/amex_enhanced_authorization/blob/master/spec/amex_tokenization_client_spec.rb) for sample usage.
23
25
 
24
- ## Development
26
+ ## Contributions
25
27
 
26
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
27
-
28
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
29
-
30
- ## Contributing
31
-
32
- Bug reports and pull requests are welcome on GitHub at https://github.com/varyonic/amex-api-ruby-client.
28
+ Read [CONTRIBUTING](CONTRIBUTING.md) for details.
33
29
 
34
30
  ## License
35
31
 
36
32
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
33
+
34
+ Read the [LICENSE](LICENSE.md) for details.
35
+
36
+ Copyright (c) 2018-2019 [Varyonic](https://www.varyonic.com).
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["piers@varyonic.com"]
11
11
 
12
12
  spec.summary = "Unofficial Ruby wrapper for the American Express Tokenization Service (AETS)."
13
- spec.homepage = "https://github.com/varyonic/amex-api-ruby-client"
13
+ spec.homepage = "https://github.com/varyonic/amex_enhanced_authorization"
14
14
  spec.license = "MIT"
15
15
 
16
16
  # Specify which files should be added to the gem when it is released.
@@ -25,6 +25,6 @@ Gem::Specification.new do |spec|
25
25
  spec.add_dependency "jwe", ">= 0.4.0"
26
26
 
27
27
  spec.add_development_dependency "bundler", "~> 1.16"
28
- spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "rake", "~> 13.0"
29
29
  spec.add_development_dependency "rspec", "~> 3.0"
30
30
  end
@@ -8,6 +8,7 @@ require "amex_tokenization_client/provisioning_payload"
8
8
  require "amex_tokenization_client/request"
9
9
  require "amex_tokenization_client/version"
10
10
 
11
+ # https://developer.americanexpress.com/products/amex-token-service/resources
11
12
  class AmexTokenizationClient
12
13
  attr_reader :host
13
14
  attr_reader :base_path
@@ -36,6 +37,13 @@ class AmexTokenizationClient
36
37
  response
37
38
  end
38
39
 
40
+ # @return [Hash] token_ref_id and other values.
41
+ def provisionings(kargs)
42
+ response = JSON.parse send_authorized_request('POST', 'provisionings', provisioning_payload(kargs))
43
+ response.merge! JSON.parse jwe_decrypt response.delete('secure_token_data')
44
+ response
45
+ end
46
+
39
47
  def notifications(kargs)
40
48
  send_authorized_request('POST', 'notifications', notifications_payload(kargs))
41
49
  end
@@ -88,6 +96,7 @@ class AmexTokenizationClient
88
96
  Hash[
89
97
  'Content-Type' => 'application/json',
90
98
  'Content-Language' => 'en-US',
99
+ 'Accept-Language' => 'en',
91
100
  'x-amex-token-requester-id' => token_requester_id,
92
101
  'x-amex-api-key' => client_id,
93
102
  'x-amex-request-id' => SecureRandom.uuid,
@@ -4,16 +4,18 @@ class AmexTokenizationClient
4
4
  class ProvisioningPayload
5
5
  attr_reader :account_number, :expiry_month, :expiry_year
6
6
  attr_reader :name, :email, :is_on_file, :ip_address
7
+ attr_reader :user_id
7
8
 
8
- def initialize(account_number:, name:, expiry_month:, expiry_year:, email:, is_on_file:, ip_address: nil)
9
+ def initialize(account_number:, name:, expiry_month:, expiry_year:, email:, is_on_file:, user_id: nil, ip_address: nil)
9
10
  @account_number, @expiry_month, @expiry_year = account_number, expiry_month, expiry_year
10
11
  @name, @email, @is_on_file, @ip_address = name, email, is_on_file, ip_address
12
+ @user_id = user_id
11
13
  end
12
14
 
13
15
  def to_json(encryption_key_id, encryption_key)
14
16
  Hash[
15
17
  account_data: account_data(encryption_key_id, encryption_key),
16
- user_data: { name: name, email: email },
18
+ user_data: { user_id: user_id, name: name, email: email }.compact,
17
19
  risk_assessment_data: risk_assessment_data
18
20
  ].to_json
19
21
  end
@@ -1,3 +1,3 @@
1
1
  class AmexTokenizationClient
2
- VERSION = "0.1.3"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amex_tokenization_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piers Chambers
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-18 00:00:00.000000000 Z
11
+ date: 2020-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwe
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '13.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: '13.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +66,7 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.0'
69
- description:
69
+ description:
70
70
  email:
71
71
  - piers@varyonic.com
72
72
  executables: []
@@ -76,6 +76,7 @@ files:
76
76
  - ".gitignore"
77
77
  - ".rspec"
78
78
  - ".travis.yml"
79
+ - CONTRIBUTING.md
79
80
  - Gemfile
80
81
  - LICENSE.txt
81
82
  - README.md
@@ -88,11 +89,11 @@ files:
88
89
  - lib/amex_tokenization_client/provisioning_payload.rb
89
90
  - lib/amex_tokenization_client/request.rb
90
91
  - lib/amex_tokenization_client/version.rb
91
- homepage: https://github.com/varyonic/amex-api-ruby-client
92
+ homepage: https://github.com/varyonic/amex_enhanced_authorization
92
93
  licenses:
93
94
  - MIT
94
95
  metadata: {}
95
- post_install_message:
96
+ post_install_message:
96
97
  rdoc_options: []
97
98
  require_paths:
98
99
  - lib
@@ -107,9 +108,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
108
  - !ruby/object:Gem::Version
108
109
  version: '0'
109
110
  requirements: []
110
- rubyforge_project:
111
- rubygems_version: 2.7.7
112
- signing_key:
111
+ rubyforge_project:
112
+ rubygems_version: 2.7.10
113
+ signing_key:
113
114
  specification_version: 4
114
115
  summary: Unofficial Ruby wrapper for the American Express Tokenization Service (AETS).
115
116
  test_files: []