affresco icon indicating copy to clipboard operation
affresco copied to clipboard

Address form for paper products

Open vapaj opened this issue 4 years ago • 0 comments

In order to support paper products, we need to know the first name, last name and address of the customer. We should add this step after we register the new customer (or login an existing customer) but before we create any payments to Nets (if/when credit card is used).

When creating an order to Bottega (POST /order), the server will return an descriptive error message if it was unable to perform the wanted action due to missing account details. If we encounter this HTTP error, we should render the address form. What the HTTP error actually looks like is not yet decided 🤠

We should parse the error here https://github.com/KSF-Media/affresco/blob/master/packages/vetrina/src/Vetrina/Vetrina.purs#L465-L477 and add an approriate constructor for the OrderFailure type (perhaps called InsufficientAccount). We should set the state.purchaseState to PurchaseFailed InsufficientAccount here whenever this error occurs.

After the account has been updated, we should run the same POST /order call which previously failed and follow the normal flow.

vapaj avatar Nov 26 '20 12:11 vapaj