ipay 0.1.1 → 0.2.2

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.
data/README.md CHANGED
@@ -6,6 +6,13 @@ Ruby gem for interfacing with the iPay XML API
6
6
  Changelog
7
7
  ---------
8
8
 
9
+ **v0.2.0**
10
+
11
+ - Updated tests
12
+ - Included example certification file for CC/Wallet Services
13
+ - Added countries yaml for converting iso 3166 2 char country codes to iPay 3 char country code and currency codes
14
+ - Cleaned up some constants
15
+
9
16
  **v0.1.1**
10
17
 
11
18
  - Added certification mode
@@ -59,7 +66,7 @@ Usage
59
66
  :city => 'sometown',
60
67
  :state => 'NY',
61
68
  :postal_code => '90210',
62
- :country => IPay::Countries::USA
69
+ :country => IPay::Countries.country_code(:us)
63
70
  )
64
71
 
65
72
  if resp.success?
@@ -1,31 +1,67 @@
1
1
  #!/usr/bin/env ruby
2
- $:.unshift(File.join(File.dirname(__FILE__), 'lib'))
2
+ $:.unshift(File.join(File.dirname(__FILE__),'..', 'lib'))
3
3
 
4
4
  require 'ipay'
5
- require 'pp'
6
5
 
7
- CC_EXP = "#{Date.today.month.to_s.rjust(2,'0')}#{Date.today.year.to_s[2..-1]}"
8
-
9
- IPay::log = STDOUT
10
-
11
- IPay::config do |c|
6
+ IPay.log = STDOUT
7
+ IPay.config do |c|
12
8
  c.url = 'https://uap.txngw.com/'
13
9
  c.company_key = 6990
14
10
  c.terminal_id = 6177
15
11
  c.pin = 1234
12
+ c.verbose_respone = 1
16
13
  end
17
14
 
18
- IPay::Certification.capture do
15
+ cc = { :account_number => '4000009999999991', :cvv => 123, :expiration => "#{Date.today.month.to_s.rjust(2,'0')}#{Date.today.year.to_s[2..-1]}" }
16
+ address = { :first_name => 'nick', :last_name => 'wilson', :address => '123 fake st', :city => 'sometown', :state => 'NY', :postal_code => '90210', :country => IPay::Countries[:us][:country_code] }
17
+ wallet_acct = {:account => IPay::ACCOUNT_CC, :billing_transaction => IPay::BILLING_TXN_AVS }.merge(cc)
19
18
 
