alpha_card 0.2.0 → 0.2.1

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: 76fc164bc35261fa54520d3d411288fe4dac224e
4
- data.tar.gz: fa87d69a8a812fca096d22e394c82ea9ef4f31cb
3
+ metadata.gz: 69ecf71ff5367ce0a63a519ade5ba21a8cdce81c
4
+ data.tar.gz: 582d9831fa7344b5c52ca4b1c93b30044c27ff24
5
5
  SHA512:
6
- metadata.gz: 5e354992f043c879b4b6f12e931417dba4356b19ad757223b875f98d00f89a50d0281b514c0c0b20aa793727da396ba760d17ae05704849033ed9ef1c0ef1a4b
7
- data.tar.gz: c9533e52a55e8ab79b447c32e55e15fffe4e38064e9cd1850ddefb706c4fd3567ee8345aa2fff0d924dfa81842921674f8608fe18674078052970a89ae3dc04b
6
+ metadata.gz: b9fd3179c4edad7500d6d280a56ab61fcd125e39e1469618271d951b94a53a837a1b4f5cf101b4a4793c170c974fb208b86bd5800ee1b6f848977df3f85bf3da
7
+ data.tar.gz: 91ce299981bb899e15bab63279ae58a7ef3575a3b525160d790328d406a899af0c9601df3c2fc2484c5bfd0403ae9cf55fbecb8c69ba52e0ad2562fa752bdf39
data/README.md CHANGED
@@ -41,7 +41,8 @@ Dependencies required:
41
41
  * rest_client;
42
42
  * virtus (for nice OOP objects of AlphaCard).
43
43
 
44
- ## Objects
44
+
45
+ ## Alpha Card Objects
45
46
 
46
47
  Alpha Card sales operates with next 5 objects:
47
48
 
@@ -51,9 +52,11 @@ Alpha Card sales operates with next 5 objects:
51
52
  - Shipping
52
53
  * Sale
53
54
 
55
+ Let us consider each of them.
56
+
54
57
  ### Account
55
58
 
56
- Account represents credentials data to access Alpha Card Services, Inc.
59
+ Account represents credentials data to access Alpha Card Gateway.
57
60
  All sales will be created for the specified account.
58
61
 
59
62
  _Required fields_:
@@ -77,6 +80,7 @@ _Unnecessary fields_:
77
80
  * orderdescription : String
78
81
  * ponumber : String
79
82
  * tax : String
83
+ * ipaddress : String
80
84
  * billing : AlphaCard::Billing
81
85
  * shipping : AlphaCard::Shipping
82
86
 
@@ -95,6 +99,7 @@ _Unnecessary fields_:
95
99
  * firstname : String
96
100
  * lastname : String
97
101
  * email : String
102
+ * fax : String
98
103
  * phone : String
99
104
  * company : String
100
105
  * address1 : String
@@ -117,11 +122,15 @@ Specify Shipping information for Order.
117
122
 
118
123
  _Unnecessary fields_:
119
124
 
125
+ * firstname : String
126
+ * lastname : String
127
+ * company : String
120
128
  * address_1 : String
121
129
  * address_2 : String
122
130
  * city : String
123
131
  * state : String
124
132
  * zip_code : String
133
+ * country : String
125
134
  * email : String
126
135
 
127
136
  _Constructor_:
@@ -176,7 +185,8 @@ def create_payment
176
185
  order.billing = billing
177
186
  order.shipping = shipping
178
187
 
179
- sale = AlphaCard::Sale.new({ccexp: '0117', ccnumber: '4111111111111111', amount: "%.2f" % 1.5 , cvv: '123'})
188
+ # Format of amount: "XX.XX" ("%.2f" % Float)
189
+ sale = AlphaCard::Sale.new({ccexp: '0117', ccnumber: '4111111111111111', amount: "1.50", cvv: '123'})
180
190
  sale.create(order, account)
181
191
  rescue AlphaCard::AlphaCardError => e
182
192
  puts e.message
@@ -184,7 +194,7 @@ rescue AlphaCard::AlphaCardError => e
184
194
  end
