Currently, we have a batch process that retrieves all cards stored in Authorize.net and creates corresponding Payment Profile records. This new requirement involves creating an invocable class that pulls card information from Authorize.net for a specific customer using their Customer ID.
Invocable Class Requirements
The invocable class will handle the following tasks:
-
Parameters
-
Account Id
-
Contact Id
-
-
Retrieve CustomerProfileId
-
If the account/contact has existing Payment Profiles, retrieve the CustomerProfileId from the fw1__Customer_Profile_ID__c field.
-
If no profiles exist, make an API call using Account.fw1__Merchant_Customer_Id__c to fetch the CustomerProfileId:
string getCustomerProfileId(string merchantCustomerId)
-
If the system fails to obtain the CustomerProfileId, exit the process.
-
-
Fetch Payment Profiles
-
Call Authorize.net to retrieve payment profiles using:
List<fw1__PaymentProfile__c> getCustomerProfile(string customerProfileId)
-
-
Process Payment Profiles
-
For each Payment Profile returned in the response:
a. Verify if the customer already has an existing fw1__PaymentProfile__c record by comparing the Token.
b. If the Payment Profile exists:
-
Update the Network Transaction Id.
-
Update the Original Authorize Amount with the values from the response.
c. If the Payment Profile does not exist:
-
Insert the profile.
-
Ensure the Account and Contact fields are populated.
-
-
Availability: Winter '25