google4r-checkout 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +4 -0
- data/README.md +2 -0
- data/lib/google4r/checkout/commands.rb +21 -7
- data/lib/google4r/checkout/frontend.rb +14 -0
- metadata +13 -12
data/CHANGES
CHANGED
data/README.md
CHANGED
@@ -46,12 +46,16 @@ module Google4R #:nodoc:
|
|
46
46
|
# is to be put in via String#%.
|
47
47
|
PRODUCTION_URL_PREFIX = 'https://checkout.google.com/'
|
48
48
|
|
49
|
+
# Orders
|
49
50
|
CHECKOUT_API_URL = 'api/checkout/v2/merchantCheckout/Merchant/%s'
|
50
|
-
|
51
51
|
ORDER_PROCESSING_API_URL = 'api/checkout/v2/request/Merchant/%s'
|
52
|
-
|
53
52
|
ORDER_REPORT_API_URL = 'api/checkout/v2/reports/Merchant/%s'
|
54
53
|
|
54
|
+
# Donations
|
55
|
+
DONATE_CHECKOUT_API_URL = 'api/checkout/v2/merchantCheckout/Donations/%s'
|
56
|
+
DONATE_ORDER_PROCESSING_API_URL = 'api/checkout/v2/request/Donations/%s'
|
57
|
+
DONATE_ORDER_REPORT_API_URL = 'api/checkout/v2/reports/Donations/%s'
|
58
|
+
|
55
59
|
|
56
60
|
# The Frontent class that was used to create this CheckoutCommand and whose
|
57
61
|
# configuration will be used.
|
@@ -91,12 +95,22 @@ module Google4R #:nodoc:
|
|
91
95
|
PRODUCTION_URL_PREFIX
|
92
96
|
end
|
93
97
|
url_str +=
|
94
|
-
if
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
+
if frontend.configuration[:purchase_type] == :donation
|
99
|
+
if self.class == CheckoutCommand then
|
100
|
+
DONATE_CHECKOUT_API_URL
|
101
|
+
elsif self.class == OrderReportCommand || self.class == NotificationHistoryRequestCommand then
|
102
|
+
DONATE_ORDER_REPORT_API_URL
|
103
|
+
else
|
104
|
+
DONATE_ORDER_PROCESSING_API_URL
|
105
|
+
end
|
98
106
|
else
|
99
|
-
|
107
|
+
if self.class == CheckoutCommand then
|
108
|
+
CHECKOUT_API_URL
|
109
|
+
elsif self.class == OrderReportCommand || self.class == NotificationHistoryRequestCommand then
|
110
|
+
ORDER_REPORT_API_URL
|
111
|
+
else
|
112
|
+
ORDER_PROCESSING_API_URL
|
113
|
+
end
|
100
114
|
end
|
101
115
|
url_str = url_str % frontend.configuration[:merchant_id]
|
102
116
|
|
@@ -38,6 +38,17 @@ module Google4R #:nodoc:
|
|
38
38
|
#
|
39
39
|
# frontend = Google4R::Checkout::Frontend.new(configuration)
|
40
40
|
#
|
41
|
+
# === Donations
|
42
|
+
#
|
43
|
+
# If you are processing orders for a Google-verified 501(c)(3) or 510(c)(6) nonprofit,
|
44
|
+
# you can collect donations instead of orders. To do so, specify the :purchase_type option
|
45
|
+
# as :donation.
|
46
|
+
#
|
47
|
+
# configuration = { :merchant_id => '123456789', :merchant_key => '12345abcd',
|
48
|
+
# :purchase_type => :donation }
|
49
|
+
#
|
50
|
+
# frontend = Google4R::Checkout::Frontend.new(configuration)
|
51
|
+
#
|
41
52
|
# == Tax Table Factory
|
42
53
|
#
|
43
54
|
# You have to set the tax_table_factory attribute of every Frontend object before you
|
@@ -88,6 +99,9 @@ module Google4R #:nodoc:
|
|
88
99
|
raise "Missing configuration setting: merchant_id" if configuration[:merchant_id].nil?
|
89
100
|
raise "Missing configuration setting: merchant_key" if configuration[:merchant_key].nil?
|
90
101
|
raise "Missing configuration setting: use_sandbox" if configuration[:use_sandbox].nil?
|
102
|
+
|
103
|
+
configuration[:purchase_type] ||= :order
|
104
|
+
raise "Invalid configuration setting: purchase_type" unless[:donation, :order].include?(configuration[:purchase_type])
|
91
105
|
|
92
106
|
@configuration = configuration.dup.freeze
|
93
107
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google4r-checkout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,14 +13,15 @@ authors:
|
|
13
13
|
- Johnathan Niziol
|
14
14
|
- Chris Parrish
|
15
15
|
- Larry Salibra
|
16
|
+
- Paul Schreiber
|
16
17
|
autorequire:
|
17
18
|
bindir: bin
|
18
19
|
cert_chain: []
|
19
|
-
date:
|
20
|
+
date: 2012-05-31 00:00:00.000000000 Z
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
23
|
name: money
|
23
|
-
requirement: &
|
24
|
+
requirement: &70193619970700 !ruby/object:Gem::Requirement
|
24
25
|
none: false
|
25
26
|
requirements:
|
26
27
|
- - ! '>='
|
@@ -28,10 +29,10 @@ dependencies:
|
|
28
29
|
version: 2.3.0
|
29
30
|
type: :runtime
|
30
31
|
prerelease: false
|
31
|
-
version_requirements: *
|
32
|
+
version_requirements: *70193619970700
|
32
33
|
- !ruby/object:Gem::Dependency
|
33
34
|
name: mocha
|
34
|
-
requirement: &
|
35
|
+
requirement: &70193619970280 !ruby/object:Gem::Requirement
|
35
36
|
none: false
|
36
37
|
requirements:
|
37
38
|
- - ! '>='
|
@@ -39,10 +40,10 @@ dependencies:
|
|
39
40
|
version: '0'
|
40
41
|
type: :development
|
41
42
|
prerelease: false
|
42
|
-
version_requirements: *
|
43
|
+
version_requirements: *70193619970280
|
43
44
|
- !ruby/object:Gem::Dependency
|
44
45
|
name: nokogiri
|
45
|
-
requirement: &
|
46
|
+
requirement: &70193619969820 !ruby/object:Gem::Requirement
|
46
47
|
none: false
|
47
48
|
requirements:
|
48
49
|
- - ! '>='
|
@@ -50,10 +51,10 @@ dependencies:
|
|
50
51
|
version: '0'
|
51
52
|
type: :development
|
52
53
|
prerelease: false
|
53
|
-
version_requirements: *
|
54
|
+
version_requirements: *70193619969820
|
54
55
|
- !ruby/object:Gem::Dependency
|
55
56
|
name: rake
|
56
|
-
requirement: &
|
57
|
+
requirement: &70193619969380 !ruby/object:Gem::Requirement
|
57
58
|
none: false
|
58
59
|
requirements:
|
59
60
|
- - ! '>='
|
@@ -61,9 +62,9 @@ dependencies:
|
|
61
62
|
version: '0'
|
62
63
|
type: :development
|
63
64
|
prerelease: false
|
64
|
-
version_requirements: *
|
65
|
+
version_requirements: *70193619969380
|
65
66
|
description: ! " google4r-checkout is a lightweight, framework-agnostic Ruby library
|
66
|
-
to access the Google Checkout service and implement \n notification handlers.
|
67
|
+
to access the Google Checkout service and implement \n notification handlers. It
|
67
68
|
exposes object-oriented wrappers for all of Google Checkout's API commands and notifications.\n"
|
68
69
|
email: natbudin@gmail.com
|
69
70
|
executables: []
|
@@ -170,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
171
|
version: '0'
|
171
172
|
requirements: []
|
172
173
|
rubyforge_project:
|
173
|
-
rubygems_version: 1.8.
|
174
|
+
rubygems_version: 1.8.11
|
174
175
|
signing_key:
|
175
176
|
specification_version: 3
|
176
177
|
summary: Full-featured Google Checkout library for Ruby
|