Viincenttt / MollieApi

This project allows you to easily add the Mollie payment provider to your application.
MIT License
144 stars 83 forks source link

Create customer throws error when using the testmode property in the request #342

Closed gijsbertpieterbrouwer closed 4 months ago

gijsbertpieterbrouwer commented 4 months ago

Code

  var customerRequest = new CustomerRequest()
  {
      Email = email,
      Name = name,
      Locale = Locale.en_US,
      Testmode = IsTest,
      Metadata = metaData,
  };

  ICustomerClient customerClient = new CustomerClient(ApiKey);
  var customerResponse = customerClient.CreateCustomerAsync(customerRequest).Result;

Gives error: {Mollie.Api.Client.MollieApiException: Unprocessable Entity - Non-existent body parameter "testmode" for this API call. Did you mean: "name"? at Mollie.Api.Client.BaseMollieClient.ProcessHttpResponseMessage[T](HttpResponseMessage response) at Mollie.Api.Client.BaseMollieClient.SendHttpRequest[T](HttpMethod httpMethod, String relativeUri, Object data) at Mollie.Api.Client.BaseMollieClient.PostAsync[T](String relativeUri, Object data) at Mollie.Api.Client.CustomerClient.CreateCustomerAsync(CustomerRequest request)}

Which in fact is weird considering that the docs of mollie say there is a testmode property in the request: https://docs.mollie.com/reference/v2/customers-api/create-customer

BUT in the sample of mollie the request says: "mode": "test", instead of "testmode":true

Viincenttt commented 4 months ago

Hi @gijsbertpieterbrouwer

The testmode parameter is only for OAuth tokens, not API keys. For API keys, you already have a separation between live and test.

Viincenttt commented 4 months ago

Closing this issue for now, let me know if you need any other help :)