commercetools / commercetools-sdk-java-v2

The e-commerce SDK from commercetools for Java.
https://commercetools.github.io/commercetools-sdk-java-v2/javadoc/index.html
Apache License 2.0
34 stars 15 forks source link

Unable to add custom field in transaction with type key #243

Closed milindsingh closed 2 years ago

milindsingh commented 2 years ago

Describe the bug Unable to add custom field in transaction with type key

To Reproduce I am able to add transaction to payment with the following request body containing "key": "my-transaction-key" but unable to do so using SDK.

{
  "version": 10,
  "actions": [
    {
      "action": "addTransaction",
      "transaction": {
        "type": "Refund",
        "amount": {
          "centAmount": 8695,
          "currencyCode": "AUD"
        },
        "custom": {
            "type": {
                "key": "my-transaction-key"
            },
            "fields": {
                "returnTrackingId":"01000123456"
            }
        }
      }
    }
  ]
}

com.commercetools.api.models.payment.TransactionDraft class uses com.commercetools.api.models.type.CustomFields class for custom fields instead of com.commercetools.api.models.type.CustomFieldsDraft which does not have getter/setter for key in com.commercetools.api.models.type.TypeReference class.

Expected behavior SDK should be same as rest api.

Screenshots/Code snippet Not able to find in repo.

Stack information (please complete the following information):

jenschude commented 2 years ago

Just released 7.5.0 which fixes the type for the field custom to CustomFieldsDraft.

Thanks for the report