20
- resp = IPay::CC::Debit.sale(
21
- :amount => '4.99',
22
- :account_number => '4000009999999991', :cvv => 123, :expiration => CC_EXP,
23
- :first_name => 'nick', :last_name => 'wilson', :address => '123 fake st', :city => 'sometown', :state => 'NY', :postal_code => '90210', :country => IPay::Countries::USA
24
- )
25
-
26
- resp = IPay::CC::Debit.sale(
27
- :amount => '59.99',
28
- :account_number => '4000009999999991', :cvv => 123, :expiration => CC_EXP,
29
- :first_name => 'nick', :last_name => 'wilson', :address => '123 fake st', :city => 'sometown', :state => 'NY', :postal_code => '90210', :country => IPay::Countries::USA
30
- )
19
+ IPay::Certification.capture do
20
+
21
+ IPay::CC::Debit.auth({:amount => '0.99'}.merge(cc.merge address))
22
+ resp_auth = IPay::CC::Debit.auth({:amount => '4.99'}.merge(cc.merge address))
23
+ resp_sale = IPay::CC::Debit.sale({:amount => '4.99', :currency_code => IPay::Countries.currency_code(:eu), :currency_indicator => IPay::CUR_INDICATOR_MCP}.merge(cc.merge address))
24
+ resp_sale2 = IPay::CC::Debit.sale({:amount => '59.99'}.merge(cc.merge address))
25
+ resp_sale3 = IPay::CC::Debit.sale({:amount => '19.99'}.merge(cc.merge address))
26
+
27
+ # give the transactions a few seconds to process internally
28
+ sleep(5)
29
+
30
+ IPay::CC::Debit.void resp_auth.data[:transaction_id]
31
+ IPay::CC::Debit.void resp_sale.data[:transaction_id]
32
+
33
+ # these will fail with a 'Transaction Not Settled' as the test server does not process transactions until 3am
34
+ IPay::CC::Credit.refund({:transaction_id => resp_sale2.data[:transaction_id], :amount => '4.99', :currency_code => IPay::Countries.currency_code(:eu), :currency_indicator => IPay::CUR_INDICATOR_MCP}.merge(cc.merge address))
35
+ IPay::CC::Credit.refund({:transaction_id => resp_sale3.data[:transaction_id], :amount => '59.99'}.merge(cc.merge address))
36
+
37
+ resp_refund = IPay::CC::Credit.refund({:amount => '4.99', :currency_code => IPay::Countries.currency_code(:eu), :currency_indicator => IPay::CUR_INDICATOR_MCP}.merge(cc.merge address))
38
+ resp_refund2 = IPay::CC::Credit.refund({:amount => '59.99'}.merge(cc.merge address))
39
+
40
+ sleep(5)
41
+
42
+ IPay::CC::Credit.void resp_refund.data[:transaction_id]
43
+ IPay::CC::Credit.void resp_refund2.data[:transaction_id]
44
+
45
+ resp_wallet = IPay::Wallet::Client.insert(wallet_acct.merge address)
46
+ resp_wallet2 = IPay::Wallet::Client.insert(wallet_acct.merge address)
47
+
48
+ sleep(5)
49
+
50
+ IPay::Wallet::Client.modify( :client_id => resp_wallet.data[:client_id], :phone => '555-123-4567' )
51
+ IPay::Wallet::Client.modify( :client_id => resp_wallet2.data[:client_id], :member_number => '42' )
52
+
53
+ resp_acct = IPay::Wallet::Account.insert({:client_id => resp_wallet.data[:client_id]}.merge(wallet_acct.merge cc))
54
+ resp_acct2 = IPay::Wallet::Account.insert({:client_id => resp_wallet.data[:client_id]}.merge(wallet_acct.merge cc))
55
+
56
+ sleep(5)
57
+
58
+ IPay::Wallet::Account.modify( :account_id => resp_acct.data[:account_id], :account_number => '5100009999999997' )
59
+ IPay::Wallet::Account.modify( :account_id => resp_acct2.data[:account_id], :account_number => '5100009999999997' )
60
+
61
+ IPay::Wallet::Account.delete resp_acct.data[:account_id]
62
+ IPay::Wallet::Account.delete resp_acct2.data[:account_id]
63
+
64
+ IPay::Wallet::Client.delete resp_wallet.data[:client_id]
65
+ IPay::Wallet::Client.delete resp_wallet2.data[:client_id]
66
+
31
67
  end
@@ -4,39 +4,20 @@ module IPay
4
4
  CONFIG_NAME = 'ipay.yml'
5
5
  LOG_NAME = 'ipay.log'
6
6
 
7
- EM_SWIPED = 1
8
- EM_MANUAL_PRESENT = 2
9
- EM_MANUAL_NOT_PRESENT = 3
10
-
11
- GOODS_DIGITAL = 'D'
12
- GOODS_PHYSICAL = 'P'
13
-
14
- CUR_DOMESTIC = 0
15
- CUR_MCP = 1
16
- CUR_PYC = 2
17
-
18
- TXN_VIA_MAIL = 'M'
19
- TXN_VIA_POS = 'P'
20
- TXN_VIA_PHONE = 'T'
21
- TXN_VIA_RECUR = 2
22
- TXN_AUTHENTICATED = 5
23
- TXN_AUTH_FAILED = 6
24
- TXN_VIA_HTTPS = 7
25
-
26
7
  ApiError = Class.new(RuntimeError)
27
8
  RequestError = Class.new(ApiError)
28
9
  RequestTimeout = Class.new(RequestError)
29
10
  ResponseError = Class.new(ApiError)
30
11
 
31
-
32
12
  autoload :CC, 'ipay/cc'
33
13
  autoload :Wallet, 'ipay/wallet'
