add resend-authorization-email button to admin screen

This commit is contained in:
Andy Brett
2020-12-14 19:48:54 -08:00
parent 5c0408c68c
commit 84b5fcf2ce
3 changed files with 14 additions and 1 deletions

View File

@@ -16,6 +16,7 @@
}
.icon-email:before { @extend .icon-envelope:before }
.icon-resend_authorization_email:before { @extend .icon-envelope:before }
.icon-resume:before { @extend .icon-refresh:before }
.icon-cancel:before,

View File

@@ -79,11 +79,17 @@ module Spree
end
def actions
%w{capture void credit}
%w{capture void credit resend_authorization_email}
end
def can_resend_authorization_email?(payment)
payment.pending? && payment.cvv_response_message.present?
end
# Indicates whether its possible to capture the payment
def can_capture?(payment)
return false if payment.cvv_response_message.present?
payment.pending? || payment.checkout?
end

View File

@@ -121,6 +121,12 @@ module Spree
actions
end
def resend_authorization_email!
return unless cvv_response_message.present?
PaymentMailer.authorize_payment(self).deliver
end
def payment_source
res = source.is_a?(Payment) ? source.source : source
res || payment_method