ruby_psigate 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,4 @@
1
+ v0.7.3. fixed bugs related to account information (address, name) not being passed through to server
1
2
  v0.7.2. updated project's dependency file
2
3
  v0.7.1. project's website points to github's repository instead
3
4
  v0.7. project semi functional. most things to should, but a lot of rough edges.
@@ -50,10 +50,6 @@ module RubyPsigate
50
50
  result = "#{result_first}_#{result_second}".downcase.to_sym
51
51
  end
52
52
 
53
- # include RubyPsigate::HashVariables
54
- # hashable :account_register, %w( AccountID )
55
- # hashable :account_update, %w( Condition Update )
56
-
57
53
  attr_writer :action
58
54
  attr_reader :address, :rbcharge
59
55
  attr_accessor :account_id, :comments, :email, :serial_no, :store_id
@@ -77,8 +73,9 @@ module RubyPsigate
77
73
 
78
74
  if type == :account_register
79
75
  result[:Account] = Hash.new
76
+ result[:Account].merge!(:Email => email) unless email.nil?
80
77
  result[:Account].merge!({:AccountID => nil})
81
- result[:Account].merge!(address.to_hash(:billing)) unless address.nil?
78
+ result[:Account].merge!(address.to_hash(:account)) unless address.nil?
82
79
  result[:Account].merge!({ :CardInfo => cc.to_hash(:card_info) })
83
80
  end
84
81
 
@@ -134,10 +131,6 @@ module RubyPsigate
134
131
  { :AccountID => "123" }
135
132
  end
136
133
 
137
- def update
138
- { :Shit => "Fuck" }
139
- end
140
-
141
134
  def address=(input_address)
142
135
  raise InvalidAddress unless input_address.is_a?(Address)
143
136
  @address = input_address
@@ -6,6 +6,7 @@ module RubyPsigate
6
6
 
7
7
  hashable :billing, %w( Bname Bcompany Baddress1 Baddress2 Bcity Bprovince Bpostalcode Bcountry Phone Fax )
8
8
  hashable :shipping, %w( Sname Scompany Saddress1 Saddress2 Scity Sprovince Spostalcode Scountry )
9
+ hashable :account, %w( Name Company Address1 Address2 City Province PostalCode Country Phone Fax )
9
10
 
10
11
  attr_accessor :firstname, :lastname, :line1, :line2, :city, :state, :country, :zipcode, :telephone, :fax, :company
11
12
 
data/ruby_psigate.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{ruby_psigate}
5
- s.version = "0.7.2"
5
+ s.version = "0.7.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Simon Chiu"]
9
- s.date = %q{2010-09-21}
9
+ s.date = %q{2010-09-26}
10
10
  s.description = %q{RubyPsigate parses and packages XML messages to/from Psigate's servers for transactions and recurring billing management.}
11
11
  s.email = %q{skhchiu@gmail.com}
12
12
  s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README.markdown", "lib/certs/cacert.pem", "lib/ruby_psigate.rb", "lib/ruby_psigate/account.rb", "lib/ruby_psigate/account_manager_api.rb", "lib/ruby_psigate/account_methods.rb", "lib/ruby_psigate/address.rb", "lib/ruby_psigate/connection.rb", "lib/ruby_psigate/credit_card.rb", "lib/ruby_psigate/credit_card_methods.rb", "lib/ruby_psigate/error.rb", "lib/ruby_psigate/gateway.rb", "lib/ruby_psigate/hash_variables.rb", "lib/ruby_psigate/item.rb", "lib/ruby_psigate/item_option.rb", "lib/ruby_psigate/number_validation_methods.rb", "lib/ruby_psigate/order.rb", "lib/ruby_psigate/recurring_charge.rb", "lib/ruby_psigate/recurring_item.rb", "lib/ruby_psigate/response.rb", "lib/ruby_psigate/serializer.rb", "lib/ruby_psigate/transaction_methods.rb", "lib/ruby_psigate/utils.rb"]
@@ -21,7 +21,7 @@ module RubyPsigate
21
21
 
22
22
  @account.email = "bob@gmail.com"
23
23
  @account.cc = @credit_card
24
- # @account.address = valid_address
24
+ @account.address = valid_address
25
25
 
26
26
  @gateway.account = @account
27
27
 
data/test/test_helper.rb CHANGED
@@ -45,19 +45,20 @@ module RubyPsigate
45
45
  @address
46
46
  end
47
47
 
48
- def valid_address_hash
49
- {
50
- :Bname => "Bob Parsons",
51
- :Bcompany => "Bob Parson's Co.",
52
- :Baddress1 => "1234 West Street",
53
- :Baddress2 => "Apt 100",
54
- :Bcity => "Toronto",
55
- :Bprovince => "Ontario",
56
- :Bcountry => "CA",
57
- :Bpostalcode => "L3N9J2",
58
- :Phone => "416-333-3333",
59
- :Fax => "416-322-2222"
60
- }
48
+ def valid_address_hash(type = :billing)
49
+ # {
50
+ # :Bname => "Bob Parsons",
51
+ # :Bcompany => "Bob Parson's Co.",
52
+ # :Baddress1 => "1234 West Street",
53
+ # :Baddress2 => "Apt 100",
54
+ # :Bcity => "Toronto",
55
+ # :Bprovince => "Ontario",
56
+ # :Bcountry => "CA",
57
+ # :Bpostalcode => "L3N9J2",
58
+ # :Phone => "416-333-3333",
59
+ # :Fax => "416-322-2222"
60
+ # }
61
+ valid_address.to_hash(type)
61
62
  end
62
63
 
63
64
  def valid_credit_card
@@ -95,7 +95,7 @@ module RubyPsigate
95
95
  :AccountID => nil
96
96
  }
97
97
  }
98
- @expectation[:Account].merge!(valid_address_hash)
98
+ @expectation[:Account].merge!(valid_address_hash(:account))
99
99
  @expectation[:Account][:CardInfo] = valid_credit_card_hash(:card_info)
100
100
 
101
101
  @account.action = { :account => :register }
@@ -95,5 +95,23 @@ module RubyPsigate
95
95
  assert_equal @expectation, @address.to_hash(:shipping)
96
96
  end
97
97
 
98
+ should "return a hash of account address attributes (for recurring xml transactions)" do
99
+ @address = valid_address
100
+ @expectation = {
101
+ :Name => "Bob Parsons",
102
+ :Company => "Bob Parson's Co.",
103
+ :Address1 => "1234 West Street",
104
+ :Address2 => "Apt 100",
105
+ :City => "Toronto",
106
+ :Province => "Ontario",
107
+ :PostalCode => "L3N9J2",
108
+ :Country => "CA",
109
+ :Phone => "416-333-3333",
110
+ :Fax => "416-322-2222"
111
+ }
112
+
113
+ assert_equal @expectation, @address.to_hash(:account)
114
+ end
115
+
98
116
  end
99
117
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 7
8
- - 2
9
- version: 0.7.2
8
+ - 3
9
+ version: 0.7.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Simon Chiu
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-09-21 00:00:00 -04:00
17
+ date: 2010-09-26 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency