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

Recurring payments not using mandate from subscription #11

Closed
rvdsteege opened this issue Oct 10, 2022 · 0 comments · Fixed by pronamic/wp-pay-core#77 or #12
Closed

Recurring payments not using mandate from subscription #11

rvdsteege opened this issue Oct 10, 2022 · 0 comments · Fixed by pronamic/wp-pay-core#77 or #12
Assignees
Labels

Comments

@rvdsteege
Copy link
Member

Through a support ticket, it came to our attention that recurring payments are not always started with the mandate ID from the subscription. Instead, recurring payments are started with the latest created mandate.

Als wij kijken bij Pronamic Pay dan zien wij dat de abonnementen zodanig zijn ingesteld dat ze zijn gekoppeld aan de juiste ingezonden formulieren in GF, dus in Pronamic Pay lijkt het alsof de abonnementen aan de juiste klanten zijn gekoppeld, maar.....

Mollie krijgt de gegevens op de één of andere manier verkeerd binnen. Hierdoor hebben ze nu alle bovengenoemde donaties van de rekening van ** ***** afgehaald. (zie fotobijlage).

I researched the issue and it appears that an empty BankAccountDetails object causes the issue (instead of null value for $payment->get_bank_account_details()):

/**
* Direct Debit.
*
* Check if one-off SEPA Direct Debit can be used, otherwise short circuit payment.
*/
$consumer_bank_details = $payment->get_consumer_bank_details();
if ( PaymentMethods::DIRECT_DEBIT === $payment_method && null !== $consumer_bank_details ) {
$consumer_name = $consumer_bank_details->get_name();
$consumer_iban = $consumer_bank_details->get_iban();
$request->consumer_name = $consumer_name;
$request->consumer_account = $consumer_iban;
// Check if one-off SEPA Direct Debit can be used, otherwise short circuit payment.
if ( null !== $customer_id ) {
// Find or create mandate.
$mandate_id = $this->client->has_valid_mandate( $customer_id, PaymentMethods::DIRECT_DEBIT, $consumer_iban );
if ( false === $mandate_id ) {
$mandate = $this->client->create_mandate( $customer_id, $consumer_bank_details );
$mandate_id = $mandate->get_id();
}
// Charge immediately on-demand.
$request->set_sequence_type( 'recurring' );
$request->set_mandate_id( (string) $mandate_id );
}
}

The empty consumer bank details object is created in https://github.com/pronamic/wp-pay-core/blob/f220aa2ee979389cfcae782ff643b681ff85013b/src/Plugin.php#L1034-L1053

Internal Help Scout ticket: https://secure.helpscout.net/conversation/2033376897/24587

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
2 participants