Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bug fix: time_created isn't meant to be used as the payment date.

  • Loading branch information...
commit fdaa6be3b4098f78aedf3be03134734f6eb46b71 1 parent 2fc03a2
@fnando authored
View
7 lib/paypal/recurring/notification.rb
@@ -16,7 +16,8 @@ class Notification
:status => :payment_status,
:pending_reason => :pending_reason,
:profile_status => :profile_status,
- :payment_date => [:time_created, :payment_date],
+ :payment_date => :payment_date,
+ :time_created => :time_created,
:seller_id => :receiver_id,
:email => :receiver_email,
:initial_amount => :initial_payment_amount,
@@ -71,6 +72,10 @@ def paid_at
self.class.convert_to_time(payment_date) if payment_date
end
+ def created_at
+ self.class.convert_to_time(time_created) if time_created
+ end
+
def verified?
response.body == "VERIFIED"
end
View
10 spec/paypal/notification_spec.rb
@@ -21,17 +21,17 @@
subject.paid_at.strftime("%Y-%m-%d %H:%M:%S").should == "2011-07-05 03:37:06"
end
+ it "normalizes creation date" do
+ subject.params[:time_created] = "20:37:06 Jul 04, 2011 PDT" # PDT = -0700
+ subject.created_at.strftime("%Y-%m-%d %H:%M:%S").should == "2011-07-05 03:37:06"
+ end
+
it "returns currency" do
subject.params[:mc_currency] = "BRL"
subject.currency.should == "BRL"
end
describe "#payment_date" do
- it "returns date from time_created field" do
- subject.params[:time_created] = "2011-07-05"
- subject.payment_date.should == "2011-07-05"
- end
-
it "returns date from payment_date field" do
subject.params[:payment_date] = "2011-07-05"
subject.payment_date.should == "2011-07-05"
View
1  spec/paypal/response/update_recurring_profile_spec.rb
@@ -33,6 +33,7 @@
context "when failure" do
use_vcr_cassette("update_profile/failure")
+
let(:paypal) {
PayPal::Recurring.new({
:profile_id => "I-W4FNTE6EXJ2W",
Please sign in to comment.
Something went wrong with that request. Please try again.