Skip to content

Commit 753af54

Browse files
authored
Merge pull request #126 from Southern-Exposure-Seed-Exchange/wip/s-and-witch/customer-validation
Add customer validation endpoint for stripe
2 parents 04cedf9 + 1439482 commit 753af54

File tree

3 files changed

+252
-60
lines changed

3 files changed

+252
-60
lines changed

client/src/Data/Api.elm

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ module Data.Api exposing
22
( Endpoint(..), get, post, put, patch, delete
33
, withJsonBody, withStringResponse, withJsonResponse, withStringErrorHandler, withErrorHandler
44
, sendRequest
5-
, FormErrors, initialErrors, addError, addErrors, prefixedArrayErrors
5+
, FormErrors, initialErrors, addError, prefixedArrayErrors
66
, apiFailureToError, formErrorsDecoder
77
, errorHtml, generalFormErrors, getErrorHtml
8+
, addErrors
89
)
910

1011
{-|
@@ -79,8 +80,10 @@ type Endpoint
7980
| CheckoutPlaceOrderAnonymous
8081
| CheckoutSuccess
8182
| GuestCheckoutSuccess
82-
| CheckoutHelcimToken
83-
| CheckoutHelcimTokenAnonymous
83+
| HelcimValidateCheckout
84+
| HelcimValidateCheckoutAnonymous
85+
| StripeValidateCheckout
86+
| StripeValidateCheckoutAnonymous
8487
| AdminCategoryList
8588
| AdminNewCategory
8689
| AdminEditCategoryData CategoryId
@@ -244,12 +247,18 @@ toUrl endpoint =
244247
GuestCheckoutSuccess ->
245248
joinPath [ "checkout", "anonymous-success" ]
246249

247-
CheckoutHelcimToken ->
250+
HelcimValidateCheckout ->
248251
joinPath [ "checkout", "helcim-checkout-token" ]
249252

250-
CheckoutHelcimTokenAnonymous ->
253+
HelcimValidateCheckoutAnonymous ->
251254
joinPath [ "checkout", "anonymous-helcim-checkout-token" ]
252255

256+
StripeValidateCheckout ->
257+
joinPath [ "checkout", "validate-customer-details" ]
258+
259+
StripeValidateCheckoutAnonymous ->
260+
joinPath [ "checkout", "validate-anonymous-customer-details" ]
261+
253262
AdminCategoryList ->
254263
joinPath [ "admin", "categories", "list" ]
255264

@@ -582,6 +591,7 @@ addError : Field -> ErrorMessage -> FormErrors -> FormErrors
582591
addError field message errors =
583592
addErrors field [ message ] errors
584593

594+
585595
addErrors : Field -> List ErrorMessage -> FormErrors -> FormErrors
586596
addErrors field messages errors =
587597
(\a -> Dict.update field a errors) <|

0 commit comments

Comments
 (0)