bambora-client 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/linter.yml +13 -0
- data/.github/workflows/ruby.yml +34 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.rubocop.yml +108 -0
- data/.ruby-version +1 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +93 -0
- data/LICENSE.txt +21 -0
- data/README.md +198 -0
- data/Rakefile +8 -0
- data/bambora-client.gemspec +55 -0
- data/bin/console +12 -0
- data/bin/setup +8 -0
- data/lib/bambora/adapters/json_response.rb +7 -0
- data/lib/bambora/adapters/multipart_mixed_request.rb +23 -0
- data/lib/bambora/adapters/query_string_response.rb +20 -0
- data/lib/bambora/adapters/response.rb +44 -0
- data/lib/bambora/bank/adapters/payment_profile_response.rb +36 -0
- data/lib/bambora/bank/batch_report_messages.rb +81 -0
- data/lib/bambora/bank/batch_report_resource.rb +79 -0
- data/lib/bambora/bank/builders/payment_profile_params.rb +39 -0
- data/lib/bambora/bank/payment_profile_resource.rb +81 -0
- data/lib/bambora/builders/batch_payment_csv.rb +41 -0
- data/lib/bambora/builders/headers.rb +43 -0
- data/lib/bambora/builders/www_form_parameters.rb +33 -0
- data/lib/bambora/builders/xml_request_body.rb +19 -0
- data/lib/bambora/client.rb +215 -0
- data/lib/bambora/client/version.rb +7 -0
- data/lib/bambora/factories/response_adapter_factory.rb +21 -0
- data/lib/bambora/rest/batch_payment_file_upload_client.rb +58 -0
- data/lib/bambora/rest/client.rb +63 -0
- data/lib/bambora/rest/json_client.rb +109 -0
- data/lib/bambora/rest/www_form_client.rb +38 -0
- data/lib/bambora/rest/xml_client.rb +35 -0
- data/lib/bambora/v1/batch_payment_resource.rb +52 -0
- data/lib/bambora/v1/payment_resource.rb +82 -0
- data/lib/bambora/v1/profile_resource.rb +85 -0
- metadata +256 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 60f0ed5088f0e4f5b63e9335431dffc7562d2239d237a08ac45cbc116f118fce
|
4
|
+
data.tar.gz: 59bd1a213dde32eb67be6802e5621cf527c64e9b50a835fe754ecb663588a8fd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4bdbdf83b22c92b96bb6c04f71cfbfaaa2f5679e94cb2b00b431398cf09624f34e334201bcbe1e4efd2b4bd4bfb4a17c87058dfec438bff0c913075060a04411
|
7
|
+
data.tar.gz: 194b507146db394ceee4d59848a2126422224752d68f391fd8f866db5a9d0fc5785e4b22b2de4b94d9710d7bf0a58e0687d8e69053bb7819d1be7254ea1ca853
|
@@ -0,0 +1,34 @@
|
|
1
|
+
name: Tests
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
strategy:
|
10
|
+
matrix:
|
11
|
+
ruby: [ '2.4.x', '2.5.x', '2.6.x']
|
12
|
+
name: Ruby ${{ matrix.ruby }} Test
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@master
|
15
|
+
with:
|
16
|
+
ref: ${{ github.ref }}
|
17
|
+
- name: Cache Gems
|
18
|
+
uses: actions/cache@v1
|
19
|
+
with:
|
20
|
+
path: vendor/bundle
|
21
|
+
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
|
22
|
+
restore-keys: |
|
23
|
+
${{ runner.os }}-gem-
|
24
|
+
- name: Setup ruby
|
25
|
+
uses: actions/setup-ruby@v1
|
26
|
+
with:
|
27
|
+
ruby-version: ${{ matrix.ruby }}
|
28
|
+
- run: |
|
29
|
+
gem install bundler
|
30
|
+
bundle config path vendor/bundle
|
31
|
+
bundle install --jobs 4 --retry 3
|
32
|
+
- name: Run Tests
|
33
|
+
run: |
|
34
|
+
bundle exec rake spec
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.4
|
3
|
+
|
4
|
+
Metrics/ClassLength:
|
5
|
+
Enabled: false
|
6
|
+
|
7
|
+
Metrics/AbcSize:
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
Lint/AssignmentInCondition:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
Lint/MissingCopEnableDirective:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
Style/ParenthesesAroundCondition:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Style/DoubleNegation:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
Style/SymbolArray:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Style/ConditionalAssignment:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
Style/EmptyElse:
|
29
|
+
EnforcedStyle: empty
|
30
|
+
|
31
|
+
Style/Documentation:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
Style/TrailingCommaInArrayLiteral:
|
35
|
+
EnforcedStyleForMultiline: comma
|
36
|
+
|
37
|
+
Style/TrailingCommaInHashLiteral:
|
38
|
+
EnforcedStyleForMultiline: comma
|
39
|
+
|
40
|
+
Style/TrailingCommaInArguments:
|
41
|
+
EnforcedStyleForMultiline: comma
|
42
|
+
|
43
|
+
Layout/ParameterAlignment:
|
44
|
+
EnforcedStyle: with_fixed_indentation
|
45
|
+
|
46
|
+
Layout/EmptyLineAfterMagicComment:
|
47
|
+
Enabled: false
|
48
|
+
|
49
|
+
Layout/LineLength:
|
50
|
+
Max: 120
|
51
|
+
Severity: 'warning'
|
52
|
+
|
53
|
+
Metrics/MethodLength:
|
54
|
+
CountComments: false
|
55
|
+
Max: 100
|
56
|
+
|
57
|
+
Metrics/ModuleLength:
|
58
|
+
# These use file-spanning module blocks, making this cop useless
|
59
|
+
Exclude:
|
60
|
+
- 'spec/**/*'
|
61
|
+
|
62
|
+
Metrics/PerceivedComplexity:
|
63
|
+
Max: 50
|
64
|
+
|
65
|
+
Layout/MultilineMethodCallIndentation:
|
66
|
+
EnforcedStyle: indented_relative_to_receiver
|
67
|
+
|
68
|
+
Layout/MultilineOperationIndentation:
|
69
|
+
EnforcedStyle: indented
|
70
|
+
|
71
|
+
Layout/CaseIndentation:
|
72
|
+
EnforcedStyle: end
|
73
|
+
SupportedStyles:
|
74
|
+
- case
|
75
|
+
- end
|
76
|
+
IndentOneStep: true
|
77
|
+
|
78
|
+
Style/ClassAndModuleChildren:
|
79
|
+
EnforcedStyle: compact
|
80
|
+
SupportedStyles:
|
81
|
+
- nested
|
82
|
+
- compact
|
83
|
+
Enabled: false
|
84
|
+
|
85
|
+
Style/TernaryParentheses:
|
86
|
+
Enabled: true
|
87
|
+
EnforcedStyle: require_parentheses
|
88
|
+
|
89
|
+
Metrics/BlockLength:
|
90
|
+
Exclude:
|
91
|
+
- '*.gemspec'
|
92
|
+
- 'spec/*/**/*_spec.rb'
|
93
|
+
|
94
|
+
Style/SingleLineBlockParams:
|
95
|
+
Description: 'Enforces the names of some block params.'
|
96
|
+
Enabled: false
|
97
|
+
|
98
|
+
# Disabled since it catches strftime incorrectly
|
99
|
+
# See https://github.com/bbatsov/rubocop/issues/5245
|
100
|
+
Style/FormatStringToken:
|
101
|
+
Enabled: false
|
102
|
+
|
103
|
+
# safe_load is too restrictive, since we need ERB
|
104
|
+
Security/YAMLLoad:
|
105
|
+
Enabled: false
|
106
|
+
|
107
|
+
Style/RegexpLiteral:
|
108
|
+
Enabled: false
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.5.7
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -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 hello@cassidy.codes. 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 [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
bambora-client (0.1.0)
|
5
|
+
excon (< 1.0)
|
6
|
+
faraday (< 1.0)
|
7
|
+
gyoku (~> 1.0)
|
8
|
+
multiparty (~> 0)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
addressable (2.7.0)
|
14
|
+
public_suffix (>= 2.0.2, < 5.0)
|
15
|
+
ast (2.4.0)
|
16
|
+
builder (3.2.4)
|
17
|
+
byebug (11.0.1)
|
18
|
+
coderay (1.1.2)
|
19
|
+
crack (0.4.3)
|
20
|
+
safe_yaml (~> 1.0.0)
|
21
|
+
diff-lcs (1.3)
|
22
|
+
excon (0.71.0)
|
23
|
+
faraday (0.17.1)
|
24
|
+
multipart-post (>= 1.2, < 3)
|
25
|
+
gyoku (1.3.1)
|
26
|
+
builder (>= 2.1.2)
|
27
|
+
hashdiff (1.0.0)
|
28
|
+
jaro_winkler (1.5.3)
|
29
|
+
method_source (0.9.2)
|
30
|
+
mime-types (3.3)
|
31
|
+
mime-types-data (~> 3.2015)
|
32
|
+
mime-types-data (3.2019.1009)
|
33
|
+
multipart-post (2.1.1)
|
34
|
+
multiparty (0.2.0)
|
35
|
+
mime-types
|
36
|
+
parallel (1.18.0)
|
37
|
+
parser (2.6.5.0)
|
38
|
+
ast (~> 2.4.0)
|
39
|
+
pry (0.12.2)
|
40
|
+
coderay (~> 1.1.0)
|
41
|
+
method_source (~> 0.9.0)
|
42
|
+
pry-byebug (3.7.0)
|
43
|
+
byebug (~> 11.0)
|
44
|
+
pry (~> 0.10)
|
45
|
+
public_suffix (4.0.1)
|
46
|
+
rainbow (3.0.0)
|
47
|
+
rake (10.5.0)
|
48
|
+
rspec (3.9.0)
|
49
|
+
rspec-core (~> 3.9.0)
|
50
|
+
rspec-expectations (~> 3.9.0)
|
51
|
+
rspec-mocks (~> 3.9.0)
|
52
|
+
rspec-core (3.9.0)
|
53
|
+
rspec-support (~> 3.9.0)
|
54
|
+
rspec-expectations (3.9.0)
|
55
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
56
|
+
rspec-support (~> 3.9.0)
|
57
|
+
rspec-mocks (3.9.0)
|
58
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
59
|
+
rspec-support (~> 3.9.0)
|
60
|
+
rspec-support (3.9.0)
|
61
|
+
rspec_junit_formatter (0.4.1)
|
62
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
63
|
+
rubocop (0.74.0)
|
64
|
+
jaro_winkler (~> 1.5.1)
|
65
|
+
parallel (~> 1.10)
|
66
|
+
parser (>= 2.6)
|
67
|
+
rainbow (>= 2.2.2, < 4.0)
|
68
|
+
ruby-progressbar (~> 1.7)
|
69
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
70
|
+
ruby-progressbar (1.10.1)
|
71
|
+
safe_yaml (1.0.5)
|
72
|
+
unicode-display_width (1.6.0)
|
73
|
+
webmock (3.7.6)
|
74
|
+
addressable (>= 2.3.6)
|
75
|
+
crack (>= 0.3.2)
|
76
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
77
|
+
|
78
|
+
PLATFORMS
|
79
|
+
ruby
|
80
|
+
|
81
|
+
DEPENDENCIES
|
82
|
+
bambora-client!
|
83
|
+
bundler (~> 2)
|
84
|
+
pry (~> 0.12.0)
|
85
|
+
pry-byebug (~> 3.7)
|
86
|
+
rake (~> 10.0)
|
87
|
+
rspec (~> 3.0)
|
88
|
+
rspec_junit_formatter (~> 0.4.1)
|
89
|
+
rubocop (~> 0.74.0)
|
90
|
+
webmock (~> 3.7)
|
91
|
+
|
92
|
+
BUNDLED WITH
|
93
|
+
2.1.0
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Cassidy K
|
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,198 @@
|
|
1
|
+
# Bambora
|
2
|
+
|
3
|
+
![](https://github.com/HiMamaInc/bambora-client/workflows/Tests/badge.svg)
|
4
|
+
|
5
|
+
The official Bambora Ruby library is not thread-safe. This means you will run into errors when using it with Sidekiq or
|
6
|
+
Puma. This gem is a thread-safe client for the Bambora and Beanstream APIs.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'bambora-client'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
```bash
|
19
|
+
bundle
|
20
|
+
```
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
```bash
|
25
|
+
gem install bambora-client
|
26
|
+
```
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
You can initilize the client by passing a hash to it, or by passing a block.
|
31
|
+
|
32
|
+
All `*_api_key` arguments are optional. If you do not pass these API keys in on initialization, you can pass them into their respective method calls.
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
client = Bambora::Client.new(
|
36
|
+
base_url: ENV.fetch('BAMBORA_BASE_URL'),
|
37
|
+
merchant_id: ENV.fetch('BAMBORA_MERCHANT_ID'),
|
38
|
+
sub_merchant_id: ENV.fetch('BAMBORA_SUB_MERCHANT_ID'),
|
39
|
+
)
|
40
|
+
```
|
41
|
+
|
42
|
+
The `client` can now initialize new classes for making requests to `/profiles`, `/payments`, etc.
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
profiles = client.profiles(api_key: ENV.fetch('BAMBORA_PROFILES_API_KEY'))
|
46
|
+
profiles.delete(customer_code: '02355E2e58Bf488EAB4EaFAD7083dB6A')
|
47
|
+
```
|
48
|
+
|
49
|
+
### Profiles
|
50
|
+
|
51
|
+
*Summary*: Payment profiles store confidential payment information. Transactions can be processed against profiles.
|
52
|
+
*Bambora Docs*: <https://dev.na.bambora.com/docs/guides/payment_profiles/>
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
client = Bambora::Client.new(...)
|
56
|
+
profiles = client.profiles(api_key: ENV.fetch('BAMBORA_PROFILES_API_KEY'))
|
57
|
+
```
|
58
|
+
|
59
|
+
Once the resource instance has been instantiated, actions can be made against the API.
|
60
|
+
|
61
|
+
#### Create a Profile
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
profiles.create(
|
65
|
+
{
|
66
|
+
language: 'en',
|
67
|
+
comments: 'hello',
|
68
|
+
card: {
|
69
|
+
name: 'Hup Podling',
|
70
|
+
number: '4030000010001234',
|
71
|
+
expiry_month: '12',
|
72
|
+
expiry_year: '23',
|
73
|
+
cvd: '123',
|
74
|
+
},
|
75
|
+
},
|
76
|
+
)
|
77
|
+
# => {
|
78
|
+
# :code => 1,
|
79
|
+
# :message => "Operation Successful",
|
80
|
+
# :customer_code => "02355E2e58Bf488EAB4EaFAD7083dB6A",
|
81
|
+
# }
|
82
|
+
```
|
83
|
+
|
84
|
+
#### Delete a Profile
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
profiles.delete(customer_code: '02355E2e58Bf488EAB4EaFAD7083dB6A')
|
88
|
+
# => {
|
89
|
+
# :code => 1,
|
90
|
+
# :message => "Operation Successful",
|
91
|
+
# :customer_code => "02355E2e58Bf488EAB4EaFAD7083dB6A",
|
92
|
+
# }
|
93
|
+
```
|
94
|
+
|
95
|
+
### Payments
|
96
|
+
|
97
|
+
*Summary*: Process payments using Credit Card, Payment Profile, Legato Token, Cash, Cheque, Interac, Apple Pay, or
|
98
|
+
Android Pay.
|
99
|
+
*Bambora Docs*: <https://dev.na.bambora.com/docs/references/payment_APIs/>
|
100
|
+
|
101
|
+
```ruby
|
102
|
+
client = Bambora::Client.new(...)
|
103
|
+
payments = client.payments
|
104
|
+
```
|
105
|
+
|
106
|
+
#### Make A Payment
|
107
|
+
|
108
|
+
This is a lower level method that can be used to make a payment using any method. Below are some more specific and
|
109
|
+
high level convenience methods.
|
110
|
+
|
111
|
+
`create` is aliased as `make_payment` if you prefer syntax that reads more like a sentence.
|
112
|
+
|
113
|
+
```ruby
|
114
|
+
payments.create(
|
115
|
+
{
|
116
|
+
amount: 50,
|
117
|
+
payment_method: 'card',
|
118
|
+
card: {
|
119
|
+
name: 'Hup Podling',
|
120
|
+
number: '4504481742333',
|
121
|
+
expiry_month: '12',
|
122
|
+
expiry_year: '20',
|
123
|
+
cvd: '123',
|
124
|
+
},
|
125
|
+
},
|
126
|
+
)
|
127
|
+
# => {
|
128
|
+
# :id => "10000000",
|
129
|
+
# :authorizing_merchant_id => 300000000,
|
130
|
+
# :approved => "1",
|
131
|
+
# :message_id => "1",
|
132
|
+
# :message => "Approved",
|
133
|
+
# :auth_code => "TEST",
|
134
|
+
# :created => "2019-10-28T07:12:11",
|
135
|
+
# :order_number => "10000000",
|
136
|
+
# :type => "P",
|
137
|
+
# :payment_method => "CC",
|
138
|
+
# :risk_score => 0.0,
|
139
|
+
# :amount => 50.0,
|
140
|
+
# :custom => { :ref1 => "", :ref2 => "", :ref3 => "", :ref4 => "", :ref5 => "" },
|
141
|
+
# :card =>
|
142
|
+
# {
|
143
|
+
# :card_type => "VI",
|
144
|
+
# :last_fouri => "2333",
|
145
|
+
# :address_match => 0,
|
146
|
+
# :postal_result => 0,
|
147
|
+
# :avs_result => "0",
|
148
|
+
# :cvd_result => "1",
|
149
|
+
# :avs => { :id => "U", :message => "Address information is unavailable.", :processed => false }
|
150
|
+
# },
|
151
|
+
# :links =>
|
152
|
+
# [
|
153
|
+
# { :rel => "void", :href => "https://api.na.bambora.com/v1/payments/10000000/void", :method => "POST" },
|
154
|
+
# { :rel => "return", :href => "https://api.na.bambora.com/v1/payments/10000000/returns", :method => "POST" }
|
155
|
+
# ]
|
156
|
+
# }
|
157
|
+
```
|
158
|
+
|
159
|
+
##### Make A Payment With A Payment Profile
|
160
|
+
|
161
|
+
`create_with_payment_profile` is aliased as `make_payment_with_payment_profile` if you prefer syntax that reads more
|
162
|
+
like a sentence.
|
163
|
+
|
164
|
+
```ruby
|
165
|
+
payments.create_with_payment_profile(customer_code: '02355E2e58Bf488EAB4EaFAD7083dB6A', amount: 50)
|
166
|
+
# => {
|
167
|
+
# :id => "10000000",
|
168
|
+
# :authorizing_merchant_id => 300000000,
|
169
|
+
# :approved => "1",
|
170
|
+
# :message_id => "1",
|
171
|
+
# :message => "Approved",
|
172
|
+
# ...
|
173
|
+
# }
|
174
|
+
```
|
175
|
+
|
176
|
+
## Development
|
177
|
+
|
178
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can
|
179
|
+
also run `bin/console` for an interactive prompt that will allow you to experiment.
|
180
|
+
|
181
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the
|
182
|
+
version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version,
|
183
|
+
push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
184
|
+
|
185
|
+
## Contributing
|
186
|
+
|
187
|
+
Bug reports and pull requests are welcome on GitHub at <https://github.com/HiMamaInc/bambora-client>. This project is
|
188
|
+
intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the
|
189
|
+
[Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
190
|
+
|
191
|
+
## License
|
192
|
+
|
193
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
194
|
+
|
195
|
+
## Code of Conduct
|
196
|
+
|
197
|
+
Everyone interacting in the Bambora project’s codebases, issue trackers, chat rooms and mailing lists is expected to
|
198
|
+
follow the [code of conduct](https://github.com/HiMamaInc/bambora/blob/master/CODE_OF_CONDUCT.md).
|