-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@W-14146755 lwrShippingItegSupportMGD #262
base: develop
Are you sure you want to change the base?
Conversation
Thanks for the contribution! It looks like @gkirpichnikov is an internal user so signing the CLA is not required. However, we need to confirm this. |
List<CartItem> cartItems = new List<CartItem>([SELECT CartDeliveryGroupId FROM CartItem WHERE CartId = :cartId]); | ||
|
||
Set<Id> cartDeliveryGroupsIDs = new Set<Id>(); | ||
for(CartItem curCartItem : cartItems){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not do this. For large cart, this loop is very expensive. You should query from cartDeliveryGroup table directly to get cartDeliveryGroup IDs
SELECT Id from CartDeliveryGroup WHERE CartId = :cartId
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wei-liu-salesforce fixed (the flip side, we will now add methods to delivery groups even those that possibly have no items, but that is less an issue for demo code, as those are limited to 20)
@@ -30,12 +35,20 @@ global class B2CDeliverySample implements sfdc_checkout.CartShippingCharges { | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How many times you call shippingOptionsAndRatesFromExternalService()? once or in a loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wei-liu-salesforce once
@@ -82,6 +90,9 @@ global class B2CDeliverySample implements sfdc_checkout.CartShippingCharges { | |||
request.setEndpoint(httpHost + '/calculate-shipping-rates-winter-21-with-lang?lang=' + siteLanguage); | |||
request.setMethod('GET'); | |||
HttpResponse response = http.send(request); | |||
|
|||
System.debug('gal>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove debug
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gurpreetsainisalesforce done, thanks!
} | ||
|
||
|
||
@isTest static void testIntegrationRunsSuccessfully() { | ||
Test.startTest(); | ||
init(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
init() is also called from setup()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gurpreetsainisalesforce I'm aware, unfortunately those common 'static' variables in apex are actually 'null' if not explicitly populated; may be it use a different instance to run the setup and to run the test - not sure, anyway it is null whence the init is not called from the test
for (ShippingOptionsAndRatesFromExternalService shippingOption: shippingOptionsAndRatesFromExternalService) { | ||
populateCartDeliveryGroupMethodWithShippingOptions(shippingOption, cartDeliveryGroupId, cartId); | ||
for(CartDeliveryGroup curCartDeliveryGroup : cartDeliveryGroups){ | ||
populateCartDeliveryGroupMethodWithShippingOptions(shippingOption, curCartDeliveryGroup.Id, cartId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here before populating the cartDeliveryGroupMethods for a deliveryGroup, we need to check if there are any cartItems in the deliveryGroup, else we will have ShippingMethods for an emptyDeliveryGroup which is confusing
Hello @gkirpichnikov , what is the status with this work? I am ready to integrate this if everything is ready. |
@W-14146755 lwrShippingItegSupportMGD
https://gus.lightning.force.com/a07EE00001anW4xYAE
What does this PR do?
@W-14146755 lwrShippingItegSupportMGD
What issues does this PR fix or reference?
#, @@
@W-14146755 lwrShippingItegSupportMGD
https://gus.lightning.force.com/a07EE00001anW4xYAE
Functionality Before
<insert gif and/or summary>
Functionality After
<insert gif and/or summary>
How to Test/Testing Effort
<insert gif and/or summary>
The test is included in the PR