alpha_card 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 294f83e708f2952a60d2ecf8480ae58af870e368
4
- data.tar.gz: 1fa31126072357beaed859e4415c03245a937e13
3
+ metadata.gz: f7e8e249cdf49bffd9bbda0825018bc6406e0c52
4
+ data.tar.gz: 6241892718864310e112ec3c39eb6cdc7efac26f
5
5
  SHA512:
6
- metadata.gz: 6c715932f21918d1914c83df62fd8a96e963b5a322c20da13b7facc00efc60cb8353ca6be255f403d0b684cb5db91fb4b92f623026adb7bdafb2a415ea54bb56
7
- data.tar.gz: 1e091ed0479b8d61741f7cd37fea94f2b58ef6f5c34403743d4bd846d8e985080628ecd82a04b22fa15ffff96e0a150cb88c1a4a9daca67c24cd5a34b7dab988
6
+ metadata.gz: d604d1ca794b016047390a7bd9915a54ae3ef4d4b25d4514808ac28f109a5f2aeb9e328793f58df4b706ddc7b3557800c15906df9893e6d23d68687a6beec605
7
+ data.tar.gz: 7a46b389c6aaeec686a189e5add88b864929ffe1be3169fa5f5e40c285da37efb5e593d8635367ce722329d12dc24d5781aa33970717ca6dc6d0c9c0dd35e65b
@@ -0,0 +1,13 @@
1
+ language: ruby
2
+ before_install: gem install bundler
3
+ bundler_args: --without yard guard benchmarks
4
+ script: "rake spec"
5
+ rvm:
6
+ - 1.9.3
7
+ - 2.0.0
8
+ - 2.1.0
9
+ - jruby-19mode
10
+ - ruby-head
11
+ matrix:
12
+ allow_failures:
13
+ - rvm: ruby-head
data/Gemfile CHANGED
@@ -5,4 +5,4 @@ gemspec
5
5
  gem 'virtus'
6
6
  gem 'rest_client'
7
7
  gem 'rack'
8
- #gem 'simplecov', :require => false
8
+ gem 'coveralls', require: false
data/README.md CHANGED
@@ -1,10 +1,13 @@
1
1
  # Ruby lib for creating payments with AlphaCard DirectPost API
