alpha_card 0.1 → 0.1.1
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 +4 -4
- data/Gemfile +6 -0
- data/LICENSE +21 -0
- data/README.md +199 -0
- data/alpha_card.gemspec +14 -0
- data/lib/alpha_card/billing.rb +10 -0
- data/lib/alpha_card/order.rb +1 -0
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 695a1b4fb47438c189a87716ef13134d85c35854
|
4
|
+
data.tar.gz: 03c59165370cf209278b655d21ba57b72613cece
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d3f0ed869a45715977c53e7569493837832df23306cd15d3182f288b2b471595063dfbe6f1b41bdd2397ba9700668b77298c2c9f8f6d4e18037a27c0bd9921f
|
7
|
+
data.tar.gz: 190c4f5d74a67085a3e4cf248a90ee5454b681065f505d95871af554356c004c8dc92d92f029190c7f7741a88751854194d7634804d8fcab8ff5e7e7680bcd65
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Nikita Bulaj
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,199 @@
|
|
1
|
+
# Ruby lib for creating payments with AlphaCard DirectPost API
|
2
|
+
[](http://badge.fury.io/rb/alpha_card)
|
3
|
+
|
4
|
+
This gem can help your ruby/rails application to integrate with AlphaCard service.
|
5
|
+
|
6
|
+
AlphaCard:
|
7
|
+
http://www.alphacardservices.com/
|
8
|
+
|
9
|
+
Payment Gateway Integration Portal:
|
10
|
+
https://secure.alphacardgateway.com/merchants/resources/integration/integration_portal.php
|
11
|
+
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
If using bundler, first add 'alpha_card' to your Gemfile:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem "alpha_card"
|
19
|
+
```
|
20
|
+
|
21
|
+
And run
|
22
|
+
|
23
|
+
```sh
|
24
|
+
bundle install
|
25
|
+
```
|
26
|
+
|
27
|
+
Otherwise simply
|
28
|
+
|
29
|
+
```sh
|
30
|
+
gem install alpha_card
|
31
|
+
```
|
32
|
+
|
33
|
+
Dependencies required:
|
34
|
+
|
35
|
+
* ruby >= 1.9.3
|
36
|
+
* curb (for Curl)
|
37
|
+
* virtus (for nice OOP objects of AlphaCard)
|
38
|
+
|
39
|
+
## Objects
|
40
|
+
|
41
|
+
To create sale with Alpha Card Services you must operate with 5 objects:
|
42
|
+
|
43
|
+
* Account
|
44
|
+
* Order
|
45
|
+
- Billing
|
46
|
+
- Shipping
|
47
|
+
* Sale
|
48
|
+
|
49
|
+
### Account
|
50
|
+
|
51
|
+
Specify credentials to access Alpha Card Services, Inc.
|
52
|
+
|
53
|
+
_Required fields_:
|
54
|
+
|
55
|
+
* username : String
|
56
|
+
* password : String
|
57
|
+
|
58
|
+
_Constructor_:
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
AlphaCard::Account.new(username, password)
|
62
|
+
```
|
63
|
+
|
64
|
+
### Order
|
65
|
+
|
66
|
+
Specify Order.
|
67
|
+
|
68
|
+
_Required fields_:
|
69
|
+
|
70
|
+
* orderid : String
|
71
|
+
* orderdescription : String
|
72
|
+
|
73
|
+
_Unnecessary fields_:
|
74
|
+
|
75
|
+
* ponumber : String
|
76
|
+
* billing : AlphaCard::Billing
|
77
|
+
* shipping : AlphaCard::Shipping
|
78
|
+
|
79
|
+
_Constructor_:
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
AlphaCard::Order.new({field_name: value, ...})
|
83
|
+
```
|
84
|
+
|
85
|
+
Set up billing or shipping:
|
86
|
+
|
87
|
+
```ruby
|
88
|
+
order = AlphaCard::Order.new({})
|
89
|
+
order.shipping = AlphaCard::Shipping.new({})
|
90
|
+
order.billing = AlphaCard::Billing.new({})
|
91
|
+
```
|
92
|
+
|
93
|
+
### Billing
|
94
|
+
|
95
|
+
Specify Billing information for Order.
|
96
|
+
|
97
|
+
_Unnecessary fields_:
|
98
|
+
|
99
|
+
* firstname : String
|
100
|
+
* lastname : String
|
101
|
+
* email : String
|
102
|
+
* phone : String
|
103
|
+
* company : String
|
104
|
+
* address1 : String
|
105
|
+
* address2 : String
|
106
|
+
* city : String
|
107
|
+
* state : String
|
108
|
+
* zip : String
|
109
|
+
* country : String
|
110
|
+
* website : String
|
111
|
+
|
112
|
+
_Constructor_:
|
113
|
+
|
114
|
+
```ruby
|
115
|
+
AlphaCard::Billing.new({field_name: value, ...})
|
116
|
+
```
|
117
|
+
|
118
|
+
### Shipping
|
119
|
+
|
120
|
+
Specify Shipping information for Order.
|
121
|
+
|
122
|
+
_Unnecessary fields_:
|
123
|
+
|
124
|
+
* address_1 : String
|
125
|
+
* address_2 : String
|
126
|
+
* city : String
|
127
|
+
* state : String
|
128
|
+
* zip_code : String
|
129
|
+
* email : String
|
130
|
+
|
131
|
+
_Constructor_:
|
132
|
+
|
133
|
+
```ruby
|
134
|
+
AlphaCard::Shipping.new({field_name: value, ...})
|
135
|
+
```
|
136
|
+
|
137
|
+
### Sale
|
138
|
+
|
139
|
+
Specify and process Order payment information.
|
140
|
+
|
141
|
+
_Required fields_:
|
142
|
+
|
143
|
+
* ccexp : String
|
144
|
+
* ccnumber : String
|
145
|
+
* amount : String
|
146
|
+
|
147
|
+
_Unnecessary fields_:
|
148
|
+
* cvv : String
|
149
|
+
|
150
|
+
_Constructor_:
|
151
|
+
|
152
|
+
```ruby
|
153
|
+
AlphaCard::Sale.new({field_name: value, ...})
|
154
|
+
```
|
155
|
+
|
156
|
+
To process the sale you must call *create(_alpha_card_order_, _alpha_card_account_)*:
|
157
|
+
|
158
|
+
```ruby
|
159
|
+
...
|
160
|
+
sale = AlphaCard::Sale.new({})
|
161
|
+
sale.create(order, account)
|
162
|
+
```
|
163
|
+
|
164
|
+
Method _create_ returns _true_ if sale was created successfully and raise an AlphaCardError
|
165
|
+
exception if some of the fields is invalid.
|
166
|
+
|
167
|
+
## Example of usage
|
168
|
+
|
169
|
+
Create AlphaCard sale:
|
170
|
+
|
171
|
+
```ruby
|
172
|
+
def create_payment
|
173
|
+
account = AlphaCard::Account.new('demo', 'password')
|
174
|
+
|
175
|
+
billing = AlphaCard::Billing.new({email: 'test@example.com', phone: '+801311313111'})
|
176
|
+
shipping = AlphaCard::Shipping.new({address_1: '33 N str', city: 'New York', state: 'NY', zip_code: '132'})
|
177
|
+
|
178
|
+
order = AlphaCard::Order.new({orderid: 1, orderdescription: 'Test order'})
|
179
|
+
order.billing = billing
|
180
|
+
order.shipping = shipping
|
181
|
+
|
182
|
+
sale = AlphaCard::Sale.new({ccexp: '0117', ccnumber: '4111111111111111', amount: "%.2f" % 1.5 , cvv: '123'})
|
183
|
+
sale.create(order, account)
|
184
|
+
rescue AlphaCard::AlphaCardError => e
|
185
|
+
puts e.message
|
186
|
+
false
|
187
|
+
end
|
188
|
+
```
|
189
|
+
|
190
|
+
Billing and shipping is an _optional_ parameters and can be not specified.
|
191
|
+
|
192
|
+
Format of parameters can be found on _Alpha Card Payment Gateway Integration Portal_ ->
|
193
|
+
_Direct Post API_ -> _Documentation_ -> _Transaction Variables_
|
194
|
+
|
195
|
+
Naming convention of attributes (such as "ccexp" or "orderid") was saved due to compatibility with AlphaCard API.
|
196
|
+
|
197
|
+
## Copyright
|
198
|
+
|
199
|
+
Copyright (c) 2014 Nikita Bulaj (bulajnikita@gmail.com).
|
data/alpha_card.gemspec
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
Gem::Specification.new do |gem|
|
2
|
+
gem.name = 'alpha_card'
|
3
|
+
gem.version = '0.1.1'
|
4
|
+
gem.date = '2014-06-25'
|
5
|
+
gem.summary = "Alpha Card DirectPost API for Ruby"
|
6
|
+
gem.description = "Gem for creates sales with Alpha Card DirectPost API"
|
7
|
+
gem.authors = ["Nikita Bulaj"]
|
8
|
+
gem.email = 'bulajnikita@gmail.com'
|
9
|
+
gem.require_paths = ["lib"]
|
10
|
+
gem.files = `git ls-files`.split($/)
|
11
|
+
gem.homepage = 'http://github.com/budev/alpha_card'
|
12
|
+
gem.license = 'MIT'
|
13
|
+
gem.required_ruby_version = '>= 1.9.3'
|
14
|
+
end
|
data/lib/alpha_card/billing.rb
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
module AlphaCard
|
2
2
|
class Billing < AlphaCardObject
|
3
|
+
attribute :firstname, String
|
4
|
+
attribute :lastname, String
|
3
5
|
attribute :email, String
|
4
6
|
attribute :phone, String
|
7
|
+
attribute :company, String
|
8
|
+
attribute :address1, String
|
9
|
+
attribute :address2, String
|
10
|
+
attribute :city, String
|
11
|
+
attribute :state, String
|
12
|
+
attribute :zip, String
|
13
|
+
attribute :country, String
|
14
|
+
attribute :website, String
|
5
15
|
end
|
6
16
|
end
|
data/lib/alpha_card/order.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alpha_card
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikita Bulaj
|
@@ -16,6 +16,10 @@ executables: []
|
|
16
16
|
extensions: []
|
17
17
|
extra_rdoc_files: []
|
18
18
|
files:
|
19
|
+
- Gemfile
|
20
|
+
- LICENSE
|
21
|
+
- README.md
|
22
|
+
- alpha_card.gemspec
|
19
23
|
- lib/alpha_card.rb
|
20
24
|
- lib/alpha_card/account.rb
|
21
25
|
- lib/alpha_card/alpha_card_error.rb
|
@@ -39,7 +43,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
39
43
|
requirements:
|
40
44
|
- - ">="
|
41
45
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
46
|
+
version: 1.9.3
|
43
47
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
44
48
|
requirements:
|
45
49
|
- - ">="
|
@@ -50,5 +54,5 @@ rubyforge_project:
|
|
50
54
|
rubygems_version: 2.2.2
|
51
55
|
signing_key:
|
52
56
|
specification_version: 4
|
53
|
-
summary: Alpha Card DirectPost API
|
57
|
+
summary: Alpha Card DirectPost API for Ruby
|
54
58
|
test_files: []
|