muck-commerce 0.2.4 → 0.2.5
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
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.5
|
@@ -26,30 +26,36 @@ class Muck::BillingInformationsController < ApplicationController
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def update
|
29
|
-
|
30
|
-
|
31
|
-
if MuckCommerce::Configure.cim_enabled?
|
32
|
-
# update billing info in the CIM
|
33
|
-
response = OrderTransaction.cim_create_update(@billing_information.billable, @billing_information)
|
34
|
-
@billing_information.billable.order_transactions.push(response)
|
35
|
-
if response.success?
|
36
|
-
flash[:notice] = translate('muck.commerce.billing_information_updated_friendly')
|
37
|
-
@success = true
|
38
|
-
else
|
39
|
-
flash[:notice] = translate('muck.commerce.billing_information_update_error_friendly', :error => response.message)
|
40
|
-
end
|
41
|
-
else
|
42
|
-
@success = true
|
43
|
-
end
|
44
|
-
end
|
29
|
+
success, message = update_billing_information(@billing_information)
|
30
|
+
flash[:notice] = message unless success
|
45
31
|
render :template => 'billing_informations/edit'
|
46
32
|
rescue MuckCommerce::Exceptions::PaymentGatewayError => ex
|
47
|
-
flash[:error]
|
33
|
+
flash[:error] = translate('muck.commerce.billing_information_update_error_friendly', :error => ex)
|
48
34
|
render :template => 'billing_informations/edit'
|
49
35
|
end
|
50
36
|
|
51
37
|
protected
|
52
38
|
|
39
|
+
def update_billing_information(billing_information)
|
40
|
+
success = false
|
41
|
+
if billing_information.update_attributes(params[:billing_information])
|
42
|
+
if MuckCommerce::Configure.cim_enabled?
|
43
|
+
# update billing info in the CIM
|
44
|
+
response = OrderTransaction.cim_create_update(billing_information.billable, billing_information)
|
45
|
+
billing_information.billable.order_transactions.push(response)
|
46
|
+
if response.success?
|
47
|
+
message = translate('muck.commerce.billing_information_updated_friendly')
|
48
|
+
success = true
|
49
|
+
else
|
50
|
+
message = translate('muck.commerce.billing_information_update_error_friendly', :error => response.message)
|
51
|
+
end
|
52
|
+
else
|
53
|
+
success = true
|
54
|
+
end
|
55
|
+
end
|
56
|
+
[success, message]
|
57
|
+
end
|
58
|
+
|
53
59
|
def setup_billing_information
|
54
60
|
@billing_information = current_user.billing_informations.find(params[:id]) rescue nil
|
55
61
|
@billing_information ||= current_user.billing_information
|
@@ -185,11 +185,6 @@ module ActiveRecord
|
|
185
185
|
succeeded_count = results.select {|result| result == true}.length
|
186
186
|
"#{message}\tProcessed: #{results.size}\tFailed: #{failure_count}\tSucceeded: #{succeeded_count}"
|
187
187
|
end
|
188
|
-
|
189
|
-
private
|
190
|
-
def timestamp_attribute(attribute_name, time = Time.now)
|
191
|
-
self.update_attribute(attribute_name, time)
|
192
|
-
end
|
193
188
|
|
194
189
|
end
|
195
190
|
|
@@ -197,19 +192,16 @@ module ActiveRecord
|
|
197
192
|
module InstanceMethods
|
198
193
|
|
199
194
|
def suspend_subscription
|
200
|
-
|
201
|
-
self.user.remove_from_role('subscriber')
|
195
|
+
self.update_attribute(:suspended_at, Time.now)
|
202
196
|
MessageMailer.deliver_cc_declined(self.user)
|
203
197
|
end
|
204
198
|
|
205
199
|
def activate_subscription
|
206
200
|
self.update_attributes(:activated_at => Time.now, :suspended_at => nil, :cancelled_at => nil)
|
207
|
-
user.roles << Role.find_by_name('subscriber') unless user.subscriber?
|
208
201
|
end
|
209
202
|
|
210
203
|
def cancel_subscription
|
211
|
-
|
212
|
-
self.user.remove_from_role('subscriber')
|
204
|
+
self.update_attribute(:cancelled_at, Time.now)
|
213
205
|
end
|
214
206
|
|
215
207
|
def past_due?
|
data/muck-commerce.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{muck-commerce}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Justin Ball", "Joel Duffin"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-05-05}
|
13
13
|
s.description = %q{Add ecommerce functionality to your muck project. This includes integration with Paypal and Authorize.net. This gem uses active merchant and so adding other gateways should be simple.}
|
14
14
|
s.email = %q{justin@tatemae.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 5
|
9
|
+
version: 0.2.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Justin Ball
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-05-05 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|