2
2
  [![Gem Version](https://badge.fury.io/rb/alpha_card.svg)](http://badge.fury.io/rb/alpha_card)
3
3
  [![Dependency Status](https://gemnasium.com/budev/alpha_card.png)](https://gemnasium.com/budev/alpha_card)
4
+ [![Code Climate](https://codeclimate.com/github/budev/alpha_card.png)](https://codeclimate.com/github/budev/alpha_card)
5
+ [![Coverage Status](https://coveralls.io/repos/budev/alpha_card/badge.png?branch=master)](https://coveralls.io/r/budev/alpha_card?branch=master)
6
+ [![Build Status](https://travis-ci.org/budev/alpha_card.svg?branch=master)](https://travis-ci.org/budev/alpha_card)
4
7
 
5
- This gem can help your ruby/rails application to integrate with AlphaCard service.
8
+ This gem can help your Ruby or Ruby on Rails application to integrate with Alpha Card Service, Inc.
6
9
 
7
- AlphaCard Services:
10
+ Alpha Card Services:
8
11
  http://www.alphacardservices.com/
9
12
 
10
13
  Payment Gateway Integration Portal:
@@ -19,13 +22,13 @@ If using bundler, first add 'alpha_card' to your Gemfile:
19
22
  gem "alpha_card"
20
23
  ```
21
24
 
22
- And run
25
+ And run:
23
26
 
24
27
  ```sh
25
28
  bundle install
26
29
  ```
27
30
 
28
- Otherwise simply
31
+ Otherwise simply install the gem:
29
32
 
30
33
  ```sh
31
34
  gem install alpha_card
@@ -33,13 +36,14 @@ gem install alpha_card
33
36
 
34
37
  Dependencies required:
35
38
 
36
- * ruby >= 1.9.3
37
- * rest_client
38
- * virtus (for nice OOP objects of AlphaCard)
39
+ * ruby >= 1.9.3;
40
+ * rack;
41
+ * rest_client;
42
+ * virtus (for nice OOP objects of AlphaCard).
39
43
 
40
44
  ## Objects
41
45
 
42
- To create sale with Alpha Card Services you must operate with 5 objects:
46
+ Alpha Card sales operates with next 5 objects:
43
47
 
44
48
  * Account
45
49
  * Order
@@ -49,7 +53,8 @@ To create sale with Alpha Card Services you must operate with 5 objects:
49
53
 
50
54
  ### Account
51
55
 
52
- Specify credentials to access Alpha Card Services, Inc.
56
+ Account represents credentials data to access Alpha Card Services, Inc.
57
+ All sales will be created for the specified account.
53
58
 
54
59
  _Required fields_:
55
60
 
@@ -64,16 +69,14 @@ AlphaCard::Account.new(username, password)
64
69
 
65
70
  ### Order
66
71
 
67
- Specify Order.
72
+ Order represents itself.
68
73
 
69
- _Required fields_:
74
+ _Unnecessary fields_:
70
75
 
71
76
  * orderid : String
72
77
  * orderdescription : String
73
-
74
- _Unnecessary fields_:
75
-
76
78
  * ponumber : String
79
+ * tax : String
77
80
  * billing : AlphaCard::Billing
78
81
  * shipping : AlphaCard::Shipping
79
82
 
@@ -83,14 +86,6 @@ _Constructor_:
83
86
  AlphaCard::Order.new({field_name: value, ...})
84
87
  ```
85
88
 
86
- Set up billing or shipping:
87
-
88
- ```ruby
89
- order = AlphaCard::Order.new({})
90
- order.shipping = AlphaCard::Shipping.new({})
91
- order.billing = AlphaCard::Billing.new({})
92
- ```
93
-
94
89
  ### Billing
95
90
 
96
91
  Specify Billing information for Order.
@@ -137,7 +132,7 @@ AlphaCard::Shipping.new({field_name: value, ...})
137
132
 
138
133
  ### Sale
139
134
 
140
- Specify and process Order payment information.
135
+ Sale is the main object of the Alpha Card Services. It processes fees associated with credit cards.
141
136
 
142
137
  _Required fields_:
143
138
 
@@ -154,7 +149,7 @@ _Constructor_:
154
149
  AlphaCard::Sale.new({field_name: value, ...})
155
150
  ```
156
151
 
157
- To process the sale you must call *create(_alpha_card_order_, _alpha_card_account_)*:
152
+ To create the payment you must call *create(_alpha_card_order_, _alpha_card_account_)* method:
158
153
 
159
154
  ```ruby
160
155
  ...
@@ -162,8 +157,7 @@ sale = AlphaCard::Sale.new({})
162
157
  sale.create(order, account)
163
158
  ```
164
159
 
165
- Method `create` returns _true_ if sale was created successfully and raise an `AlphaCardError`
166
- exception if some of the fields is invalid.
160
+ This method returns _true_ if sale was created successfully and raise an `AlphaCardError` exception if some of the fields is invalid.
167
161
 
168
162
  ## Example of usage
169
163
 
@@ -192,10 +186,10 @@ end
192
186
 
193
187
  `Billing` and `shipping` is an _optional_ parameters and can be not specified.
194
188
 
195
- _Note_: take a look to the `amount` of the Order. It's format must be 'xx.xx'. All information about formats
189
+ _Note_: take a look at the `amount` of the Order. It's format must be 'xx.xx'. All information about variables formats
196
190
  can be found on _Alpha Card Payment Gateway Integration Portal_ -> _Direct Post API_ -> _Documentation_ -> _Transaction Variables_
197
191
 
198
- Naming convention of attributes (such as "ccexp" or "orderid") was saved due to compatibility with AlphaCard API.
192
+ Naming convention of attributes (such as "ccexp" or "orderid") was saved for compatibility with AlphaCard API.
199
193
 
200
194
  To raise some exceptions do the next:
201
195
 
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'alpha_card'
3
- gem.version = '0.1.5'
4
- gem.date = '2014-06-25'
3
+ gem.version = '0.1.6'
4
+ gem.date = '2014-06-26'
5
5
  gem.summary = 'Alpha Card Services DirectPost API for Ruby'
6
6
  gem.description = 'Gem for creating sales with Alpha Card Services DirectPost API'
7
7
  gem.authors = ['Nikita Bulaj']
@@ -9,7 +9,7 @@
9
9
  "CALL TK": 'Refer to TeleCheck.'
10
10
  "CALL WC": 'Refer to Worldcheck.'
11
11
  "CALL XXXXXXXXXX": 'Call indicated number.'
12
- "ISSUER UNAVAIL NDC": 'cannot contact issuing bank for authorization.'
12
+ "ISSUER UNAVAIL": 'NDC cannot contact issuing bank for authorization.'
13
13
  "INVLD MERCH ID": 'Invalid Merchant ID.'
14
14
  "PIC UP": 'Authorization declined.'
15
15
  "DECLINE": 'Authorization declined.'
@@ -47,7 +47,7 @@
47
47
  "DB UNAVAIL 04": 'NDC GATEWAY cannot contact EFT network or EFT Group ID is incorrect.'
48
48
  "UNAUTH USER": 'Merchant is not set up for debit on NDC Merchant Master File.'
49
49
  "INVALID CARD": 'Debit card not on issuer file.'
50
- "DB ISSUER UNAVAIL EFT": 'network cannot contact issuer'
50
+ "DB ISSUER UNAVAIL": 'EFT network cannot contact issuer'
51
51
  "INVALID POS CARD": 'Card is not eligible for POS.'
52
52
  "ACCT TYPE INVLD": 'Type of account entered cannot be accessed (checking, savings, etc.)'
53
53
  "INVALID PREFIX": 'No sharing arrangement for this card.'
@@ -55,8 +55,8 @@
55
55
  "VERIFY XXXXXXXXXX": 'Match on SCAN file. XXXXXXXXXX is routing/transit number on the negative file.'
56
56
  "INVALID LIC": 'The license or ID number entered during a check authorization transaction is incorrect.'
57
57
  "INVALID STATE CD": 'State code entered is incorrect.'
58
- "EDC UNAVAILABLE EDC": 'application down, try later.'
58
+ "EDC UNAVAILABLE": 'EDC application down, try later.'
59
59
  "DB UNAVAIL 01": 'Problem at NDC routing transaction.'
60
- "SCAN UNAVAILABLE SCAN": 'application is down, try later.'
60
+ "SCAN UNAVAILABLE": 'SCAN application is down, try later.'
61
61
  "EXCEEDS MAX AMT": 'Exceeds withdrawal amount limit.'
62
62
  "EXCEEDS MAX USES": 'Exceeds withdrawal frequency limit'
@@ -3,6 +3,7 @@ module AlphaCard
3
3
  attribute :orderid, Integer
4
4
  attribute :orderdescription, String
5
5
  attribute :ponumber, String
6
+ attribute :tax, String
6
7
 
7
8
  attribute :billing, AlphaCard::Billing
8
9
  attribute :shipping, AlphaCard::Shipping
@@ -21,7 +21,7 @@ module AlphaCard
21
21
  # sale.create(order, account) #=> true or false
22
22
  def create(order, account)
23
23
  [:ccexp, :ccnumber, :amount].each do |attr|
24
- raise Exception.new("No #{attr.to_s} information provided") if self.send(attr.to_s).blank?
24
+ raise Exception.new("No #{attr} information provided") if self[attr].blank?
25
25
  end
26
26
 
27
27
  params = self.filled_attributes || {}
@@ -69,6 +69,14 @@ describe AlphaCard do
69
69
  end
70
70
  end
71
71
 
72
+ context 'Without attributes' do
73
+ let!(:sale) { AlphaCard::Sale.new({}) }
74
+
75
+ it 'should raise an Exception' do
76
+ expect { sale.create(order, account) }.to raise_exception
77
+ end
78
+ end
79
+
72
80
  context 'With blank account credentials' do
73
81
  let!(:blank_account) { AlphaCard::Account.new(nil, '') }
74
82
  let!(:sale) { AlphaCard::Sale.new({ccexp: card_exp, ccnumber: '4111111111111111', amount: '5.00'}) }
@@ -1,6 +1,5 @@
1
- # Uncomment for coverage statistics
2
- # require 'simplecov'
3
- # SimpleCov.start
1
+ require 'coveralls'
2
+ Coveralls.wear!
4
3
 
5
4
  require 'bundler/setup'
6
5
  Bundler.setup
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.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikita Bulaj
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-25 00:00:00.000000000 Z
11
+ date: 2014-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -32,6 +32,7 @@ extra_rdoc_files: []
32
32
  files:
33
33
  - ".gitignore"
34
34
  - ".rspec"
35
+ - ".travis.yml"
35
36
  - Gemfile
36
37
  - LICENSE
37
38
  - README.md