diff options
author | Brendan Deere <brendangdeere@gmail.com> | 2016-09-28 11:36:43 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-28 11:36:43 -0700 |
commit | 5a3eff7e6c6464a5d28a59c6246415945ce6963a (patch) | |
tree | 2b4ba1408144de3997c05b1b443f806c3b2e3d9c /app/models/solidus_subscriptions/installment.rb | |
parent | a0150954d6c00e625e4f0ca934e8965ebb1899ec (diff) | |
parent | ea13b034a2dd1ec79b3d8c8aa972a820731f03fe (diff) |
Merge pull request #62 from brendandeere/payment_failure
Payment failure
Diffstat (limited to 'app/models/solidus_subscriptions/installment.rb')
-rw-r--r-- | app/models/solidus_subscriptions/installment.rb | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/app/models/solidus_subscriptions/installment.rb b/app/models/solidus_subscriptions/installment.rb index fcfe652..162efb8 100644 --- a/app/models/solidus_subscriptions/installment.rb +++ b/app/models/solidus_subscriptions/installment.rb @@ -27,7 +27,7 @@ module SolidusSubscriptions # @return [SolidusSubscriptions::InstallmentDetail] The record of the failed # processing attempt def out_of_stock - advance_actionable_date + advance_actionable_date! details.create!( success: false, @@ -53,7 +53,7 @@ module SolidusSubscriptions # @return [SolidusSubscriptions::InstallmentDetail] The record of the # failed processing attempt def failed - advance_actionable_date + advance_actionable_date! details.create!( success: false, @@ -68,10 +68,19 @@ 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 - update(actionable_date: next_actionable_date) + def advance_actionable_date! + update!(actionable_date: next_actionable_date) end def next_actionable_date |