Skip to content

Instantly share code, notes, and snippets.

@lifedraft
Last active May 6, 2021 12:58
Show Gist options
  • Save lifedraft/74ca4a5b3d757d0b3fbcad75345b4880 to your computer and use it in GitHub Desktop.
Save lifedraft/74ca4a5b3d757d0b3fbcad75345b4880 to your computer and use it in GitHub Desktop.
Billing
Billing
FetchBilling
# context:
# addresses: (filtered for tenant)
# isFilterd: if empty addresses
# billingAddress (prefill: registrationData | profile | cart billingAddress)
# selection: uuid | new billing address
done -> Guard
Guard
withoutAddresses -> WithoutAddresses
withAddresses -> WithAddresses
WithoutAddresses
Idle*
# billingAddress = billingAddress
# selection: billingAddress
submit -> UpdateBillingService
UpdateBillingService
# => arguments:
# selection: uuid | new billing address;
# addressUUID: uuid;
# billingAddress: CartAddress
# => formValidation!!!
# * different validators per tenant
# * logged in state
# * email not overrideable => should be taken from profile
# * city, zip, country should be validated for shipping required.
# => error on unavailable uuid.
# => setPayment with in the mutation
done -> Success
fail -> Idle
WithAddresses
IdleWithAddress*
# addressUUID = uuid
# selection: uuid
selectAddress -> UpdateBillingServiceWithAddress
# billingAddress = billingAddress
# selection: billingAddress
updateBillingAddres -> UpdateBillingServiceWithAddress
UpdateBillingServiceWithAddress
done -> Success
fail -> IdleWithAddress
Success
function render(model){
let current_state_name = model.active_states[0].name;
return $("h1",
{style: {color: "darkBlue"}},
`The current state is: ${current_state_name}`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment