alpha_card 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +3 -1
- data/CHANGELOG.md +7 -0
- data/README.md +48 -10
- data/alpha_card.gemspec +2 -2
- data/lib/alpha_card.rb +1 -0
- data/lib/alpha_card/version.rb +1 -1
- metadata +4 -6
- data/Gemfile.lock +0 -56
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 785fc7604d14629c4c96d57dc74c3e19326e0e99
|
4
|
+
data.tar.gz: 1c23c5ec52bf741b1f9d46487e7aedd1410fe577
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01c655f0b85772e5d24e2fc0109a19ad62fc540696a16fedc996fbcc3c62de91b1ec4388357d1f14c3cfc9f2890a46d8b7ff39c78c6a13aeadefee4a9a00dc0c
|
7
|
+
data.tar.gz: 476c98c3f249e9b01f7a7ab5a8a8350dfe68b9c73e0cc1db006db172acafb89e6e641a691b5a0f606eccb718ea850a4cbbf9fba177e691164dc0aea6f42d6fa5
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
|
3
3
|
Reverse Chronological Order:
|
4
4
|
|
5
|
+
## `0.4.1` (2017-08-10)
|
6
|
+
|
7
|
+
https://github.com/nbulaj/alpha_card/compare/0.4.0...0.4.1
|
8
|
+
|
9
|
+
### Changes
|
10
|
+
* Fix `OpenSSL` error
|
11
|
+
|
5
12
|
## `0.4.0` (2016-10-07)
|
6
13
|
|
7
14
|
https://github.com/nbulaj/alpha_card/compare/0.3.0...0.4.0
|
data/README.md
CHANGED
@@ -3,18 +3,40 @@
|
|
3
3
|
[![Build Status](https://travis-ci.org/nbulaj/alpha_card.svg?branch=master)](https://travis-ci.org/nbulaj/alpha_card)
|
4
4
|
[![Dependency Status](https://gemnasium.com/nbulaj/alpha_card.svg)](https://gemnasium.com/nbulaj/alpha_card)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/nbulaj/alpha_card/badges/gpa.svg)](https://codeclimate.com/github/nbulaj/alpha_card)
|
6
|
-
[![Coverage Status](https://coveralls.io/repos/nbulaj/alpha_card/badge.svg)](https://coveralls.io/
|
6
|
+
[![Coverage Status](https://coveralls.io/repos/github/nbulaj/alpha_card/badge.svg)](https://coveralls.io/github/nbulaj/alpha_card)
|
7
7
|
[![Inline docs](http://inch-ci.org/github/nbulaj/alpha_card.png?branch=master)](http://inch-ci.org/github/nbulaj/alpha_card)
|
8
8
|
[![License](http://img.shields.io/badge/license-MIT-brightgreen.svg)](#license)
|
9
9
|
|
10
|
-
This gem can help your Ruby or Ruby on Rails application to integrate with Alpha Card Service, Inc.
|
10
|
+
This gem can help your Ruby, JRuby or Ruby on Rails application to integrate with Alpha Card Service, Inc.
|
11
11
|
|
12
12
|
Alpha Card Services:
|
13
13
|
http://www.alphacardservices.com/
|
14
|
-
|
14
|
+
|
15
15
|
Payment Gateway Integration Portal:
|
16
16
|
https://secure.alphacardgateway.com/merchants/resources/integration/integration_portal.php
|
17
17
|
|
18
|
+
## Table of Contents
|
19
|
+
|
20
|
+
- [Installation](#installation)
|
21
|
+
- [Configuration](#configuration)
|
22
|
+
- [Alpha Card Objects & Transactions](#alpha-card-objects--transactions)
|
23
|
+
- [Order](#order)
|
24
|
+
- [Billing](#billing)
|
25
|
+
- [Shipping](#shipping)
|
26
|
+
- [Sale](#sale)
|
27
|
+
- [Refund](#refund)
|
28
|
+
- [Void](#void)
|
29
|
+
- [Capture](#capture)
|
30
|
+
- [Update](#update)
|
31
|
+
- [Authorization](#authorization)
|
32
|
+
- [Credit](#credit)
|
33
|
+
- [Validate](#validate)
|
34
|
+
- [Example of usage](#example-of-usage)
|
35
|
+
- [AlphaCard Response](#alphacard-response)
|
36
|
+
- [Testing](#testing)
|
37
|
+
- [Contributing](#contributing)
|
38
|
+
- [License](#license)
|
39
|
+
|
18
40
|
## Installation
|
19
41
|
|
20
42
|
If using bundler, first add 'alpha_card' to your Gemfile:
|
@@ -37,20 +59,31 @@ gem install alpha_card -v '0.4'
|
|
37
59
|
|
38
60
|
Dependencies required:
|
39
61
|
|
40
|
-
* ruby >= 2.
|
62
|
+
* ruby >= 2.2.2 or [jruby](https://github.com/jruby/jruby) >= 9.0.5.0;
|
41
63
|
|
42
|
-
##
|
64
|
+
## Configuration
|
43
65
|
|
44
66
|
In order to use Alpha Card Gateway API you need to have a Merchant account credentials such as `username` and `password`.
|
45
67
|
|
46
|
-
If your project will always use only one account, then you can configure gem as follows:
|
68
|
+
If your project will always use only one account for processing payments, then you can configure gem as follows:
|
47
69
|
|
48
70
|
```ruby
|
49
|
-
# config/initializers/alpha_card.rb - for Rails projects
|
50
71
|
AlphaCard::Account.username = 'username'
|
51
72
|
AlphaCard::Account.password = 'password'
|
52
73
|
```
|
53
74
|
|
75
|
+
In Rails applications you can create an initializer:
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
# config/initializers/alpha_card.rb
|
79
|
+
if Rails.env.test? || Rails.env.ci?
|
80
|
+
AlphaCard::Account.use_demo_credentials!
|
81
|
+
else
|
82
|
+
AlphaCard::Account.username = 'username'
|
83
|
+
AlphaCard::Account.password = 'password'
|
84
|
+
end
|
85
|
+
```
|
86
|
+
|
54
87
|
Another way is to pass the credentials as a last argument when creating some transactions or perform operations (it can be useful when you need to operate with multiple Alpha Card accounts):
|
55
88
|
|
56
89
|
```ruby
|
@@ -332,10 +365,11 @@ def create_payment
|
|
332
365
|
|
333
366
|
order = AlphaCard::Order.new(id: 1, description: 'Test order', billing: billing, shipping: shipping)
|
334
367
|
|
335
|
-
# Format of amount: "XX.XX"
|
336
|
-
sale = AlphaCard::Sale.new(
|
368
|
+
# Format of the amount: "XX.XX"
|
369
|
+
sale = AlphaCard::Sale.new(card_expiration_date: '0117', card_number: '4111111111111111', amount: '1.50', cvv: '123')
|
337
370
|
response = sale.create(order)
|
338
371
|
#=> #<AlphaCard::Response:0x1a0fda ...>
|
372
|
+
|
339
373
|
if response.success?
|
340
374
|
puts "Order payed successfully: transaction ID = #{response.transaction_id}"
|
341
375
|
true
|
@@ -345,6 +379,10 @@ def create_payment
|
|
345
379
|
puts "AVS response: #{e.response.avs_response}"
|
346
380
|
false
|
347
381
|
end
|
382
|
+
|
383
|
+
rescue AlphaCard::APIConnectionError => e
|
384
|
+
puts "Connection problems: #{e.message}"
|
385
|
+
false
|
348
386
|
end
|
349
387
|
```
|
350
388
|
|
@@ -407,4 +445,4 @@ Thanks.
|
|
407
445
|
|
408
446
|
Alpha Card gem is released under the [MIT License](http://www.opensource.org/licenses/MIT).
|
409
447
|
|
410
|
-
Copyright (c) 2014-
|
448
|
+
Copyright (c) 2014-2017 Nikita Bulai (bulajnikita@gmail.com).
|
data/alpha_card.gemspec
CHANGED
@@ -5,10 +5,10 @@ require 'alpha_card/version'
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = 'alpha_card'
|
7
7
|
gem.version = AlphaCard.gem_version
|
8
|
-
gem.date = '
|
8
|
+
gem.date = '2017-08-11'
|
9
9
|
gem.summary = 'Alpha Card Services API for Ruby'
|
10
10
|
gem.description = 'Gem for creating sales with Alpha Card Services'
|
11
|
-
gem.authors = ['Nikita
|
11
|
+
gem.authors = ['Nikita Bulai']
|
12
12
|
gem.email = 'bulajnikita@gmail.com'
|
13
13
|
gem.require_paths = ['lib']
|
14
14
|
gem.files = `git ls-files`.split($RS)
|
data/lib/alpha_card.rb
CHANGED
data/lib/alpha_card/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alpha_card
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Nikita
|
7
|
+
- Nikita Bulai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -55,7 +55,6 @@ files:
|
|
55
55
|
- ".travis.yml"
|
56
56
|
- CHANGELOG.md
|
57
57
|
- Gemfile
|
58
|
-
- Gemfile.lock
|
59
58
|
- LICENSE
|
60
59
|
- README.md
|
61
60
|
- ROADMAP.md
|
@@ -119,9 +118,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
118
|
version: '0'
|
120
119
|
requirements: []
|
121
120
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.
|
121
|
+
rubygems_version: 2.6.11
|
123
122
|
signing_key:
|
124
123
|
specification_version: 4
|
125
124
|
summary: Alpha Card Services API for Ruby
|
126
125
|
test_files: []
|
127
|
-
has_rdoc:
|
data/Gemfile.lock
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
alpha_card (0.4.0)
|
5
|
-
rack (~> 2.0, >= 2.0)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
coveralls (0.8.15)
|
11
|
-
json (>= 1.8, < 3)
|
12
|
-
simplecov (~> 0.12.0)
|
13
|
-
term-ansicolor (~> 1.3)
|
14
|
-
thor (~> 0.19.1)
|
15
|
-
tins (>= 1.6.0, < 2)
|
16
|
-
diff-lcs (1.2.5)
|
17
|
-
docile (1.1.5)
|
18
|
-
json (2.0.2)
|
19
|
-
rack (2.0.1)
|
20
|
-
rack-test (0.6.3)
|
21
|
-
rack (>= 1.0)
|
22
|
-
rspec (3.5.0)
|
23
|
-
rspec-core (~> 3.5.0)
|
24
|
-
rspec-expectations (~> 3.5.0)
|
25
|
-
rspec-mocks (~> 3.5.0)
|
26
|
-
rspec-core (3.5.4)
|
27
|
-
rspec-support (~> 3.5.0)
|
28
|
-
rspec-expectations (3.5.0)
|
29
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
-
rspec-support (~> 3.5.0)
|
31
|
-
rspec-mocks (3.5.0)
|
32
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
33
|
-
rspec-support (~> 3.5.0)
|
34
|
-
rspec-support (3.5.0)
|
35
|
-
simplecov (0.12.0)
|
36
|
-
docile (~> 1.1.0)
|
37
|
-
json (>= 1.8, < 3)
|
38
|
-
simplecov-html (~> 0.10.0)
|
39
|
-
simplecov-html (0.10.0)
|
40
|
-
term-ansicolor (1.4.0)
|
41
|
-
tins (~> 1.0)
|
42
|
-
thor (0.19.1)
|
43
|
-
tins (1.12.0)
|
44
|
-
|
45
|
-
PLATFORMS
|
46
|
-
ruby
|
47
|
-
x86-mingw32
|
48
|
-
|
49
|
-
DEPENDENCIES
|
50
|
-
alpha_card!
|
51
|
-
coveralls
|
52
|
-
rack-test
|
53
|
-
rspec (~> 3.5)
|
54
|
-
|
55
|
-
BUNDLED WITH
|
56
|
-
1.13.1
|