Redirect Payment Provider Clean Up

Let's say you're having issues with Associates being created that have never paid and/or can no longer pay their fees, or you have orders that are waiting for payment that'll never be paid.

This solution will show you some ways to remove these Associates and orders, as well as limit the Associate's access.

Removing the defunct Associates from the system allows them to try and enroll again, freeing up their Email Address and TaxID.



Creating an Unpaid Status

Create a new "Unpaid" status.

In Corporate Admin, navigate to: Administration > Associate Statuses.

To add a new status:

  1. Click + Add Associate Status.

  2. In the modal, complete the configuration to your preference.

    What do you want to happen when the Associate can no longer pay?

    For example, some may choose to have the Status Class be inactive, Commission Status be Hold, and to Cancel Subscriptions, Cancel AutoShip, Remove from Trees, and Delete Login.

    The choice is up to you.

  3. Click Save to close the modal and add the new status.

This Associate's status is added to the CRM_AssociateStatus table.

View the table with the Data Editor and take note of the recordnumber in the table of the new status; it's important and will be used later.



WriteApplication Hook

  1. In your Extension, use the WriteApplication Hook.
  2. Before running the base functionality, check to see if the payment on this application comes from the redirect method.
  3. If it does, adjust the request object.
Application.StatusID = {New Status recordnumber}

Replace {New Status recordnumber} with the recordnumber noted from the CRM_AssociateStatus table.



FinalizeAcceptedOrder Hook

  1. Use the FinalizeAcceptedOrder Hook.
  2. Check if the Associate's status is the {New Status recordnumber}.
  3. Adjust the status to 1.
var associateSummary = _associateService.GetAssociates(order.AssociateId);
    if (GetAssociates.StatusId == {New Status recordnumber}
)
    {
        _associateService.SetAssociateStatus(order.AssociateId, 1); 
    }
}

The methods you'll use both come from the AssociateService. GetAssociates() and SetAssociateStatus().



DailyRun Hook

Use the DailyRun Hook.

  1. Look up the latest orders or signups by using the Database string or OrderService to read Orders and Associates.
  2. Check the Associates/orders statuses and remove them.