Modular logistics and supply chain operating system (LSOS)
JavaScript driver-appfleet-managementfreight-managementinfrastructureinventory-managementlast-mile-deliverylogisticsondemandopen-sourceorder-managementroute-optimizationsupply-chain-managementtracking-and-monitoringtransport-management-systemtransportationwarehouse-management
ci(api-contract): order the checkout chain and fix two storefront fixtures
Ronald A. Richardson388a191176db
diff --git a/.github/actions/postman-contract/action.yml b/.github/actions/postman-contract/action.ymlindex 433a3168..25d7a96f 100644--- a/.github/actions/postman-contract/action.yml+++ b/.github/actions/postman-contract/action.yml@@ -336,6 +336,7 @@ runs:' --env-var "customer_name=Jane Customer" \' \' --env-var "customer_password=${CUSTOMER_PASSWORD}" \' \' --env-var "customer_phone=${CUSTOMER_PHONE}" \' \+ ' --env-var "[email protected]" \' \' --env-var "verification_code=${VERIFICATION_CODE}" \' \' --env-var "driver_identity=${DRIVER_IDENTITY}" \' \' --env-var "driver_password=${DRIVER_PASSWORD}" \' \diff --git a/scripts/ci/mint-api-key.php b/scripts/ci/mint-api-key.phpindex b10989e2..a47da051 100644--- a/scripts/ci/mint-api-key.php+++ b/scripts/ci/mint-api-key.php@@ -150,8 +150,30 @@ try {// storefront_create_customer ::create code + for + meta->identity// storefront_account_closure ::confirmClosure code + for + meta->identity$seedVerificationCode('storefront_login');- $seedVerificationCode('storefront_create_customer', ['identity' => $customerIdentity]);- $seedVerificationCode('storefront_account_closure', ['identity' => $customerIdentity]);+ // Filed under the PHONE, not the email: confirmAccountClosure computes the identity it+ // looks up as `$user->phone ?? $user->email`, and the seeded customer has a phone. A+ // code filed under the email was never found — "Invalid verification code provided!".+ $seedVerificationCode('storefront_account_closure', ['identity' => $customerPhone]);++ // Create a Customer needs an identity with NO existing contact: the request validates+ // `email` with Rule::unique('contacts'), and by the time it runs the seeded customer's+ // contact exists — "The email has already been taken." So the creation code is filed+ // under a second identity reserved for exactly that, and deliberately left without a+ // contact of its own.+ $newCustomerIdentity = getenv('CI_NEW_CUSTOMER_IDENTITY') ?: '[email protected]';++ \Fleetbase\Models\VerificationCode::withoutGlobalScopes()+ ->where(['subject_uuid' => $customer->uuid, 'for' => 'storefront_create_customer'])+ ->delete();+ $createCode = \Fleetbase\Models\VerificationCode::generateFor($customer, 'storefront_create_customer', false);+ $createCode->expires_at = \Illuminate\Support\Carbon::now()->addDay();+ $createCode->meta = ['identity' => $newCustomerIdentity];+ $createCode->status = 'active';+ $createCode->save();+ $createCode->code = $customerCode;+ $createCode->save();++ echo 'SEEDED_NEW_CUSTOMER_IDENTITY=' . $newCustomerIdentity . PHP_EOL;// The Storefront API authenticates with a store/network key, not an organization// API credential: SetStorefrontSession rejects any bearer token that does not startdiff --git a/scripts/ci/order-collection-requests.py b/scripts/ci/order-collection-requests.pyindex f48871d3..6a8d6ef3 100755--- a/scripts/ci/order-collection-requests.py+++ b/scripts/ci/order-collection-requests.py@@ -64,9 +64,17 @@ RUN_LATE = {'Orders/Update an Order', # needs {{service_quote_id}} from Service Quotes/Query Service Quotes],'Fleetbase Storefront API': [+ # The cart has to be populated before anything prices or checks out against it,+ # and emptied only once those are done. Deferring just the three Cart requests+ # left Checkout running against an empty cart — "The selected cart is invalid."'Cart/Add Item to Cart', # needs {{product_id}} from Products/Create Product'Cart/Update item in Cart', # needs the line item Add Item to Cart creates- 'Cart/Remove item from cart', # ditto+ 'Delivery Service Quote/Retrieve a Delivery Service Quote ❗', # prices the cart+ 'Checkout/Before ❗', # needs the cart AND {{service_quote_id}}+ 'Checkout/Capture checkout as order', # needs {{checkout_token}} from Before+ 'Checkout/Get Checkout Status', # ditto+ 'Checkout/Update Stripe Payment Intent', # needs the cart and the service quote+ 'Cart/Remove item from cart', # LAST: it empties what the above depend on],}