windcave_rest 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4336597a4375374617ba683fa59bac3ec9e207c1df39fa1074a5a41dc619b964
4
+ data.tar.gz: b3e2048a406818e910cfb0c545737567efa8eb19c3c9f7bb025ae6a815f39b4e
5
+ SHA512:
6
+ metadata.gz: b6bd7d8e04cf23d693317a5a4f4c07bfa1da9846afab33d18474d41a70e280654dc83fbc3ab46126c5838746699506e05e3be35e8d5ab13644618fe04599a611
7
+ data.tar.gz: 9777d346f0ec424ca8795d4e8fd151b04a4d03d1262825632d687e4305ab61abfe7d9e0d81e9c71fdf792774a40c72e2bfc79b81e9f6927106211f89f7aecf79
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.6.5
6
+ before_install: gem install bundler -v 2.1.4
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at antodoms@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in windcave_rest.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "rspec", "~> 3.0"
data/Gemfile.lock ADDED
@@ -0,0 +1,42 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ windcave_rest (0.1.0)
5
+ json
6
+ typhoeus
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ diff-lcs (1.3)
12
+ ethon (0.12.0)
13
+ ffi (>= 1.3.0)
14
+ ffi (1.12.2)
15
+ json (2.3.0)
16
+ rake (12.3.3)
17
+ rspec (3.9.0)
18
+ rspec-core (~> 3.9.0)
19
+ rspec-expectations (~> 3.9.0)
20
+ rspec-mocks (~> 3.9.0)
21
+ rspec-core (3.9.1)
22
+ rspec-support (~> 3.9.1)
23
+ rspec-expectations (3.9.1)
24
+ diff-lcs (>= 1.2.0, < 2.0)
25
+ rspec-support (~> 3.9.0)
26
+ rspec-mocks (3.9.1)
27
+ diff-lcs (>= 1.2.0, < 2.0)
28
+ rspec-support (~> 3.9.0)
29
+ rspec-support (3.9.2)
30
+ typhoeus (1.3.1)
31
+ ethon (>= 0.9.0)
32
+
33
+ PLATFORMS
34
+ ruby
35
+
36
+ DEPENDENCIES
37
+ rake (~> 12.0)
38
+ rspec (~> 3.0)
39
+ windcave_rest!
40
+
41
+ BUNDLED WITH
42
+ 2.1.4
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Anto Dominic
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,98 @@
1
+ # Windcave / Payment Express REST API
2
+ Windcave Rest API is a simple rest based API allowing merchants full integration to all payment express / windcave cloud based services.
3
+
4
+ Current implementation of the gem includes the following features:
5
+
6
+ * [Session Create API](https://px5.docs.apiary.io/#reference/0/sessions/create-session)
7
+ * [Session Get API](https://px5.docs.apiary.io/#reference/0/sessions/query-session)
8
+ * [Transaction Create API](https://px5.docs.apiary.io/#reference/0/transactions/create-transaction)
9
+
10
+ Current implementation only allows interacting with these endpoints and parsing data to ruby formats correctly but it doesnt cater for different validations on certain object types.
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'windcave_rest'
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ $ bundle install
23
+
24
+ Or install it yourself as:
25
+
26
+ $ gem install windcave_rest
27
+
28
+ ## Usage
29
+
30
+ ### Session Create API
31
+ You may create a new session using this request.
32
+
33
+ ```ruby
34
+ @api_instance = WindcaveRest::SessionsApi.new
35
+
36
+ @create_session_options = {
37
+ body: WindcaveRest::CreateSessionRequest.new(
38
+ type: "purchase",
39
+ amount: "5.05",
40
+ currency: "AUD",
41
+ merchant_reference: "ORDER_1",
42
+ methods: ["card"],
43
+ store_card: true, # optional
44
+ stored_card_indicator: "single", # optional
45
+ )
46
+ }
47
+
48
+ @response = @api_instance.sessions_create(@create_session_options)
49
+ ```
50
+
51
+ ### Session GET API
52
+ You can use this request to query any existing session for the transaction outcome.
53
+
54
+ ```ruby
55
+ @session_id = "ID of the session from previous step"
56
+ @api_instance = WindcaveRest::SessionsApi.new
57
+ @response = @api_instance.sessions_get(@session_id)
58
+
59
+ ```
60
+
61
+ ### Transaction create API
62
+ Transactions are records of processed standard financial requests including; purchase, refund, auth, complete, validate and void.
63
+
64
+ ```ruby
65
+ @api_instance = WindcaveRest::TransactionsApi.new
66
+
67
+ @card_id = "Tokenised card ID that you can get from session GET API"
68
+
69
+ @create_transaction_options = {
70
+ type: "purchase",
71
+ amount: "5.0.5",
72
+ currency: get_currency,
73
+ merchant_reference: "ORDER_1",
74
+ card_id: @card_id
75
+ }
76
+
77
+ @response = @api_instance.transactions_create(@create_transaction_options)
78
+ ```
79
+
80
+
81
+ ## Development
82
+
83
+ 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.
84
+
85
+ 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).
86
+
87
+ ## Contributing
88
+
89
+ Bug reports and pull requests are welcome on GitHub at https://github.com/reinteractive/windcave_rest. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/windcave_rest/blob/master/CODE_OF_CONDUCT.md).
90
+
91
+
92
+ ## License
93
+
94
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
95
+
96
+ ## Code of Conduct
97
+
98
+ Everyone interacting in the WindcaveRest project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/windcave_rest/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "windcave_rest"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,35 @@
1
+ require "windcave_rest/version"
2
+ require "windcave_rest/configuration"
3
+ require 'windcave_rest/api_client'
4
+ require 'windcave_rest/api_error'
5
+
6
+ # Models
7
+ require 'windcave_rest/models/base'
8
+ require 'windcave_rest/models/address'
9
+ require 'windcave_rest/models/avs'
10
+ require 'windcave_rest/models/browser'
11
+ require 'windcave_rest/models/callback_urls'
12
+ require 'windcave_rest/models/card'
13
+ require 'windcave_rest/models/create_session_request'
14
+ require 'windcave_rest/models/create_transaction_request'
15
+ require 'windcave_rest/models/customer'
16
+ require 'windcave_rest/models/link'
17
+ require 'windcave_rest/models/session'
18
+ require 'windcave_rest/models/transaction'
19
+
20
+ # Apis
21
+ require 'windcave_rest/api/base_api'
22
+ require 'windcave_rest/api/sessions_api'
23
+ require 'windcave_rest/api/transactions_api'
24
+
25
+ module WindcaveRest
26
+ class << self
27
+ def configure
28
+ if block_given?
29
+ yield(Configuration.default)
30
+ else
31
+ Configuation.default
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,9 @@
1
+ module WindcaveRest
2
+ class BaseApi
3
+ attr_accessor :api_client
4
+
5
+ def initialize(api_client = ApiClient.default)
6
+ @api_client = api_client
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,107 @@
1
+ module WindcaveRest
2
+ class SessionsApi < WindcaveRest::BaseApi
3
+ # Create a Session
4
+ # Creates a Windcave Session. During the Session process a customer can apply for credit decisioning in real-time. This means the Session needs to represent a good picture of known customer details along with order information and the Session entity represents this as a resource. For more information on how to Session with Windcave see the https://px5.docs.apiary.io/#reference/0/transactions/create-session guide.
5
+ # @param [Hash] opts the optional parameters
6
+ # @option opts [CreateSessionRequest] :body
7
+ # @return [Session]
8
+ def sessions_create(opts = {})
9
+ data, _status_code, _headers = sessions_create_with_http_info(opts)
10
+ return data
11
+ end
12
+
13
+ # Create a session
14
+ # Creates a Windcave Session. During the Session process a customer can apply for credit decisioning in real-time. This means the Session needs to represent a good picture of known customer details along with order information and the Session entity represents this as a resource. For more information on how to Session with Windcave see the #model:Z2QcrzRGHACY8wM6G guide.
15
+ # @param [Hash] opts the optional parameters
16
+ # @option opts [CreateSessionRequest] :body
17
+ # @return [Array<(Session, Fixnum, Hash)>] Session data, response status code and response headers
18
+ def sessions_create_with_http_info(opts = {})
19
+ if @api_client.config.debugging
20
+ @api_client.config.logger.debug "Calling API: SessionsApi.sessions_create ..."
21
+ end
22
+ # resource path
23
+ local_var_path = "/sessions"
24
+
25
+ # query parameters
26
+ query_params = {}
27
+
28
+ # header parameters
29
+ header_params = {}
30
+ # HTTP header 'Accept' (if needed)
31
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
32
+ # HTTP header 'Content-Type'
33
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
34
+
35
+ # form parameters
36
+ form_params = {}
37
+
38
+ # http body (model)
39
+ post_body = @api_client.object_to_http_body(opts[:'body'])
40
+ auth_names = ['Authorization']
41
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
42
+ :header_params => header_params,
43
+ :query_params => query_params,
44
+ :form_params => form_params,
45
+ :body => post_body,
46
+ :auth_names => auth_names,
47
+ :return_type => 'Session')
48
+ if @api_client.config.debugging
49
+ @api_client.config.logger.debug "API called: SessionsApi#sessions_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
50
+ end
51
+ return data, status_code, headers
52
+ end
53
+
54
+ # Retrieve a Session
55
+ # Retrieves a previously created Session by id.
56
+ # @param id
57
+ # @param [Hash] opts the optional parameters
58
+ # @return [Session]
59
+ def sessions_get(id, opts = {})
60
+ data, _status_code, _headers = sessions_get_with_http_info(id, opts)
61
+ return data
62
+ end
63
+
64
+ # Retrieve a Session
65
+ # Retrieves a previously created Session by id.
66
+ # @param id
67
+ # @param [Hash] opts the optional parameters
68
+ # @return [Array<(Session, Fixnum, Hash)>] Session data, response status code and response headers
69
+ def sessions_get_with_http_info(id, opts = {})
70
+ if @api_client.config.debugging
71
+ @api_client.config.logger.debug "Calling API: sessionsApi.sessions_get ..."
72
+ end
73
+ # verify the required parameter 'id' is set
74
+ fail ArgumentError, "Missing the required parameter 'id' when calling sessionsApi.sessions_get" if id.nil?
75
+ # resource path
76
+ local_var_path = "/sessions/#{id}"
77
+
78
+ # query parameters
79
+ query_params = {}
80
+
81
+ # header parameters
82
+ header_params = {}
83
+ # HTTP header 'Accept' (if needed)
84
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
85
+ # HTTP header 'Content-Type'
86
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
87
+
88
+ # form parameters
89
+ form_params = {}
90
+
91
+ # http body (model)
92
+ post_body = nil
93
+ auth_names = ['Authorization']
94
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
95
+ :header_params => header_params,
96
+ :query_params => query_params,
97
+ :form_params => form_params,
98
+ :body => post_body,
99
+ :auth_names => auth_names,
100
+ :return_type => 'Session')
101
+ if @api_client.config.debugging
102
+ @api_client.config.logger.debug "API called: sessionsApi#sessions_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
103
+ end
104
+ return data, status_code, headers
105
+ end
106
+ end
107
+ end