Skip to content

Commit 28207bc

Browse files
authored
[Shopify] Compare scopes one by one in case order changes from Shopify (#5724)
<!-- Thank you for submitting a Pull Request. If you're new to contributing to BCApps please read our pull request guideline below * https://github.com/microsoft/BCApps/Contributing.md --> #### Summary <!-- Provide a general summary of your changes --> Compare scopes one by one in case order changes from Shopify #### Work Item(s) <!-- Add the issue number here after the #. The issue needs to be open and approved. Submitting PRs with no linked issues or unapproved issues is highly discouraged. --> Fixes AB#615465
1 parent 6efdab6 commit 28207bc

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/Apps/W1/Shopify/App/src/Integration/Codeunits/ShpfyAuthenticationMgt.Codeunit.al

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,22 @@ codeunit 30199 "Shpfy Authentication Mgt."
213213
internal procedure CheckScopeChange(Shop: Record "Shpfy Shop"): Boolean
214214
var
215215
RegisteredStoreNew: Record "Shpfy Registered Store New";
216+
ActualScopes: List of [Text];
217+
RequestedScopes: List of [Text];
218+
Scope: Text;
216219
begin
217-
if RegisteredStoreNew.Get(Shop.GetStoreName()) then
218-
exit(RegisteredStoreNew."Actual Scope" <> GetScope());
220+
if not RegisteredStoreNew.Get(Shop.GetStoreName()) then
221+
exit(false);
222+
223+
ActualScopes := RegisteredStoreNew."Actual Scope".Split(',');
224+
RequestedScopes := GetScope().Split(',');
225+
226+
if ActualScopes.Count() <> RequestedScopes.Count() then
227+
exit(true);
228+
229+
foreach Scope in RequestedScopes do
230+
if not ActualScopes.Contains(Scope) then
231+
exit(true);
219232

220233
exit(false);
221234
end;

0 commit comments

Comments
 (0)