Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send 'Refunded' notices for charged back transaction #20

Closed
rvdsteege opened this issue Jul 4, 2024 · 3 comments · Fixed by #21
Closed

Send 'Refunded' notices for charged back transaction #20

rvdsteege opened this issue Jul 4, 2024 · 3 comments · Fixed by #21
Assignees

Comments

@rvdsteege
Copy link
Member

For chargebacks we update the MemberPress transaction status to 'Refunded', but don't send the 'Refunded' notices:

/**
* Maybe record refund for MemberPress transaction.
*
* @param Payment $payment Payment.
* @return void
*/
public function maybe_record_memberpress_transaction_refund( Payment $payment ) {
if ( 'memberpress_transaction' !== $payment->get_source() ) {
return;
}
// Check if payment has been refunded or charged back.
$amount_refunded = $payment->get_refunded_amount();
$amount_charged_back = $payment->get_charged_back_amount();
if ( $amount_refunded->get_value() <= 0 && null === $amount_charged_back ) {
return;
}
// Update transaction status to 'Refunded'.
$memberpress_transaction = MemberPress::get_transaction_by_id( $payment->get_source_id() );
if ( null === $memberpress_transaction ) {
return;
}
if ( MeprTransaction::$refunded_str === $memberpress_transaction->status ) {
return;
}
$memberpress_transaction->status = MeprTransaction::$refunded_str;
$memberpress_transaction->store();
// Send 'Transaction Refunded' notice for refund (not for chargeback).
if ( $amount_refunded->get_value() > 0 ) {
MeprUtils::send_refunded_txn_notices( $memberpress_transaction );
}
}

In internal support ticket https://secure.helpscout.net/conversation/2642579484/27460 we received a question about informing site admins about these chargebacks:

Onlangs hebben we een refund gehad die terug te zien is in Mollie. Ook is deze te zien in de subscription en toen netjes on hold gegaan, dus dat deel van het proces is helemaal goed gegaan. Echter hebben wij in memberpress de optie aanstaan dat onze administratie een melding zou moeten krijgen bij een refund, deze hebben ze echter niet gehad en is ook niet uitgestuurd volgens de mail log die ik bijhoud.

Hoe kunnen we ervoor zorgen dat onze administratie in de toekomst wel een melding krijgt bij refunds? Er zitten namelijk wat handmatige acties aan onze meberships die tijdig gestopt moeten worden in het geval van het terugdraaien van een betaling.

I suggest also sending the notices (lines 376-379) for chargebacks. What do you think, @remcotolsma?

@remcotolsma
Copy link
Member

Seems fine to me, can there be customer notices and are they also suitable to send in the case of chargebacks?

@rvdsteege
Copy link
Member Author

Yes, there are customer and admin notices for refunds:

Scherm­afbeelding 2024-07-05 om 09 48 53 Scherm­afbeelding 2024-07-05 om 09 49 02

@remcotolsma
Copy link
Member

We have probably disabled these notices for chargebacks, because a "Your Transaction Was Refunded" can also be seen as confirmation/approval of the chargeback. A customer can initiate a chargeback himself, but that does not always remove the obligation to pay. It will differ per MemberPress website how the administrators want to deal with this. There are a number of options in this regard:

  1. Also send the refunded notices in the event of a chargeback (see PR).
    Administrators can adjust the refund notice and mention something there about obligation to pay.
  2. Only send the notice for chargeback to administrators (MeprAdminRefundedTxnEmail):
    https://github.com/pronamic/memberpress/blob/aade7228d2300b4d1bdbdddd0f95ae11022008e8/app/lib/MeprUtils.php#L1579-L1591
  3. Introduce special chargeback notices settings.
    It is possible to introduce a custom email?

I will approve the PR for now, for any future issues we can consider option 2 or 3.

@github-project-automation github-project-automation bot moved this from Todo to Done in Pronamic Pay Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants