Skip to content

Commit

Permalink
fixing oobo pbl error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhamk67 committed Jan 16, 2025
1 parent a0e203d commit 5cabb76
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 58 deletions.
4 changes: 2 additions & 2 deletions force-app/main/default/classes/AdyenOOBOController.cls
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public with sharing class AdyenOOBOController {
if (contactRecords.size() >= 1) {
return new AccountEmailAndName(contactRecords[0].Name, contactRecords[0].Email);
} else {
throw new AuraHandledException('No contact found for this account id ' + accountId);
throw new HandledException('No contact found for this account id ' + accountId);
}
}
} catch (Exception ex) {
Expand All @@ -63,4 +63,4 @@ public with sharing class AdyenOOBOController {
this.email = email;
}
}
}
}
11 changes: 8 additions & 3 deletions force-app/main/default/classes/AdyenOOBOControllerTest.cls
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,15 @@ public class AdyenOOBOControllerTest {
@IsTest
static void getExpiryDurationTest() {
// given
Decimal currentExpiryDays = [SELECT Payment_Link_Expiry_Duration__c FROM Adyen_Adapter__mdt WHERE DeveloperName = :AdyenConstants.DEFAULT_ADAPTER_NAME].Payment_Link_Expiry_Duration__c;
// when
Decimal expireDays = AdyenOOBOController.getExpiryDuration();
Decimal fetchedExpiryDays = AdyenOOBOController.getExpiryDuration();
// then
Assert.areEqual(1, expireDays);
if(currentExpiryDays == null) {
Assert.areEqual(1, fetchedExpiryDays);
} else {
Assert.areEqual(currentExpiryDays, fetchedExpiryDays);
}
}

@IsTest
Expand All @@ -72,4 +77,4 @@ public class AdyenOOBOControllerTest {
Assert.isInstanceOfType(ex, AuraHandledException.class);
}
}
}
}
Loading

0 comments on commit 5cabb76

Please sign in to comment.