feat: [MP-2900-2905] - allow removal promotion rows in express checkout and prevent close modal#6980
Conversation
…ents Co-authored-by: Copilot <[email protected]>
…press-checkout'' into feature/mp-2900-2905-allow-removal-promotion-rows-in-express-checkout
| * caller can surface a tip message. | ||
| */ | ||
| export async function removeBasketCredit({ apollo, basketId, creditType }) { | ||
| const { errors } = await apollo.mutate({ |
There was a problem hiding this comment.
We also have this available from kv-shop https://github.com/kiva/kv-ui-elements/blob/main/%40kiva/kv-shop/src/basketCredits.ts#L32
There was a problem hiding this comment.
https://github.com/kiva/kv-ui-elements/blob/main/%40kiva/kv-shop/src/validatePreCheckout.ts#L7 may also be useful as you get closer to the actual checkout.
There was a problem hiding this comment.
good point, yeah I'm trying to get the same or similar flow in checkout, I will check how we are using the validate and what point there, thanks matt
There was a problem hiding this comment.
hey @mcstover , I can't use your recomendation https://github.com/kiva/kv-ui-elements/blob/main/%40kiva/kv-shop/src/basketCredits.ts#L32, because that method is not using the creditType and I need to specify the promo to remove, we could add a new ticket to update it later, what do you think?
There was a problem hiding this comment.
Thoughts on adding the parameter now? It would only take a few mins, and the package deploys quickly.
There was a problem hiding this comment.
did you try to pass null there?
It's true that UPC and redemption codes do have a value we can pass there... wonder what the php is doing within this mutation when it see's the new "admin_credit" type...
There was a problem hiding this comment.
It's ok to just skip using the global method if it's not working. We also use that mutation without any value in the ui version of checkoutUtils... so if that's working cool
There was a problem hiding this comment.
yes I did, I get the error: the mutation does not expect to receive redemptionCode argument
There was a problem hiding this comment.
I'm thinking we could use the mutation as already defined in this PR since it's relatively simple, and this feature is part of an experiment. It would definitely be good to move this entire feature (express checkout) into the component library if/when the experiment does well.
There was a problem hiding this comment.
agree, updating the global or using my new one, I'll just drop a comment in case we fix the global method and we could start using it,
I'll let you know @mcstover when I add validatePreCheckout query in this flow
thanks team!
…-rows-in-express-checkout
…5-allow-removal-promotion-rows-in-express-checkout
…-rows-in-express-checkout
…-rows-in-express-checkout
dyersituations
left a comment
There was a problem hiding this comment.
@cristhianDt changes are looking good. I'll functionally test once the validatePreCheckout method is in place and the dev DB sync is complete.
| validateBasket() { | ||
| checkInjections(this, injections); | ||
|
|
||
| return new Promise((resolve, reject) => { |
There was a problem hiding this comment.
@mcstover @dyersituations I moved this logic to this util file > src/util/checkout/checkoutValidationUtils.js, shared by this mixin and the new modal, lmk any doubt or comment, thanks
…-rows-in-express-checkout
…-rows-in-express-checkout
| logFormatter(`ExpressCheckoutModal validation failed: ${validationMessage}`, 'error'); | ||
| paying.value = false; | ||
| closeLightbox(); | ||
| router.push('/basket'); |
There was a problem hiding this comment.
I'm now seeing an error initially or a redirect to /basket when I test the latest changes locally.
There was a problem hiding this comment.
do you see any message in the console?, could you share a screenshot please
the idea is: if something happen during the verification step we redirect so I would like to check whether the reservation service or checkout service is failing again
did you try in the checkout page too?
There was a problem hiding this comment.
Yes the checkout page, testing express checkout. No specific error, but now I just get redirected to basket each time, meaning errors are happening. Please see if you can reproduce locally.
There was a problem hiding this comment.
@dyersituations I tested with 2 users and both pages are working correctly for those users, what is your user id?, let me try with your user
MP-2900-2905
Summary
https://www.figma.com/design/ARJWLwdnFJ84FNSvPX4wYz/Goals-V2?node-id=5831-98211&t=QSdzKl5WSyTatxBr-0
How test it
'kiva credit', add some credit to the user.
'promotion', there are two types 'bonu' and 'kiva promotion', in other words free credit and kiva card redemption
Evidences