14
+ autoload :Currency, 'ipay/currency'
34
15
  autoload :Network, 'ipay/network'
35
16
 
36
17
  autoload :Certification, 'ipay/certification'
37
18
  end
38
19
 
39
20
  $:.unshift(File.dirname(__FILE__))
40
- %w[ version config log countries ].each do |file|
21
+ %w[ version constants config log ].each do |file|
41
22
  require "ipay/#{file}"
42
23
  end
@@ -1,7 +1,3 @@
1
- require 'net/https'
2
- require 'uri'
3
- require 'yaml'
4
-
5
1
  require 'ipay/xml_request'
6
2
  require 'ipay/response'
7
3
 
@@ -34,7 +30,7 @@ module IPay
34
30
 
35
31
  m = eval("#{self.service}")
36
32
  data = m::default_values(data) if m::respond_to?(:default_values)
37
-
33
+
38
34
  request = XmlRequest.new(data)
39
35
  Response.new request.send
40
36
  end
@@ -4,10 +4,11 @@ module IPay
4
4
  module CC
5
5
 
6
6
  def self.default_values(data)
7
- data[:currency_code] ||= 840 # USD
8
- data[:currency_indicator] ||= CUR_DOMESTIC
9
- data[:transaction_indicator] ||= TXN_VIA_HTTPS
10
- data
7
+ {
8
+ :currency_code => IPay::config.defaults[:currency_code],
9
+ :currency_indicator => IPay::config.defaults[:currency_indicator],
10
+ :transaction_indicator => IPay::config.defaults[:transaction_indicator]
11
+ }.merge(data)
11
12
  end
12
13
 
13
14
  class Credit < ApiRequest
@@ -18,6 +19,7 @@ module IPay
18
19
  end
19
20
 
20
21
  def self.void(data)
22
+ data = {:transaction_id => data} if data.is_a?(String) || data.is_a?(Fixnum)
21
23
  self.send_request(data)
22
24
  end
23
25
  end
@@ -41,6 +43,11 @@ module IPay
41
43
  end
42
44
 
43
45
  def self.void(data)
46
+ data = {:transaction_id => data} if data.is_a?(String) || data.is_a?(Fixnum)
47
+ self.send_request(data)
48
+ end
49
+
50
+ def self.reversal(data)
44
51
  self.send_request(data)
45
52
  end
46
53
  end
@@ -3,6 +3,12 @@ require 'ostruct'
3
3
 
4
4
  module IPay
5
5
 
6
+ DEFAULTS = {
7
+ :currency_code => IPay::Countries[:us][:currency_code],
8
+ :currency_indicator => CUR_INDICATOR_DOMESTIC,
9
+ :transaction_indicator => TXN_INDICATOR_HTTPS
10
+ }
11
+
6
12
  def self.config_file
7
13
  File.expand_path(File.join(ROOT, 'config', CONFIG_NAME))
8
14
  end
@@ -12,18 +18,18 @@ module IPay
12
18
 
13
19
  if File.readable?(path)
14
20
  IPay::log.debug "Using configuration file '#{path}'"
15
- @config = OpenStruct.new(YAML.load_file(path)) unless @config
21
+ config = OpenStruct.new(YAML.load_file(path)) unless config
16
22
  else
17
- @config = OpenStruct.new
18
- IPay::log.warn "Failed to locate configuration file '#{CONFIG_NAME}', place in 'config/'"
23
+ config = OpenStruct.new
19
24
  end
20
25
 
21
- set_defaults(@config)
26
+ set_defaults(config)
22
27
  end
23
28
 
24
29
  def self.set_defaults(config)
25
30
  config.dry_run ||= false
26
31
  config.certification ||= false
32
+ config.defaults = DEFAULTS.merge(config.defaults || {}) # yaml config has higher priority
27
33
  config
28
34
  end
29
35
 
