Hi,
I have to create an order by code. I’ve got a problem regarding the transactions. When the ERP is notifying Litium (via ERP Connect) that some products are delivered, the shipment gets stuck in processing. I think I boiled it down to being a problem with the transactions. I can see that a transaction is created, but it is stuck in “Unknown” result.
Is there something I have to think about when creating the order, regarding transactions?
I want to create the order and then transition it to processing immediately. After the order is created, I transition it to confirmed and then immediately to processing, which is working. To get this part working, I created a transaction an “Authorize” transaction with the result “Success”, but I’m not sure if this is the correct way of doing it. I’ve also created a payment containing all rows, that the Authorize transaction is connected to.
Litium version: 8.3.1
At the time the order is created, you would have following in database:
Order in the Init state, with all its order rows, and other information.
A Init transaction connected to the payment.
A Authorize transaction connected to the payment, which has the Init transaction as the relatedTransactionReference.
The payment you create, must belong to a payment provider, either a real payment provider or the Litium direct pay app (which simulates a payment service provider)
So, if I understood correctly:
Create order, including a payment (and shipping info). I use direct pay and direct shipment.
Create an “Init” transaction
Create an “Authorize” transaction (with what result? success?) that is related to the init transaction
Now it should work to(?):
Notify order exported via ERP Connect
Notify shipment delivered via ERP Connect
I followed the steps above, but I still get an error when capturing the payment:
2022-05-11 08:56:16.0718 [App:01] [0b55d4317850d445b5fdc97ed85bf106] [INFO ] [.NET ThreadPool Worker] System.Net.Http.HttpClient.App.LogicalHandler - Start processing HTTP request POST https://customer-direct-payment.localtest.me:10011/api/payments/cd0b7fd8-ea9f-4eb8-91e2-611dc47b0971/capture
2022-05-11 08:56:16.0718 [App:01] [0b55d4317850d445b5fdc97ed85bf106] [TRACE] [.NET ThreadPool Worker] System.Net.Http.HttpClient.App.LogicalHandler - Request Headers:
User-Agent: Litium/8.3.1, (Client=directpayment)
Authorization: *
Content-Type: application/json; charset=utf-8
2022-05-11 08:56:16.0718 [App:01] [0b55d4317850d445b5fdc97ed85bf106] [TRACE] [.NET ThreadPool Worker] System.Net.Http.HttpClient.App.LogicalHandler - Request content:
{"transactionId":"LDP10095T3","orderId":"LD10026","paymentProviderId":"DirectPayment","paymentOptionId":"DirectPay","currencyCode":"SEK","rows":[{"transactionRowId":"1","articleNumber":"artno","description":"product name","quantity":1.00000000,"unitPriceIncludingVat":900.00000000,"unitPriceExcludingVat":900.00000000,"totalIncludingVat":900.00000000,"totalExcludingVat":900.00000000,"additionalInfo":{},"vatSummary":{"0.00000000":0.00}},{"transactionRowId":"2","articleNumber":"CustomFee","description":"Custom Fee","quantity":1.00000000,"orderRowId":"CustomFee","additionalInfo":{},"vatSummary":{"0.00000000":0.00}}],"totalExcludingVat":900.00000000,"totalIncludingVat":900.00000000}
2022-05-11 08:56:16.0718 [App:01] [0b55d4317850d445b5fdc97ed85bf106] [INFO ] [.NET ThreadPool Worker] System.Net.Http.HttpClient.App.ClientHandler - Sending HTTP request POST https://customer-direct-payment.localtest.me:10011/api/payments/cd0b7fd8-ea9f-4eb8-91e2-611dc47b0971/capture
2022-05-11 08:56:16.0718 [App:01] [0b55d4317850d445b5fdc97ed85bf106] [TRACE] [.NET ThreadPool Worker] System.Net.Http.HttpClient.App.ClientHandler - Request Headers:
User-Agent: Litium/8.3.1, (Client=directpayment)
Authorization: *
Content-Type: application/json; charset=utf-8
Content-Length: 726
2022-05-11 08:56:16.6471 [App:01] [0b55d4317850d445b5fdc97ed85bf106] [INFO ] [] System.Net.Http.HttpClient.App.ClientHandler - Received HTTP response headers after 575.1139ms - 500
2022-05-11 08:56:16.6471 [App:01] [0b55d4317850d445b5fdc97ed85bf106] [TRACE] [] System.Net.Http.HttpClient.App.ClientHandler - Response Headers:
Date: Wed, 11 May 2022 06:56:09 GMT
Server: Kestrel
Content-Length: 0
2022-05-11 08:56:16.6471 [App:01] [0b55d4317850d445b5fdc97ed85bf106] [INFO ] [] System.Net.Http.HttpClient.App.LogicalHandler - End processing HTTP request after 575.4369ms - 500
2022-05-11 08:56:16.6471 [App:01] [0b55d4317850d445b5fdc97ed85bf106] [TRACE] [] System.Net.Http.HttpClient.App.LogicalHandler - Response Headers:
Date: Wed, 11 May 2022 06:56:09 GMT
Server: Kestrel
Content-Length: 0
2022-05-11 08:56:16.6471 [App:01] [] [ERROR] [.NET ThreadPool Worker] Litium.Application.ServiceBus.LocalServiceBusFactoryImpl - Response status code does not indicate success: 500 (Internal Server Error). System.Net.Http.HttpRequestException: Response status code does not indicate success: 500 (Internal Server Error).
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at Litium.Connect.Application.Payments.PaymentProviderClient.SendAsJsonAsync[T](HttpClient httpClient, HttpMethod httpMethod, Uri uri, Object payload, CancellationToken cancellationToken)
at Litium.Connect.Application.Payments.PaymentProviderClient.CaptureAsync(Guid paymentSystemId, CaptureRequest capture, CancellationToken cancellationToken)
at Litium.Connect.Application.Payments.PaymentTransactionsProcessorImpl.Process(PaymentTransactionArgs args)
at Litium.Connect.Application.Payments.PaymentTransactionsProcessorImpl.<Litium.Runtime.IAsyncAutostart.StartAsync>b__13_0(ServiceBusMessage`1 x)
at Litium.Application.ServiceBus.LocalServiceBusFactoryImpl.LocalQueue`1.<>c__DisplayClass6_0.<.ctor>b__0(ServiceBusMessage`1 x)
at Litium.Application.ServiceBus.LocalServiceBusFactoryImpl.LocalQueue`1.<Send>b__8_0()
at Litium.Application.Common.FifoExecution.WorkItem.Execute()
at Litium.Application.Common.FifoExecution.ProcessQueuedItems(Object ignored)
NilsN
May 17, 2022, 1:27pm
5
The app is returning a 500 response, what does the app log about the error?
system
Closed
June 14, 2022, 1:27pm
6
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.