global_collect 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY CHANGED
@@ -1,3 +1,7 @@
1
+ v0.2.1 (2010-06-09)
2
+ ===================
3
+ * add Paypal as payment option
4
+
1
5
  v0.2.0 (2010-06-07)
2
6
  ===================
3
7
  * add reporting log parsing
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -2,7 +2,8 @@ require 'rubygems'
2
2
  require File.join(File.dirname(__FILE__), '..', "lib", "global_collect")
3
3
  require 'pp'
4
4
 
5
- path = "something.asc"
5
+ path = "/Users/tkarnezos/Desktop/GC/ftp_backup/FS53930155TOPSPINMEDIA.asc"
6
6
  report = GlobalCollect::LogParsing::FinancialStatement::ReportFile.new(path)
7
7
  report.parse
8
- pp report.data
8
+ require 'ap'
9
+ ap report.data
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{global_collect}
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Timon Karnezos"]
12
- s.date = %q{2010-06-08}
12
+ s.date = %q{2010-06-09}
13
13
  s.description = %q{Gives minimally intrusive access to Global Collect's payment processing API.
14
14
  Currently implements a very small segment of the full API but is built with
15
15
  extensibility in mind.
@@ -60,6 +60,7 @@ extensibility in mind.
60
60
  "lib/global_collect/request_models/base.rb",
61
61
  "lib/global_collect/request_models/do_refund/credit_card_payment.rb",
62
62
  "lib/global_collect/request_models/do_refund/payment.rb",
63
+ "lib/global_collect/request_models/do_refund/paypal_payment.rb",
63
64
  "lib/global_collect/request_models/insert_order_with_payment/credit_card_online_payment.rb",
64
65
  "lib/global_collect/request_models/insert_order_with_payment/hosted_credit_card_online_payment.rb",
65
66
  "lib/global_collect/request_models/insert_order_with_payment/order.rb",
@@ -104,6 +105,7 @@ extensibility in mind.
104
105
  "spec/log_parsing/payment_report/parser_spec.rb",
105
106
  "spec/log_parsing/payment_report/report_file_spec.rb",
106
107
  "spec/request_models/base_spec.rb",
108
+ "spec/request_models/do_refund/paypal_payment_spec.rb",
107
109
  "spec/request_models/insert_order_with_payment/credit_card_online_payment_spec.rb",
108
110
  "spec/request_models/insert_order_with_payment/hosted_credit_card_online_payment_spec.rb",
109
111
  "spec/requests/base_spec.rb",
@@ -163,6 +165,7 @@ extensibility in mind.
163
165
  "spec/log_parsing/payment_report/parser_spec.rb",
164
166
  "spec/log_parsing/payment_report/report_file_spec.rb",
165
167
  "spec/request_models/base_spec.rb",
168
+ "spec/request_models/do_refund/paypal_payment_spec.rb",
166
169
  "spec/request_models/insert_order_with_payment/credit_card_online_payment_spec.rb",
167
170
  "spec/request_models/insert_order_with_payment/hosted_credit_card_online_payment_spec.rb",
168
171
  "spec/requests/base_spec.rb",
@@ -32,7 +32,8 @@ module GlobalCollect::Const
32
32
  :laser => [124, "Laser" ],
33
33
  :jcb => [125, "JCB" ],
34
34
  :discover => [128, "Discover" ],
35
- :carte_bleue => [130, "Carte Bleue Online" ]
35
+ :carte_bleue => [130, "Carte Bleue Online" ],
36
+ :paypal => [840, "PayPal" ]
36
37
  }
37
38
  end
38
39
  end
@@ -0,0 +1,17 @@
1
+ module GlobalCollect::RequestModels::DoRefund
2
+ class PaypalPayment < GlobalCollect::RequestModels::DoRefund::Payment
3
+ def initialize(attributes)
4
+ super(attributes)
5
+ @attributes["PAYMENTPRODUCTID"] = "1040"
6
+ end
7
+
8
+ # Merchant Guide for Paypal v6.1 states that we need to set PAYMENTPRODUCTID
9
+ # to '1040' to refund a Paypal payment.
10
+ def fields
11
+ super.merge({
12
+ "PAYMENTPRODUCTID" => ["N4", "R"]
13
+ })
14
+ end
15
+ end
16
+ end
17
+
@@ -41,6 +41,7 @@ lib_dir = File.dirname(__FILE__)
41
41
  %w[request_models insert_order_with_payment hosted_credit_card_online_payment] ,
42
42
  %w[request_models do_refund payment] ,
43
43
  %w[request_models do_refund credit_card_payment] ,
44
+ %w[request_models do_refund paypal_payment] ,
44
45
  %w[request_models set_payment payment] ,
45
46
  %w[requests base] ,
46
47
  %w[requests simple] ,
@@ -0,0 +1,29 @@
1
+ require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
2
+
3
+ describe "the do_refund paypal payment model" do
4
+ it "should set PAYMENTPRODUCTID to '1040' when not provided" do
5
+ model = GlobalCollect::RequestModels::DoRefund::PaypalPayment.new(
6
+ "ORDERID" => "1234",
7
+ "MERCHANTREFERENCE" => "asdf"
8
+ )
9
+ model["PAYMENTPRODUCTID"].should == "1040"
10
+ end
11
+
12
+ it "should set PAYMENTPRODUCTID to '1040' when it is something invalid" do
13
+ model = GlobalCollect::RequestModels::DoRefund::PaypalPayment.new(
14
+ "ORDERID" => "1234",
15
+ "MERCHANTREFERENCE" => "asdf",
16
+ "PAYMENTPRODUCTID" => "a"
17
+ )
18
+ model["PAYMENTPRODUCTID"].should == "1040"
19
+ end
20
+
21
+ it "should set PAYMENTPRODUCTID to '1040' when it is set to the wrong thing" do
22
+ model = GlobalCollect::RequestModels::DoRefund::PaypalPayment.new(
23
+ "ORDERID" => "1234",
24
+ "MERCHANTREFERENCE" => "asdf",
25
+ "PAYMENTPRODUCTID" => "1"
26
+ )
27
+ model["PAYMENTPRODUCTID"].should == "1040"
28
+ end
29
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 0
9
- version: 0.2.0
8
+ - 1
9
+ version: 0.2.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Timon Karnezos
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-08 00:00:00 -07:00
17
+ date: 2010-06-09 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -140,6 +140,7 @@ files:
140
140
  - lib/global_collect/request_models/base.rb
141
141
  - lib/global_collect/request_models/do_refund/credit_card_payment.rb
142
142
  - lib/global_collect/request_models/do_refund/payment.rb
143
+ - lib/global_collect/request_models/do_refund/paypal_payment.rb
143
144
  - lib/global_collect/request_models/insert_order_with_payment/credit_card_online_payment.rb
144
145
  - lib/global_collect/request_models/insert_order_with_payment/hosted_credit_card_online_payment.rb
145
146
  - lib/global_collect/request_models/insert_order_with_payment/order.rb
@@ -184,6 +185,7 @@ files:
184
185
  - spec/log_parsing/payment_report/parser_spec.rb
185
186
  - spec/log_parsing/payment_report/report_file_spec.rb
186
187
  - spec/request_models/base_spec.rb
188
+ - spec/request_models/do_refund/paypal_payment_spec.rb
187
189
  - spec/request_models/insert_order_with_payment/credit_card_online_payment_spec.rb
188
190
  - spec/request_models/insert_order_with_payment/hosted_credit_card_online_payment_spec.rb
189
191
  - spec/requests/base_spec.rb
@@ -267,6 +269,7 @@ test_files:
267
269
  - spec/log_parsing/payment_report/parser_spec.rb
268
270
  - spec/log_parsing/payment_report/report_file_spec.rb
269
271
  - spec/request_models/base_spec.rb
272
+ - spec/request_models/do_refund/paypal_payment_spec.rb
270
273
  - spec/request_models/insert_order_with_payment/credit_card_online_payment_spec.rb
271
274
  - spec/request_models/insert_order_with_payment/hosted_credit_card_online_payment_spec.rb
272
275
  - spec/requests/base_spec.rb