3.4 Watch it fail
Start the application again:
dotnet run --urls http://localhost:5080Place an order:
curl -X POST http://localhost:5080/orders -H 'Content-Type: application/json' \
-d '{"customerId":"ada","paymentToken":"tok_visa","lines":[{"sku":"MUG","quantity":1}]}'{"orderId":"03cfec30-1b48-4a08-805b-12fb5f530311","total":12.00,"transactionId":"tx_4ba708d1","receiptUrl":"https://pay.example/receipts/tx_4ba708d1?key=c265bec1af1b47f5abf2f4c90daeb9d6"}The customer gets the receipt link. Now pay with the declined token:
curl -X POST http://localhost:5080/orders -H 'Content-Type: application/json' \
-d '{"customerId":"ada","paymentToken":"tok_chargeDeclined","lines":[{"sku":"TEE","quantity":3}]}'"The card was declined."That is a 422, and the log shows the three T-shirts going back:
info: Shopfront.Trains.PlaceOrder.Junctions.TakePaymentJunction[0]
Released reservation 568df86f-59b2-437a-ab72-797459564555
fail: Trax.Effect.Services.ServiceTrain.ServiceTrain[0]
Caught Exception (Trax.Core.Exceptions.TrainException) with Message (The card was declined.).Place four more orders of one mug with tok_visa. The provider answers three of them, and the
fourth, its fifth charge since the application started, times out with a 500:
info: Shopfront.Trains.PlaceOrder.Junctions.TakePaymentJunction[0]
Released reservation 26db9cae-1c44-47f8-a9aa-0f0d701ab713
fail: Trax.Effect.Services.ServiceTrain.ServiceTrain[0]
Caught Exception (System.TimeoutException) with Message (The payment provider did not answer.).SDK Reference
UsePostgres | SaveTrainParameters | AddJunctionLogger | TraxSensitive | IFailureClassifier | Metadata
Next: 3.5 Read the runs back