185
195
  ```
186
196
 
187
- `Billing` and `shipping` is an _optional_ parameters and can be not specified.
197
+ `Billing` and `Shipping` is an _optional_ parameters and can be not specified.
188
198
 
189
199
  _Note_: take a look at the `amount` of the Order. It's format must be 'xx.xx'. All information about variables formats
190
200
  can be found on _Alpha Card Payment Gateway Integration Portal_ -> _Direct Post API_ -> _Documentation_ -> _Transaction Variables_
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'alpha_card'
3
- gem.version = '0.2.0'
4
- gem.date = '2014-07-09'
3
+ gem.version = '0.2.1'
4
+ gem.date = '2014-07-11'
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']
@@ -12,5 +12,8 @@ Gem::Specification.new do |gem|
12
12
  gem.license = 'MIT'
13
13
  gem.required_ruby_version = '>= 1.9.3'
14
14
 
15
+ gem.add_dependency 'virtus', '~> 1.0'
16
+ gem.add_dependency 'rest_client', '~> 1.7'
17
+
15
18
  gem.add_development_dependency "rspec", '~> 3'
16
19
  end
@@ -65,6 +65,18 @@ module AlphaCard
65
65
  # "responsetext"=>"SUCCESS", "authcode"=>"123", "transactionid"=>"123",
66
66
  # "avsresponse"=>"", "cvvresponse"=>"N", "orderid"=>"", "type"=>"",
67
67
  # "response_code"=>"100"}>
68
+ #
69
+ # account = AlphaCard::Account.new('demo', 'password')
70
+ # response = AlphaCard.request(
71
+ # {
72
+ # cexp: '0720',
73
+ # ccnumber: '123',
74
+ # amount: '10.00'
75
+ # },
76
+ # account
77
+ # )
78
+ #
79
+ # #=> AlphaCard::AlphaCardError: AlphaCard::AlphaCardError
68
80
  def self.request(params = {}, account)
69
81
  unless account.filled?
70
82
  raise AlphaCardError.new('You must set credentials to create the sale!')
@@ -14,6 +14,7 @@ module AlphaCard
14
14
  attribute :state, String
15
15
  attribute :zip, String
16
16
  attribute :country, String
17
+ attribute :fax, String
17
18
  attribute :website, String
18
19
  end
19
20
  end
@@ -2,14 +2,20 @@ module AlphaCard
2
2
  ##
3
3
  # Common class for Alpha Card Gateway errors and exceptions.
4
4
  class AlphaCardError < StandardError
5
+ # Alpha Card Gateway response.
6
+ # @attr_reader [AlphaCard::AlphaCardResponse] response
5
7
  attr_reader :response
8
+ # Error message.
9
+ # @attr_reader [String] message
6
10
  attr_reader :message
7
11
 
8
12
  ##
9
13
  # <code>AlphaCard::AlphaCardError</code> constructor.
10
14
  #
11
- # @param [String] error message
12
- # @param [AlphaCard::AlphaCardResponse] AlphaCard Gateway response
15
+ # @param [String] response
16
+ # Error message
17
+ # @param [AlphaCard::AlphaCardResponse] response
18
+ # AlphaCard Gateway response
13
19
  #
14
20
  # @example
15
21
  # AlphaCard::AlphaCardError.new
@@ -7,6 +7,7 @@ module AlphaCard
7
7
  attribute :orderdescription, String
8
8
  attribute :ponumber, String
9
9
  attribute :tax, String
10
+ attribute :ipaddress, String
10
11
 
11
12
  attribute :billing, AlphaCard::Billing
12
13
  attribute :shipping, AlphaCard::Shipping
@@ -3,11 +3,15 @@ module AlphaCard
3
3
  # Implementation of Alpha Card Services order shipping information.
4
4
  # Contains all the shipping information (address, city, zip, etc).
5
5
  class Shipping < AlphaCardObject
6
+ attribute :firstname, String
7
+ attribute :lastname, String
8
+ attribute :company, String
6
9
  attribute :address_1, String
7
10
  attribute :address_2, String
8
11
  attribute :city, String
9
12
  attribute :state, String
10
13
  attribute :zip_code, String
14
+ attribute :country, String
11
15
  attribute :email, String
12
16
  end
13
17
  end
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alpha_card
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
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-07-09 00:00:00.000000000 Z
11
+ date: 2014-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: virtus
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rest_client
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: rspec
15
43
  requirement: !ruby/object:Gem::Requirement