@@ -0,0 +1,51 @@
1
+ require 'yaml'
2
+
3
+ module IPay
4
+
5
+ module Countries
6
+ @@countries = YAML.load_file(File.join(File.dirname(__FILE__), 'countries.yml'))
7
+ def self.[](key)
8
+ key = key.to_s.downcase.to_sym
9
+ @@countries[key]
10
+ end
11
+
12
+ def self.currency_code(key)
13
+ @@countries[key][:currency_code] rescue nil
14
+ end
15
+
16
+ def self.country_code(key)
17
+ @@countries[key][:country_code] rescue nil
18
+ end
19
+ end
20
+
21
+ EM_SWIPED = 1
22
+ EM_MANUAL_PRESENT = 2
23
+ EM_MANUAL_NOT_PRESENT = 3
24
+
25
+ GOODS_DIGITAL = 'D'
26
+ GOODS_PHYSICAL = 'P'
27
+
28
+ CUR_INDICATOR_DOMESTIC = 0
29
+ CUR_INDICATOR_MCP = 1
30
+ CUR_INDICATOR_PYC = 2
31
+
32
+ TXN_INDICATOR_MAIL = 'M'
33
+ TXN_INDICATOR_POS = 'P'
34
+ TXN_INDICATOR_PHONE = 'T'
35
+ TXN_INDICATOR_RECUR = 2
36
+ TXN_INDICATOR_AUTH = 5
37
+ TXN_INDICATOR_AUTH_FAILED = 6
38
+ TXN_INDICATOR_HTTPS = 7
39
+
40
+ BILLING_TXN_AUTH = 0
41
+ BILLING_TXN_SALE = 1
42
+ BILLING_TXN_AVS = 2
43
+ BILLING_TXN_ACH_VALIDATION = 3
44
+
45
+ ACCOUNT_CC = 'CC'
46
+ ACCOUNT_ACH = 'ACH'
47
+
48
+ QUERY_TYPE_TXN = 0
49
+ QUERY_TYPE_GROUP = 1
50
+
51
+ end
@@ -0,0 +1,19 @@
1
+ :us:
2
+ :name: US Dollar
3
+ :country_code: USD
4
+ :currency_code: 840
5
+
6
+ :eu:
7
+ :name: Euro
8
+ :country_code: EUR
9
+ :currency_code: 978
10
+
11
+ :ru:
12
+ :name: Russian Ruble
13
+ :country_code: RUB
14
+ :currency_code: 643
15
+
16
+ :ca:
17
+ :name: Canadian Dollar
18
+ :country_code: CAD
19
+ :currency_code: 124
@@ -0,0 +1,22 @@
1
+ require 'ipay/api_request'
2
+
3
+ module IPay
4
+ module Currency
5
+ def self.default_values(data)
6
+ {
7
+ :currency_code => IPay::config.defaults[:currency_code],
8
+ :currency_indicator => IPay::config.defaults[:currency_indicator],
9
+ :query_type => QUERY_TYPE_GROUP
10
+ }.merge(data)
11
+ end
12
+
13
+ class Rate < ApiRequest
14
+ self.service_format = '0000'
15
+
16
+ def self.query(data = {})
17
+ self.send_request(data)
18
+ end
19
+ end
20
+
21
+ end
22
+ end
@@ -29,7 +29,9 @@ module IPay
29
29
  private
30
30
 
31
31
  def parse_response(xml)
32
- IPay::log.debug 'Parsing response xml...'
32
+ IPay.log.debug 'Parsing response xml...'
33
+ IPay.log.debug xml
34
+
33
35
  parser = XML::Parser.string xml
34
36
  parser.context.options = PARSER_OPT
35
37
  parsed = parser.parse
@@ -38,10 +40,12 @@ module IPay
38
40
 
39
41
  response = xml_node_to_hash(parsed.find('//RESPONSE/RESPONSE/FIELDS')[0])
40
42
  raise ResponseError.new 'Invalid response from server' unless response and response.include? :arc
41
-
42
- d = response.delete(:local_date).match(/([0-9]{2})([0-9]{2})([0-9]{4})/)
43
- t = response.delete(:local_time).match(/([0-9]{2})([0-9]{2})([0-9]{2})/)
44
-
43
+
44
+ if response.include?(:local_date)
45
+ d = response.delete(:local_date).match(/([0-9]{2})([0-9]{2})([0-9]{4})/)
46
+ t = response.delete(:local_time).match(/([0-9]{2})([0-9]{2})([0-9]{2})/)
47
+ end
48
+
45
49
  @server_time = DateTime.parse("#{d[3]}-#{d[1]}-#{d[2]}T#{t[1]}:#{t[2]}:#{t[3]}") rescue DateTime.now
