Skip to content

Commit

Permalink
Merge d357dcc into feature/242__rd2BatchUpdateBGE
Browse files Browse the repository at this point in the history
  • Loading branch information
salesforce-org-metaci[bot] authored Nov 9, 2022
2 parents d614d72 + d357dcc commit 980bcf1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion force-app/main/default/classes/PS_CommitmentRequest.cls
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ public inherited sharing class PS_CommitmentRequest {

private Map<String, Object> getElevateCommitment(String commitmentId) {
HttpRequest commitmentGetRequest = buildRequest(commitmentId, UTIL_Http.Method.GET,
PS_Request.ElevateEndpoint.COMMITMENT);
PS_Request.ElevateEndpoint.COMMITMENT_GET);
UTIL_Http.Response response = requestService.sendRequest(commitmentGetRequest);

Map<String, Object> responseBody = (Map<String, Object>) JSON.deserializeUntyped(response.body);
Expand Down
11 changes: 10 additions & 1 deletion force-app/main/default/classes/PS_Request.cls
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public inherited sharing class PS_Request {
REFUND,
TRANSACTIONS,
COMMITMENT,
COMMITMENT_GET,
COMMITMENT_PAUSE,
COMMITMENT_CANCEL,
COMMITMENT_UPDATE_BULK,
Expand Down Expand Up @@ -83,6 +84,7 @@ public inherited sharing class PS_Request {
public static String ENDPOINT_REFUND = '/v1/payments/verified/refund';
public static String ENDPOINT_TRANSACTIONS = '/v1/payments/verified/transactions/{0}';
public static String ENDPOINT_COMMITMENT = '/v1/payments/verified/commitments';
public static String ENDPOINT_COMMITMENT_GET = '/v1/payments/verified/commitments/{0}';
public static String ENDPOINT_COMMITMENT_CANCEL = '/v1/payments/verified/commitments/{0}/cancel';
public static String ENDPOINT_COMMITMENT_UPDATE_BULK = '/v1/payments/verified/commitments/update/bulk';
public static String ENDPOINT_CREATE_ELEVATE_BATCH = '/v1/payments/verified/batch';
Expand Down Expand Up @@ -273,7 +275,13 @@ public inherited sharing class PS_Request {
);
} else if (endpoint == ElevateEndpoint.COMMITMENT) {
value = ENDPOINT_COMMITMENT;

} else if (endpoint == ElevateEndpoint.COMMITMENT_GET) {
value = String.format(
ENDPOINT_COMMITMENT_GET,
new String[]{
commitmentId
}
);
} else if (endpoint == ElevateEndpoint.COMMITMENT_PAUSE) {
value = String.format(
ENDPOINT_COMMITMENT_PAUSE,
Expand Down Expand Up @@ -458,6 +466,7 @@ public inherited sharing class PS_Request {
private Boolean isCommitmentEndpoint () {
return endpoint == ElevateEndpoint.COMMITMENT
|| endpoint == ElevateEndpoint.COMMITMENT_CANCEL
|| endpoint == ElevateEndpoint.COMMITMENT_GET
|| endpoint == ElevateEndpoint.COMMITMENT_UPDATE_BULK
|| endpoint == ElevateEndpoint.COMMITMENT_PAUSE;
}
Expand Down
5 changes: 3 additions & 2 deletions force-app/main/default/classes/PS_Request_TEST.cls
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ private with sharing class PS_Request_TEST {
Test.startTest();
HttpRequest request = new PS_Request.Builder()
.withMethod(UTIL_Http.Method.GET)
.withEndpoint(PS_Request.ElevateEndpoint.COMMITMENT)
.withEndpoint(PS_Request.ElevateEndpoint.COMMITMENT_GET)
.withCommitmentId(COMMITMENT_ID)
.build();
Test.stopTest();

final String jsonRequestBody = '';
final String expectedEndpoint = PS_IntegrationServiceConfig_TEST.testBaseUrl
+ PS_Request.ENDPOINT_COMMITMENT;
+ PS_Request.ENDPOINT_COMMITMENT + '/' + COMMITMENT_ID;

assertRequest(request, expectedEndpoint, UTIL_Http.Method.GET, jsonRequestBody);
}
Expand All @@ -144,6 +144,7 @@ private with sharing class PS_Request_TEST {

} else if (endpoint == PS_Request.ElevateEndpoint.COMMITMENT
|| endpoint == PS_Request.ElevateEndpoint.COMMITMENT_CANCEL
|| endpoint == PS_Request.ElevateEndpoint.COMMITMENT_GET
|| endpoint == PS_Request.ElevateEndpoint.COMMITMENT_PAUSE
|| endpoint == PS_Request.ElevateEndpoint.COMMITMENT_UPDATE_BULK) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ public without sharing class RD2_CancelCommitmentService {
request = PS_CommitmentRequest.buildRequest(closedRecord.rd.CommitmentId__c,
UTIL_Http.Method.POST, PS_Request.ElevateEndpoint.COMMITMENT_CANCEL);
}
else if (getRequestType(closedRecord) == PS_Request.ElevateEndpoint.COMMITMENT) {
else if (getRequestType(closedRecord) == PS_Request.ElevateEndpoint.COMMITMENT_GET) {
request = PS_CommitmentRequest.buildRequest(closedRecord.rd.CommitmentId__c,
UTIL_Http.Method.GET, PS_Request.ElevateEndpoint.COMMITMENT);
UTIL_Http.Method.GET, PS_Request.ElevateEndpoint.COMMITMENT_GET);
}
response = requestService.sendRequest(request);

Expand All @@ -152,7 +152,7 @@ public without sharing class RD2_CancelCommitmentService {
PS_Request.ElevateEndpoint requestType = PS_Request.ElevateEndpoint.COMMITMENT_CANCEL;

if (hasPreviousTimeoutOrConflict(closedRecord)) {
requestType = PS_Request.ElevateEndpoint.COMMITMENT;
requestType = PS_Request.ElevateEndpoint.COMMITMENT_GET;
}

return requestType;
Expand Down

0 comments on commit 980bcf1

Please sign in to comment.