mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-29 06:21:16 +00:00
We now include the refunded amount in the email to the customer. When voiding a payment, it's the full amount of the payment. When giving back credit then it's only the money that has been paid too much.
38 lines
1.1 KiB
Ruby
38 lines
1.1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
class PaymentMailer < ApplicationMailer
|
|
include I18nHelper
|
|
|
|
def authorize_payment(payment)
|
|
@payment = payment
|
|
@order = @payment.order
|
|
@hide_ofn_navigation = @payment.order.distributor.hide_ofn_navigation
|
|
I18n.with_locale valid_locale(@order.user) do
|
|
mail(to: @order.email,
|
|
subject: default_i18n_subject(distributor: @order.distributor.name),
|
|
reply_to: @order.distributor.contact.email)
|
|
end
|
|
end
|
|
|
|
def authorization_required(payment)
|
|
@order = payment.order
|
|
shop_owner = @order.distributor.owner
|
|
I18n.with_locale valid_locale(shop_owner) do
|
|
mail(to: shop_owner.email, reply_to: @order.email)
|
|
end
|
|
end
|
|
|
|
def refund_available(amount, payment, taler_order_status_url)
|
|
@order = payment.order
|
|
@shop = @order.distributor.name
|
|
@amount = amount
|
|
@taler_order_status_url = taler_order_status_url
|
|
|
|
I18n.with_locale valid_locale(@order.user) do
|
|
mail(to: @order.email,
|
|
subject: default_i18n_subject(shop: @shop),
|
|
reply_to: @order.email)
|
|
end
|
|
end
|
|
end
|