summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorBrendan Deere <brendan@stembolt.com>2016-09-12 10:28:12 -0700
committerBrendan Deere <brendan@stembolt.com>2016-09-27 17:14:14 -0700
commit8f58a7a95d27a2dff60684834422304fcaa8aafd (patch)
tree789f3e19b7046a43cfe144b9eed74b1d98861cf3 /app/models
parente2a93f917fa2877c1f63f55d62bd9024d80bb4e1 (diff)
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
Diffstat (limited to 'app/models')
-rw-r--r--app/models/solidus_subscriptions/installment.rb9
1 files changed, 9 insertions, 0 deletions
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