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

Inactive payment method Billie listed on form #37

Closed
rvdsteege opened this issue Aug 30, 2023 · 1 comment · Fixed by #38
Closed

Inactive payment method Billie listed on form #37

rvdsteege opened this issue Aug 30, 2023 · 1 comment · Fixed by #38
Assignees
Labels

Comments

@rvdsteege
Copy link
Member

From customer:

An additional payment method has been added to our donation page: Billie. I assume this is due to an update. We do not have this payment option enabled. Can you tell me how to remove the method from the form?

I was able to reproduce the issue with the built-in forms, where Billie is listed even though it is not available nor active for the Mollie account. I suspect this has to do with Billie being available for German organizations only and asked Mollie about this (Discord):

I don't see Billie listed in the response of https://api.mollie.com/v2/methods/all. Is this method only included in the response for German users?

Internal Help Scout ticket: https://secure.helpscout.net/conversation/2344860912/26086

@rvdsteege
Copy link
Member Author

I've received confirmation from Mollie:

Hi Reüel! Indeed, this method can only be used by German users. As the list all methods shows all payment methods that Mollie offers and can be activated by the Organization, Billie will not be included in the response in case of a non-German org.

The documentation at https://docs.mollie.com/reference/v2/methods-api/list-all-methods tells the same:

List all payment methods
Retrieve all payment methods that Mollie offers and can be activated by the Organization.

Therefore, it's better if we deactivate all Mollie methods by default.

/**
* Maybe enrich payment methods.
*
* @return void
*/
private function maybe_enrich_payment_methods() {
$cache_key = 'pronamic_pay_mollie_payment_methods_' . \md5( (string) \wp_json_encode( $this->config ) );
$mollie_payment_methods = \get_transient( $cache_key );
if ( false === $mollie_payment_methods ) {
$mollie_payment_methods = $this->client->get_all_payment_methods();
\set_transient( $cache_key, $mollie_payment_methods, \DAY_IN_SECONDS );
}
$method_transformer = new MethodTransformer();
foreach ( $mollie_payment_methods->_embedded->methods as $mollie_payment_method ) {
$core_payment_method_id = $method_transformer->transform_mollie_to_wp( $mollie_payment_method->id );
if ( null === $core_payment_method_id ) {
continue;
}
$core_payment_method = $this->get_payment_method( $core_payment_method_id );
if ( null !== $core_payment_method ) {
switch ( $mollie_payment_method->status ) {
case 'activated':
$core_payment_method->set_status( 'active' );
break;
case 'pending-boarding':
case 'pending-review':
case 'pending-external':
$core_payment_method->set_status( $this->config->is_test_mode() ? 'active' : 'inactive' );
break;
case 'rejected':
case null:
$core_payment_method->set_status( 'inactive' );
break;
}
}
}

@rvdsteege rvdsteege self-assigned this Aug 30, 2023
@rvdsteege rvdsteege moved this from Todo to In Progress in Pronamic Pay Aug 30, 2023
@rvdsteege rvdsteege linked a pull request Aug 30, 2023 that will close this issue
@github-project-automation github-project-automation bot moved this from In Progress to Done in Pronamic Pay Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant