Loading

Decommissioning Heroku in B2B and D2C Commerce Reference Samples

Udgivelsesdato: Aug 26, 2024
Beskrivelse
On September 15, 2023, we are decommissioning a Heroku service used in some B2B and D2C Commerce samples.  The service was accessible at https://b2b-commerce-test-herokuapp.com, and it was typically used to mock up a reply from an external service.  For example, here's an Apex code snippet showing how this service was used to mock a service call:
 

getShippingOptionsAndRatesFromExternalService (Integer numberOfUniqueItems) {

   final Integer SuccessfulHttpRequest = 200;

 

   ShippingOptionsAndRatesFromExternalService[] shippingOptions =
    new List<ShippingOptionsAndRatesFromExternalService>();

 

   Http http = new Http();

   HttpRequest request = new HttpRequest();

   // To access the service below, you may need to add
  // endpoint = https://b2b-commerce-test.herokuapp.com in
  // Setup | Security | Remote site settings.

 

   request.setEndpoint(
'https://b2b-commerce-test.herokuapp.com/calculate-shipping-rates-winter-21');

   request.setMethod('GET');

   HttpResponse response = http.send(request);

 

Several sample Apex files using this service were deployed into orgs using the Salesforce Commerce CLI. If you use any of the samples in your org, replace them as soon as possible, because the samples will no longer work once the service is decommissioned.
 


 
Løsning

To get the latest samples, which have removed all references to this service and instead mock up external service responses as static responses, navigate to the following repos and pull the latest changes:

https://github.com/forcedotcom/commerce-on-lightning/

If you deployed any of the samples to your development or production orgs, please redeploy the updated samples. And if you used any of these samples as the basis for your own classes, please refactor your classes to remove any references to the decommissioned Heroku service.
 

If you would like to enable an external service, update the sample classes and deploy your own copy of the Heroku service. The Heroku service can now be deployed, modified, or updated from this public repo.

https://github.com/forcedotcom/commerce-heroku-sample-response

 

1. Update the Apex class.

2. Replace the example reference (https://example.com) with your Heroku URL.

3. Add the host to Setup > Security > Remote Site Settings.

4. Update useHTTPService to true.

 

Vidensartikelnummer

000396217

 
Indlæser
Salesforce Help | Article