46
50
  @status = { :arc => response.delete(:arc), :mrc => response.delete(:mrc), :description => response.delete(:response_text) }
47
51
  @data = response
@@ -1,3 +1,3 @@
1
1
  module IPay
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.2'
3
3
  end
@@ -2,10 +2,11 @@ require 'ipay/api_request'
2
2
 
3
3
  module IPay
4
4
  module Wallet
5
-
5
+
6
6
  def self.default_values(data)
7
- data[:transaction_indicator] ||= TXN_VIA_HTTPS
8
- data
7
+ {
8
+ :transaction_indicator => IPay::config.defaults[:transaction_indicator]
9
+ }.merge(data)
9
10
  end
10
11
 
11
12
  class Client < ApiRequest
@@ -20,6 +21,7 @@ module IPay
20
21
  end
21
22
 
22
23
  def self.delete(data)
24
+ data = {:client_id => data} if data.is_a?(String) || data.is_a?(Fixnum)
23
25
  self.send_request(data)
24
26
  end
25
27
  end
@@ -36,6 +38,7 @@ module IPay
36
38
  end
37
39
 
38
40
  def self.delete(data)
41
+ data = {:account_id => data} if data.is_a?(String) || data.is_a?(Fixnum)
39
42
  self.send_request(data)
40
43
  end
41
44
  end
@@ -26,6 +26,7 @@ module IPay
26
26
  end
27
27
 
28
28
  def send
29
+ raise RequestError.new('No iPay API url was specified in your configuration') unless IPay::config.url
29
30
  do_post(IPay::config.url, @xml)
30
31
  end
31
32
 
@@ -58,6 +59,7 @@ module IPay
58
59
  end
59
60
 
60
61
  def build_xml(fields_xml)
62
+ raise RequestError.new('No iPay API company_key was specified in your configuration') unless IPay::config.company_key
61
63
  "<REQUEST KEY=\"#{IPay::config.company_key}\" PROTOCOL=\"1\" FMT=\"1\" ENCODING=\"0\">
62
64
  <TRANSACTION>
63
65
  <FIELDS>#{fields_xml}</FIELDS>
@@ -15,14 +15,14 @@ class TestCC < Test::Unit::TestCase
15
15
  :city => 'sometown',
16
16
  :state => 'NY',
17
17
  :postal_code => '90210',
18
- :country => IPay::Countries::USA
18
+ :country => IPay::Countries.country_code(:us)
19
19
  )
20
20
 
21
21
  assert resp.success?
22
22
  assert resp.data.include?(:transaction_id)
23
23
  end
24
-
25
- test 'debit capture and auth' do
24
+
25
+ test 'debit auth' do
26
26
  resp = IPay::CC::Debit.auth(
27
27
  :amount => '4.99',
28
28
  :account_number => '4000009999999991',
@@ -33,8 +33,27 @@ class TestCC < Test::Unit::TestCase
33
33
  :address => '123 fake st',
34
34
  :city => 'sometown',
35
35
  :state => 'NY',
36
- :postal_code => '90210',
37
- :country => IPay::Countries::USA
36
+ :postal_code => '90210',
37
+ :country => IPay::Countries.country_code(:us)
38
+ )
39
+
40
+ assert resp.success?
41
+ assert resp.data.include?(:transaction_id)
42
+ end
43
+
44
+ test 'debit reversal' do
45
+ resp = IPay::CC::Debit.auth(
46
+ :amount => '4.99',
47
+ :account_number => '4000009999999991',
48
+ :cvv => 123,
49
+ :expiration => CC_EXP,
50
+ :first_name => 'nick',
51
+ :last_name => 'wilson',
52
+ :address => '123 fake st',
53
+ :city => 'sometown',
54
+ :state => 'NY',
55
+ :postal_code => '90210',
56
+ :country => IPay::Countries.country_code(:us)
38
57
  )
