commercetools / commercetools-payment-to-order-processor

commercetools-payment-to-order-processor is a schedulable service which helps to convert valid payments into orders asynchronously
5 stars 3 forks source link

Add implementation for processing PaymentTransactionAdded messages #71

Closed lojzatran closed 3 years ago

lojzatran commented 3 years ago

The problem

PaymentTransactionStateChangedMessage is not triggered when a transaction is added to the payment. In this case only PaymentTransactionAddedMessage is triggered. However, the processor does not react to these messages and no order is created. In Adyen we often only create a successful payment transaction and do not update it later. That's why the processor does not work correctly for adyen.

The solution

Since both messages are quite similar, I created a wrapper for both of them and use it everywhere: https://github.com/commercetools/commercetools-payment-to-order-processor/pull/71/files#diff-026967b3b2d039b83d87b8dda429a9cecb01979394c1886ed5aa6426c9c4c5d6

I also fetch now both messages from CTP: https://github.com/commercetools/commercetools-payment-to-order-processor/pull/71/files#diff-65bef2d220f7dfe37d656e1c24cf92cd8807e747c672ac37e555b468f905a55bR131

I added integration test for the batch job: https://github.com/commercetools/commercetools-payment-to-order-processor/pull/71/files#diff-78fa7cafd7458ce813408b9fd851a7c9d0c6ccc874a06673c11e110bd055c02c

I tried to improve the tests, but it's too much, so for now it's only half improved. There will be another ticket for this improvement.