pg_recurrence 0.1.0 → 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.
- data/VERSION +1 -1
- data/lib/ruby_psigate/account.rb +51 -0
- data/pg_recurrence.gemspec +93 -0
- data/test/remote/test_account_remote.rb +16 -1
- metadata +5 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/ruby_psigate/account.rb
CHANGED
@@ -92,6 +92,53 @@ module RubyPsigate
|
|
92
92
|
result
|
93
93
|
end
|
94
94
|
|
95
|
+
# Add/Delete/Enable/Disable payment method returns the serial no (of the payment method) if successful, else false
|
96
|
+
def add_payment_method(credit_card)
|
97
|
+
begin
|
98
|
+
# Action
|
99
|
+
action = "AMA11"
|
100
|
+
@request[:Request][:Action] = action
|
101
|
+
|
102
|
+
@request[:Request][:Account] = {
|
103
|
+
:AccountID => accountid,
|
104
|
+
:CardInfo => {}
|
105
|
+
}
|
106
|
+
|
107
|
+
%w( CardHolder CardNumber CardExpMonth CardExpYear ).each do |c|
|
108
|
+
value = credit_card.send((c.downcase).to_sym)
|
109
|
+
@request[:Request][:Account][:CardInfo][c.to_sym] = value if value
|
110
|
+
end
|
111
|
+
|
112
|
+
# Creates parameters
|
113
|
+
params = RubyPsigate::Serializer.new(@request, :header => true).to_xml
|
114
|
+
connection = RubyPsigate::Connection.new(self.class.credential.endpoint)
|
115
|
+
response = connection.post(params)
|
116
|
+
response = Response.new(response)
|
117
|
+
self.response = response
|
118
|
+
|
119
|
+
if response.success? && response.returncode == "RPA-0015"
|
120
|
+
result = response.serialno
|
121
|
+
else
|
122
|
+
result = false
|
123
|
+
end
|
124
|
+
rescue ConnectionError => e
|
125
|
+
result = false
|
126
|
+
end
|
127
|
+
result
|
128
|
+
end
|
129
|
+
|
130
|
+
def delete_payment_method
|
131
|
+
|
132
|
+
end
|
133
|
+
|
134
|
+
def enable_payment_method
|
135
|
+
|
136
|
+
end
|
137
|
+
|
138
|
+
def disable_payment_method
|
139
|
+
|
140
|
+
end
|
141
|
+
|
95
142
|
def self.find(accountid)
|
96
143
|
begin
|
97
144
|
params = {
|
@@ -174,5 +221,9 @@ module RubyPsigate
|
|
174
221
|
response
|
175
222
|
end
|
176
223
|
|
224
|
+
def toggle_payment_method(creditcard)
|
225
|
+
|
226
|
+
end
|
227
|
+
|
177
228
|
end
|
178
229
|
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{pg_recurrence}
|
8
|
+
s.version = "0.1.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Simon Chiu"]
|
12
|
+
s.date = %q{2011-01-03}
|
13
|
+
s.description = %q{Unofficial Psigate recurring billing library for Ruby}
|
14
|
+
s.email = %q{skhchiu@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"Gemfile",
|
22
|
+
"Gemfile.lock",
|
23
|
+
"LICENSE.txt",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"lib/pg_recurrence.rb",
|
28
|
+
"lib/ruby_psigate/account.rb",
|
29
|
+
"lib/ruby_psigate/charge.rb",
|
30
|
+
"lib/ruby_psigate/credential.rb",
|
31
|
+
"lib/ruby_psigate/request.rb",
|
32
|
+
"lib/ruby_psigate/response.rb",
|
33
|
+
"pg_recurrence.gemspec",
|
34
|
+
"test/helper.rb",
|
35
|
+
"test/remote/test_account_remote.rb",
|
36
|
+
"test/remote/test_charge_remote.rb",
|
37
|
+
"test/remote/test_request_remote.rb",
|
38
|
+
"test/unit/test_account.rb",
|
39
|
+
"test/unit/test_charge.rb",
|
40
|
+
"test/unit/test_request.rb",
|
41
|
+
"test/unit/test_response.rb"
|
42
|
+
]
|
43
|
+
s.homepage = %q{http://github.com/drchiu/pg_recurrence}
|
44
|
+
s.licenses = ["MIT"]
|
45
|
+
s.require_paths = ["lib"]
|
46
|
+
s.rubygems_version = %q{1.3.7}
|
47
|
+
s.summary = %q{Unofficial Psigate recurring billing library for Ruby}
|
48
|
+
s.test_files = [
|
49
|
+
"test/helper.rb",
|
50
|
+
"test/remote/test_account_remote.rb",
|
51
|
+
"test/remote/test_charge_remote.rb",
|
52
|
+
"test/remote/test_request_remote.rb",
|
53
|
+
"test/unit/test_account.rb",
|
54
|
+
"test/unit/test_charge.rb",
|
55
|
+
"test/unit/test_request.rb",
|
56
|
+
"test/unit/test_response.rb"
|
57
|
+
]
|
58
|
+
|
59
|
+
if s.respond_to? :specification_version then
|
60
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
61
|
+
s.specification_version = 3
|
62
|
+
|
63
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
64
|
+
s.add_runtime_dependency(%q<crack>, [">= 0"])
|
65
|
+
s.add_runtime_dependency(%q<pg_serializer>, [">= 0"])
|
66
|
+
s.add_runtime_dependency(%q<pg_connection>, [">= 0"])
|
67
|
+
s.add_runtime_dependency(%q<pg_creditcard>, [">= 0"])
|
68
|
+
s.add_runtime_dependency(%q<mocha>, [">= 0"])
|
69
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
70
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
|
71
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
72
|
+
else
|
73
|
+
s.add_dependency(%q<crack>, [">= 0"])
|
74
|
+
s.add_dependency(%q<pg_serializer>, [">= 0"])
|
75
|
+
s.add_dependency(%q<pg_connection>, [">= 0"])
|
76
|
+
s.add_dependency(%q<pg_creditcard>, [">= 0"])
|
77
|
+
s.add_dependency(%q<mocha>, [">= 0"])
|
78
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
79
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
80
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
81
|
+
end
|
82
|
+
else
|
83
|
+
s.add_dependency(%q<crack>, [">= 0"])
|
84
|
+
s.add_dependency(%q<pg_serializer>, [">= 0"])
|
85
|
+
s.add_dependency(%q<pg_connection>, [">= 0"])
|
86
|
+
s.add_dependency(%q<pg_creditcard>, [">= 0"])
|
87
|
+
s.add_dependency(%q<mocha>, [">= 0"])
|
88
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
89
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
90
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
@@ -98,7 +98,22 @@ module RubyPsigate
|
|
98
98
|
:comments => "Some comment"
|
99
99
|
}
|
100
100
|
assert @account.save
|
101
|
-
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_has_method_called_add_payment_method_after_find
|
104
|
+
@account = Account.find(@comparison.accountid)
|
105
|
+
assert @account.respond_to?(:add_payment_method)
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_add_payment_method
|
109
|
+
@account = @comparison
|
110
|
+
@serial_no = @account.add_payment_method(credit_card)
|
111
|
+
assert_not_nil @serial_no
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_remove_payment_method
|
115
|
+
@account = @comparison
|
116
|
+
end
|
102
117
|
|
103
118
|
end
|
104
119
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
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:
|
17
|
+
date: 2011-01-03 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -148,6 +148,7 @@ files:
|
|
148
148
|
- lib/ruby_psigate/credential.rb
|
149
149
|
- lib/ruby_psigate/request.rb
|
150
150
|
- lib/ruby_psigate/response.rb
|
151
|
+
- pg_recurrence.gemspec
|
151
152
|
- test/helper.rb
|
152
153
|
- test/remote/test_account_remote.rb
|
153
154
|
- test/remote/test_charge_remote.rb
|
@@ -170,7 +171,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
170
171
|
requirements:
|
171
172
|
- - ">="
|
172
173
|
- !ruby/object:Gem::Version
|
173
|
-
hash: -
|
174
|
+
hash: -3875547672325157057
|
174
175
|
segments:
|
175
176
|
- 0
|
176
177
|
version: "0"
|