39
58
 
40
59
  assert resp.success?
@@ -42,8 +61,36 @@ class TestCC < Test::Unit::TestCase
42
61
 
43
62
  sleep(3)
44
63
 
45
- resp = IPay::CC::Debit.capture(
64
+ resp = IPay::CC::Debit.reversal(
65
+ :amount => resp.data[:amount],
66
+ :transaction_id => resp.data[:transaction_id]
67
+ )
68
+
69
+ assert resp.success?
70
+ end
71
+
72
+ test 'debit capture' do
73
+ resp = IPay::CC::Debit.auth(
46
74
  :amount => '4.99',
75
+ :account_number => '4000009999999991',
76
+ :cvv => 123,
77
+ :expiration => CC_EXP,
78
+ :first_name => 'nick',
79
+ :last_name => 'wilson',
80
+ :address => '123 fake st',
81
+ :city => 'sometown',
82
+ :state => 'NY',
83
+ :postal_code => '90210',
84
+ :country => IPay::Countries.country_code(:us)
85
+ )
86
+
87
+ assert resp.success?
88
+ assert resp.data.include?(:transaction_id)
89
+
90
+ sleep(3)
91
+
92
+ resp = IPay::CC::Debit.capture(
93
+ :amount => resp.data[:amount],
47
94
  :transaction_id => resp.data[:transaction_id]
48
95
  )
49
96
 
@@ -61,8 +108,8 @@ class TestCC < Test::Unit::TestCase
61
108
  :address => '123 fake st',
62
109
  :city => 'sometown',
63
110
  :state => 'NY',
64
- :postal_code => '90210',
65
- :country => IPay::Countries::USA
111
+ :postal_code => '90210',
112
+ :country => IPay::Countries.country_code(:us)
66
113
  )
67
114
 
68
115
  assert resp.success?
@@ -70,9 +117,7 @@ class TestCC < Test::Unit::TestCase
70
117
 
71
118
  sleep(3)
72
119
 
73
- resp = IPay::CC::Debit.void(
74
- :transaction_id => resp.data[:transaction_id]
75
- )
120
+ resp = IPay::CC::Debit.void resp.data[:transaction_id]
76
121
 
77
122
  assert resp.success?
78
123
  end
@@ -88,8 +133,8 @@ class TestCC < Test::Unit::TestCase
88
133
  :address => '123 fake st',
89
134
  :city => 'sometown',
90
135
  :state => 'NY',
91
- :postal_code => '90210',
92
- :country => IPay::Countries::USA
136
+ :postal_code => '90210',
137
+ :country => IPay::Countries.country_code(:us)
93
138
  )
94
139
 
95
140
  assert resp.success?
@@ -107,8 +152,8 @@ class TestCC < Test::Unit::TestCase
107
152
  :address => '123 fake st',
108
153
  :city => 'sometown',
109
154
  :state => 'NY',
110
- :postal_code => '90210',
111
- :country => IPay::Countries::USA
155
+ :postal_code => '90210',
156
+ :country => IPay::Countries.country_code(:us)
112
157
  )
113
158
 
114
159
  assert resp.success?
@@ -116,9 +161,7 @@ class TestCC < Test::Unit::TestCase
116
161
 
117
162
  sleep(3)
118
163
 
119
- resp = IPay::CC::Credit.void(
120
- :transaction_id => resp.data[:transaction_id]
121
- )
164
+ resp = IPay::CC::Credit.void resp.data[:transaction_id]
122
165
 
123
166
  assert resp.success?
124
167
  end
@@ -16,7 +16,7 @@ class TestErrors < Test::Unit::TestCase
16
16
  :city => 'sometown',
17
17
  :state => 'NY',
18
18
  :postal_code => '90210',
19
- :country => IPay::Countries::USA
19
+ :country => IPay::Countries.country_code(:us)
20
20
  )
21
21
 
22
22
  assert resp.error?
@@ -38,7 +38,7 @@ class TestErrors < Test::Unit::TestCase
38
38
  :city => 'sometown',
39
39
  :state => 'NY',
