ovh / terraform-provider-ovh

Terraform OVH provider
https://registry.terraform.io/providers/ovh/ovh/latest/docs
Mozilla Public License 2.0
182 stars 133 forks source link

[BUG] when creating a public cloud project, got 403 "This order can't be paid with 'bankAccount'" error #646

Closed louisdussarps closed 1 month ago

louisdussarps commented 3 months ago

Describe the bug

When creating a new public cloud project via terraform, on some OVH accounts, we got the following behavior :

The problematic call is made from these lines in terraform : https://github.com/ovh/terraform-provider-ovh/blob/dd08eda87f08d32e22358c026d6ea1ff5138c1fb/ovh/order.go#L352C1-L355C4

At the API level, the error come from the call to this route : POST /me/order/{orderId}/pay body : paymentMethod={id: paymentId} (cf https://eu.api.ovh.com/console/#/me/order/%7BorderId%7D/pay~POST)

The output of this call is an error : 403 : {"message":"This order can't be paid with 'bankAccount'"}

Affected Resource(s)

What should have happened? The public cloud project should be created

Steps to Reproduce

just run the terraform example : https://registry.terraform.io/providers/ovh/ovh/latest/docs/resources/cloud_project

Note that it does not happen on every OVH account.

References

We discussed with the OVH support on this bug. According to them, the POST /me/order/{orderId}/pay doesn't work for order of price 0. Another payment route should be call, e.g. "validateZeroEasy" or "promotion"

amstuta commented 3 months ago

Hello @louisdussarps , thanks for opening this issue.

It is possible that your payment method has not been registered as a SEPA_DIRECT_DEBIT payment method (even if it is one), depending on the moment that is was added to your account. Could you try removing this payment method from your account and re-adding it (using Direct debit type) ?

louisdussarps commented 3 months ago

Hello and thank you for the response. The accounts in question belong to a client (our software operates as a Platform as a Service, so it's installed on the client's cloud account), thus I am not authorized to perform such a manipulation as modifying the payment method. However, your hypothesis appear to be accurate:

Is there a workaround for this? Despite the explanation being clear, it's possible we'll encounter this scenario again on another client account.

amstuta commented 3 months ago

OK I see, I don't have any easy workaround for this. Could you provide us the ticket number that you had when contacting the support ? With this, we'll be able to escalate the issue to the right team so that they fix it.

louisdussarps commented 3 months ago

Yes, the ticket number is : 9429967 Thanks for the reactivity. One question, which is more for curiosity : why the terraform use /pay instead of /payWithRegisteredPaymentMean ? The web interface seems to use /payWithRegisteredPaymentMean and as a consequence, doesn't seem to have this problem.

amstuta commented 3 months ago

Thanks, we'll look into it and come back to you.

For your question, /payWithRegisteredPaymentMean is a deprecated route that is replaced by /pay, that's why it is the one used in the provider. We're checking internally why they don't behave the same way ;)

amstuta commented 1 month ago

@louisdussarps I'm closing this issue as it is not directly related to the TF provider. We raised the issue internally to the right team, so this should be resolved via the support ;)