[ECOMMERCE-486] Salesforce-Should add the authorization in header for Cart/Checkout endpoint Created: 21/Oct/21  Updated: 18/Oct/22  Resolved: 03/Mar/22

Status: Closed
Project: E-commerce
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Thuy To Assignee: Unassigned
Resolution: Obsolete Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File [Salesforce Commerce] Ecommerce-Endpoint.postman_collection.json     PNG File image-2021-10-21-11-30-15-916.png    
Issue Links:
relation
is related to ECOMMERCE-467 DEV DOC: Review and test endpoint doc... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Epic Link: AuthorX Maintenance
Sprint: AuthorX 4
Story Points: 2

 Description   

Steps to reproduce

  1.  Run the rest endpoint of cart/checkout on postman [Salesforce Commerce] Ecommerce-Endpoint.postman_collection.json
  2.  Check all methods in SalesforceCartProvider and 
  3. Check and need to add the authorization to header in all methods of SalesforceCartProvider.java and SalesforceCheckoutProvider.java 

Expected results

Run the rest endpoint of cart/checkout on postman successfully.

Actual results

+ Miss the authorization in header of getByCartId method in SalesforceCartProvider.java

+ Miss the authorization in header of all methods in SalesforceCheckoutProvider.java 

Workaround

Development notes

+ Maybe add the authorization in header like line 134 and 135 in below image:

 



 Comments   
Comment by Jesus Alonso [ 02/Mar/22 ]

Hey thuy.to , for what I can see in code, getByCartId and all the methods in SalesforceCheckoutProvider, use the method executeRequestWithShopApi:

public HttpResponse executeRequestWithShopApi(String path, List<NameValuePair> nameValuePairs, HttpRequestBase httpRequestBase) throws IOException, URISyntaxException {
    URI uri = new URIBuilder(connection.getBaseUrl()).setPath(path).addParameters(nameValuePairs).build();
    httpRequestBase.setURI(uri);
    setRequestHeaders(httpRequestBase);
    return client.execute(httpRequestBase);
}

private void setRequestHeaders(HttpRequestBase httpRequestBase) {
    httpRequestBase.addHeader(HttpHeaders.ACCEPT, APPLICATION_JSON);
    httpRequestBase.addHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON);
    if (!httpRequestBase.containsHeader(HttpHeaders.AUTHORIZATION)) {
        httpRequestBase.addHeader(HttpHeaders.AUTHORIZATION, token);
    }
}
 

As you can see there we are setting the token.

Comment by Thuy To [ 03/Mar/22 ]

Hi jalonso , Thank you for your verification. We can close this ticket. :bow: 🙇‍♀️ 

Comment by Jesus Alonso [ 03/Mar/22 ]

Not an issue

Generated at Mon Feb 12 01:44:33 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.