40
40
  :postal_code => '90210',
41
- :country => IPay::Countries::USA
41
+ :country => IPay::Countries.country_code(:us)
42
42
  )
43
43
  end
44
44
 
@@ -16,7 +16,7 @@ class TestWallet < Test::Unit::TestCase
16
16
  :city => 'sometown',
17
17
  :state => 'NY',
18
18
  :postal_code => '90210',
19
- :country => IPay::Countries::USA
19
+ :country => IPay::Countries.country_code(:us)
20
20
  )
21
21
 
22
22
  assert resp.success?
@@ -38,7 +38,7 @@ class TestWallet < Test::Unit::TestCase
38
38
  :city => 'sometown',
39
39
  :state => 'NY',
40
40
  :postal_code => '90210',
41
- :country => IPay::Countries::USA
41
+ :country => IPay::Countries.country_code(:us)
42
42
  )
43
43
 
44
44
  assert resp.success?
@@ -69,7 +69,7 @@ class TestWallet < Test::Unit::TestCase
69
69
  :city => 'sometown',
70
70
  :state => 'NY',
71
71
  :postal_code => '90210',
72
- :country => IPay::Countries::USA
72
+ :country => IPay::Countries.country_code(:us)
73
73
  )
74
74
 
75
75
  assert resp.success?
@@ -78,9 +78,7 @@ class TestWallet < Test::Unit::TestCase
78
78
 
79
79
  sleep(3)
80
80
 
81
- resp = IPay::Wallet::Client.delete(
82
- :client_id => resp.data[:client_id]
83
- )
81
+ resp = IPay::Wallet::Client.delete resp.data[:client_id]
84
82
 
85
83
  assert resp.success?
86
84
  assert resp.data.include?(:transaction_id)
@@ -100,7 +98,7 @@ class TestWallet < Test::Unit::TestCase
100
98
  :city => 'sometown',
101
99
  :state => 'NY',
102
100
  :postal_code => '90210',
103
- :country => IPay::Countries::USA
101
+ :country => IPay::Countries.country_code(:us)
104
102
  )
105
103
 
106
104
  assert resp.success?
@@ -134,7 +132,7 @@ class TestWallet < Test::Unit::TestCase
134
132
  :city => 'sometown',
135
133
  :state => 'NY',
136
134
  :postal_code => '90210',
137
- :country => IPay::Countries::USA
135
+ :country => IPay::Countries.country_code(:us)
138
136
  )
139
137
 
140
138
  assert resp.success?
@@ -168,7 +166,7 @@ class TestWallet < Test::Unit::TestCase
168
166
  :city => 'sometown',
169
167
  :state => 'NY',
170
168
  :postal_code => '90210',
171
- :country => IPay::Countries::USA
169
+ :country => IPay::Countries.country_code(:us)
172
170
  )
173
171
 
174
172
  assert resp.success?
@@ -190,9 +188,8 @@ class TestWallet < Test::Unit::TestCase
190
188
 
191
189
  sleep(3)
192
190
 
193
- resp = IPay::Wallet::Account.delete(
194
- :account_id => resp.data[:account_id]
195
- )
191
+ resp = IPay::Wallet::Account.delete resp.data[:account_id]
192
+
196
193
  assert resp.success?
197
194
  assert resp.data.include?(:transaction_id)
198
195
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ipay
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.1
5
+ version: 0.2.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Nick Wilson
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-16 00:00:00 -04:00
13
+ date: 2011-05-19 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -38,7 +38,9 @@ files:
38
38
  - lib/ipay/cc.rb
39
39
  - lib/ipay/certification.rb
40
40
  - lib/ipay/config.rb
41
- - lib/ipay/countries.rb
41
+ - lib/ipay/constants.rb
42
+ - lib/ipay/countries.yml
43
+ - lib/ipay/currency.rb
42
44
  - lib/ipay/log.rb
43
45
  - lib/ipay/network.rb
44
46
  - lib/ipay/response.rb
@@ -1,7 +0,0 @@
1
- module IPay
2
- module Countries
3
-
4
- USA = 826
5
-
6
- end
7
- end