From 8f58a7a95d27a2dff60684834422304fcaa8aafd Mon Sep 17 00:00:00 2001 From: Brendan Deere Date: Mon, 12 Sep 2016 10:28:12 -0700 Subject: Installment#payment_failed A method responsible for the behaviour of an installment when the payment fails on an order when attempting to fulfill the installment --- app/models/solidus_subscriptions/installment.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'app/models/solidus_subscriptions/installment.rb') diff --git a/app/models/solidus_subscriptions/installment.rb b/app/models/solidus_subscriptions/installment.rb index 3af9b52..aa2d2d2 100644 --- a/app/models/solidus_subscriptions/installment.rb +++ b/app/models/solidus_subscriptions/installment.rb @@ -68,6 +68,15 @@ module SolidusSubscriptions order_id.nil? || !order.completed? end + def payment_failed! + advance_actionable_date + + details.create!( + success: false, + message: I18n.t('solidus_subscriptions.installment_details.payment_failed') + ) + end + private def advance_actionable_date -- cgit v1.2.3