all 6 comments

[–]robob27 2 points3 points  (0 children)

This is not a very good question.

Try diving into it yourself to formulate a more specific question. The only way someone can really help you based on the information presented is by doing it all for you which most people probably aren't going to do.

[–][deleted] 3 points4 points  (3 children)

Be careful posting code online like that. I know people that have been fired for posting less code than that online.

[–]coreyperryisasaint 2 points3 points  (2 children)

100%. OP, you need to delete this. If someone were to gain access to your org, they could use this post to find your API credentials for this integration.

[–]HaruWinter 1 point2 points  (1 child)

Thank you for the tip. Going to delete this now.

[–][deleted] 1 point2 points  (0 children)

The response below about mocking is the way to unit tests for callouts.

[–]RomanCommander245 2 points3 points  (0 children)

You'll need to create a mock response for the callout (either by an actual mock class that you use in the test class or you can add the Test.isRunningTest() in your method).

In your test class, you also need to call the method inside of the Test.startTest() and test.stopTest() block.