Associate Hooks

Namespace: DirectScale.Disco.Extension.Hooks.Associates

GetSecondaryTitle

Get the Associate’s Secondary title that shows on their Detail page

Basic Implementation

public class GetSecondaryTitle : IHook<GetSecondaryTitleHookRequest, GetSecondaryTitleHookResponse>
{
  public GetSecondaryTitle() { }

  public GetSecondaryTitleHookResponse Invoke(GetSecondaryTitleHookRequest request, Func<GetSecondaryTitleHookRequest, GetSecondaryTitleHookResponse> func)
  {
    return func(request);
  }
}

Register Hook

services.AddTransient<IHook<GetSecondaryTitleHookRequest, GetSecondaryTitleHookResponse>, GetSecondaryTitle>();

Request Model

{
  "AssociateId": 0
}

Response Model

{
  "Title": "string",
}

GetAssociateServiceAutoshipSettings

Enables the service to automatically create an AutoShip. For example, you can set the default shipping method and it allows you to change what item gets set to AutoShip.

Basic Implementation

public class GetAssociateServiceAutoshipSettings : IHook<GetAssociateServiceAutoshipSettingsHookRequest, GetAssociateServiceAutoshipSettingsHookResponse>
{
  public GetAssociateServiceAutoshipSettings() { }

  public GetAssociateServiceAutoshipSettingsHookResponse Invoke(GetAssociateServiceAutoshipSettingsHookRequest request, Func<GetAssociateServiceAutoshipSettingsHookRequest, GetAssociateServiceAutoshipSettingsHookResponse> func)
  {
    return func(request);
  }
}

Register Hook

services.AddTransient<IHook<GetAssociateServiceAutoshipSettingsHookRequest, GetAssociateServiceAutoshipSettingsHookResponse>, GetAssociateServiceAutoshipSettings>();

Request Model

{
  "AssociateId": 0,
  "Service": {
    "SubscriptionId": 0,
    "ItemId": 0,
    "Period": 0,
    "PeriodType": 0,
    "GracePeriod": 0,
    "CreateAutoship": false,
    "YearlyRenewal": false
  }
}

Response Model

{
  "AutoshipSettings": {
    "ShipMethodId": 0,
    "OverriddenAutoshipItemId": 0
  }
}

OnNotificationEvent

Override the Log Notification Event that sends emails through Corporate Admin.

Basic Implementation

public class OnNotificationEvent : IHook<OnNotificationEventHookRequest, OnNotificationEventHookResponse>
{
  public OnNotificationEvent() { }

  public OnNotificationEventHookResponse Invoke(OnNotificationEventHookRequest request, Func<OnNotificationEventHookRequest, OnNotificationEventHookResponse> func)
  {
    return func(request);
  }
}

Register Hook

services.AddTransient<IHook<OnNotificationEventHookRequest, OnNotificationEventHookResponse>, OnNotificationEvent>();

Request Model

{
  "Notification": {
    "AssociateId": 0,
    "EventType": 0,
    "EventValue": {},
    "EntryDate": "0001-01-01T00:00:00",
    "EventDate": "0001-01-01T00:00:00"
  }
}

Response Model

{
  "NotificationEvent": {
    "SendEmail": false,
    "EmailAddress": "string",
    "Subject": "string",
    "Body": "string"
  }
}

UpdateAssociate

Override editing an Associate record. By default, the Edit Associate page validates, updates the record, and notifies the system of the change.

Important: Do not remove the asterisk (*) from the Tax field.

Basic Implementation

public class UpdateAssociate : IHook<UpdateAssociateHookRequest, UpdateAssociateHookResponse>
{
  public UpdateAssociate() { }

  public UpdateAssociateHookResponse Invoke(UpdateAssociateHookRequest request, Func<UpdateAssociateHookRequest, UpdateAssociateHookResponse> func)
  {
    return func(request);
  }
}

Register Hook

services.AddTransient<IHook<UpdateAssociateHookRequest, UpdateAssociateHookResponse>, UpdateAssociate>();

Request Model

{
  "OldAssociateInfo": {
    "AssociateId": 0,
    "ShipAddress": {
      "Id": 0,
      "AddressLine1": "string",
      "AddressLine2": "string",
      "AddressLine3": "string",
      "City": "string",
      "State": "string",
      "PostalCode": "string",
      "CountryCode": "string"
    },
    "Address": {
      "Id": 0,
      "AddressLine1": "string",
      "AddressLine2": "string",
      "AddressLine3": "string",
      "City": "string",
      "State": "string",
      "PostalCode": "string",
      "CountryCode": "string"
    },
    "AcceptTerms": false,
    "AssociateBaseType": 0,
    "AssociateType": 0,
    "PriceGroup": 0,
    "AssociateTypeName": "string",
    "BackOfficeId": "string",
    "BirthDate": "0001-01-01T00:00:00",
    "CompanyName": "string",
    "DormantDate": "0001-01-01T00:00:00",
    "EmailAddress": "string",
    "Name": "string string",
    "DisplayFirstName": "string",
    "DisplayLastName": "string",
    "LegalFirstName": "string",
    "LegalLastName": "string",
    "RomanizedFirstName": "string",
    "RomanizedLastName": "string",
    "PrimaryPhone": "string",
    "SecondaryPhone": "string",
    "LanguageCode": "string",
    "ShipAttention": "string",
    "ShipPhone": "string",
    "SignupDate": "0001-01-01T00:00:00",
    "UpgradeDate": "0001-01-01T00:00:00",
    "SignupMethod": "string",
    "TaxExempt": false,
    "TaxId": "string",
    "TaxResaleNo": "string",
    "TeamId": 0,
    "TextNumber": "string",
    "ExternalId": "string",
    "StatusId": 0,
    "Void": false,
    "Custom": {
      "Field1": "string",
      "Field2": "string",
      "Field3": "string",
      "Field4": "string",
      "Field5": "string"
    }
  },
  "UpdatedAssociateInfo": {
    "AssociateId": 0,
    "ShipAddress": {
      "Id": 0,
      "AddressLine1": "string",
      "AddressLine2": "string",
      "AddressLine3": "string",
      "City": "string",
      "State": "string",
      "PostalCode": "string",
      "CountryCode": "string"
    },
    "Address": {
      "Id": 0,
      "AddressLine1": "string",
      "AddressLine2": "string",
      "AddressLine3": "string",
      "City": "string",
      "State": "string",
      "PostalCode": "string",
      "CountryCode": "string"
    },
    "AcceptTerms": false,
    "AssociateBaseType": 0,
    "AssociateType": 0,
    "PriceGroup": 0,
    "AssociateTypeName": "string",
    "BackOfficeId": "string",
    "BirthDate": "0001-01-01T00:00:00",
    "CompanyName": "string",
    "DormantDate": "0001-01-01T00:00:00",
    "EmailAddress": "string",
    "Name": "string string",
    "DisplayFirstName": "string",
    "DisplayLastName": "string",
    "LegalFirstName": "string",
    "LegalLastName": "string",
    "RomanizedFirstName": "string",
    "RomanizedLastName": "string",
    "PrimaryPhone": "string",
    "SecondaryPhone": "string",
    "LanguageCode": "string",
    "ShipAttention": "string",
    "ShipPhone": "string",
    "SignupDate": "0001-01-01T00:00:00",
    "UpgradeDate": "0001-01-01T00:00:00",
    "SignupMethod": "string",
    "TaxExempt": false,
    "TaxId": "string",
    "TaxResaleNo": "string",
    "TeamId": 0,
    "TextNumber": "string",
    "ExternalId": "string",
    "StatusId": 0,
    "Void": false,
    "Custom": {
      "Field1": "string",
      "Field2": "string",
      "Field3": "string",
      "Field4": "string",
      "Field5": "string"
    }
  }
}

Response Model

{}

GetAssociateTreeLabel

Override the Corporate Admin Associate’s Tree labels and colors.

The default labels and colors are set to:

  • Active - #F0AD4E
  • Nonactive - #D9534F
  • Retail - #15A7B4

Basic Implementation

public class GetAssociateTreeLabel : IHook<GetAssociateTreeLabelHookRequest, GetAssociateTreeLabelHookResponse>
{
  public GetAssociateTreeLabel() { }

  public GetAssociateTreeLabelHookResponse Invoke(GetAssociateTreeLabelHookRequest request, Func<GetAssociateTreeLabelHookRequest, GetAssociateTreeLabelHookResponse> func)
  {
    return func(request);
  }
}

Register Hook

services.AddTransient<IHook<GetAssociateTreeLabelHookRequest, GetAssociateTreeLabelHookResponse>, GetAssociateTreeLabel>();

Request Model

{
  "Associate": {
    "AssociateId": 0,
    "ShipAddress": {
      "Id": 0,
      "AddressLine1": "string",
      "AddressLine2": "string",
      "AddressLine3": "string",
      "City": "string",
      "State": "string",
      "PostalCode": "string",
      "CountryCode": "string"
    },
    "Address": {
      "Id": 0,
      "AddressLine1": "string",
      "AddressLine2": "string",
      "AddressLine3": "string",
      "City": "string",
      "State": "string",
      "PostalCode": "string",
      "CountryCode": "string"
    },
    "AcceptTerms": false,
    "AssociateBaseType": 0,
    "AssociateType": 0,
    "PriceGroup": 0,
    "AssociateTypeName": "string",
    "BackOfficeId": "string",
    "BirthDate": "0001-01-01T00:00:00",
    "CompanyName": "string",
    "DormantDate": "0001-01-01T00:00:00",
    "EmailAddress": "string",
    "Name": "string string",
    "DisplayFirstName": "string",
    "DisplayLastName": "string",
    "LegalFirstName": "string",
    "LegalLastName": "string",
    "RomanizedFirstName": "string",
    "RomanizedLastName": "string",
    "PrimaryPhone": "string",
    "SecondaryPhone": "string",
    "LanguageCode": "string",
    "ShipAttention": "string",
    "ShipPhone": "string",
    "SignupDate": "0001-01-01T00:00:00",
    "UpgradeDate": "0001-01-01T00:00:00",
    "SignupMethod": "string",
    "TaxExempt": false,
    "TaxId": "string",
    "TaxResaleNo": "string",
    "TeamId": 0,
    "TextNumber": "string",
    "ExternalId": "string",
    "StatusId": 0,
    "Void": false,
    "Custom": {
      "Field1": "string",
      "Field2": "string",
      "Field3": "string",
      "Field4": "string",
      "Field5": "string"
    }
  },
  "CommissionStats": null
}

Response Model

{
  "TreeLabel": "string"
}

GetAssociatesStats

Gets multiple Associate stats for a period.

Basic Implementation

public class GetAssociatesStats : IHook<GetAssociatesStatsHookRequest, GetAssociatesStatsHookResponse>
{
  public GetAssociatesStats() { }

  public GetAssociatesStatsHookResponse Invoke(GetAssociatesStatsHookRequest request, Func<GetAssociatesStatsHookRequest, GetAssociatesStatsHookResponse> func)
  {
    return func(request);
  }
}

Register Hook

services.AddTransient<IHook<GetAssociatesStatsHookRequest, GetAssociatesStatsHookResponse>, GetAssociatesStats>();

Request Model

{
  "AssociateIds": null,
  "Date": "0001-01-01T00:00:00"
}

Response Model

{
  "Stats": null
}

GetCommissionChecks

Hook for getting the summary of commission checks for a particular commission period. A commission check is the total amount paid on that commission run. It’s usually done electronically, but some clients could choose to print these checks.

Basic Implementation

public class GetCommissionChecks : IHook<GetCommissionChecksHookRequest, GetCommissionChecksHookResponse>
{
  public GetCommissionChecks() { }

  public GetCommissionChecksHookResponse Invoke(GetCommissionChecksHookRequest request, Func<GetCommissionChecksHookRequest, GetCommissionChecksHookResponse> func)
  {
    return func(request);
  }
}

Register Hook

services.AddTransient<IHook<GetCommissionChecksHookRequest, GetCommissionChecksHookResponse>, GetCommissionChecks>();

Request Model

{
  "AssociateId": 0,
  "PaymentTypeFilter": [],
  "PageSize": 0,
  "PageNumber": 0
}

Response Model

{
  "Checks": [],
  "TotalChecks": 0,
  "PaymentTypeFilters": []
}

GetCommissionCheckDetails

Hook for getting the detail for a particular commission check.

Basic Implementation

public class GetCommissionCheckDetails : IHook<GetCommissionCheckDetailsHookRequest, GetCommissionCheckDetailsHookResponse>
{
  public GetCommissionCheckDetails() { }

  public GetCommissionCheckDetailsHookResponse Invoke(GetCommissionCheckDetailsHookRequest request, Func<GetCommissionCheckDetailsHookRequest, GetCommissionCheckDetailsHookResponse> func)
  {
    return func(request);
  }
}

Register Hook

services.AddTransient<IHook<GetCommissionCheckDetailsHookRequest, GetCommissionCheckDetailsHookResponse>, GetCommissionCheckDetails>();

Request Model

{
  "TransactionNumber": "string"
}

Response Model

{
  "DatePaid": "0001-01-01T00:00:00",
  "MerchantId": 0,
  "TransactionNumber": "string",
  "CheckNumber": 0,
  "AmountPaid": 0.0,
  "AssociateId": 0,
  "Details": []
}

UpdateAux

Hook for updating auxiliary Associate data, such as the Webalias, AboutMe, SocialInfo, and CorporateCommunication.

Basic Implementation

public class UpdateAux : IHook<UpdateAuxHookRequest, UpdateAuxHookResponse>
{
  public UpdateAux() { }

  public UpdateAuxHookResponse Invoke(UpdateAuxHookRequest request, Func<UpdateAuxHookRequest, UpdateAuxHookResponse> func)
  {
    return func(request);
  }
}

Register Hook

services.AddTransient<IHook<UpdateAuxHookRequest, UpdateAuxHookResponse>, UpdateAux>();

Request Model

{
  "UpdatedAssociateAuxInfo": {
    "AboutMe": "string",
    "AssociateId": 0,
    "CorporateCommunication": false,
    "CorporateCommunicationText": false,
    "Username": "string",
    "Webalias": "string",
    "Social" : {
       "AssociateId": 0,
       "Facebook": "string",
       "LinkedIn": "string",
       "Pinterest": "string",
       "Twitter": "string",
       "YoutTube": "string"
      }
   }
}

Response Model

{}

UpdateVolume

Hook for when the volume is updated in the system for a specific Associate.

Basic Implementation

public class UpdateAssociateStats : IHook<UpdateVolumeHookRequest, UpdateVolumeHookResponse>
{
  public UpdateAssociateStats() { }

  public UpdateVolumeHookResponse Invoke(UpdateVolumeHookRequest request, Func<UpdateVolumeHookRequest, UpdateVolumeHookResponse> func)
  {
    return func(request);
  }
}

Register Hook

services.AddTransient<IHook<UpdateVolumeHookRequest, UpdateVolumeHookResponse>, UpdateAssociateStats>();

Request Model

{
  "VolumeSource": {
    "ProcessTime": "0001-01-01T00:00:00",
    "AssociateId": 0,
    "SourceDate":  "0001-01-01T00:00:00",
    "CorporateCommunicationText": false,
    "SourceId": 0,
    "Webalias": "string",
   }
}

Response Model

{}

GetUsername

Namespace: DirectScale.Disco.Extension.Hooks

Basic Implementation

public class GetUsername : IHook<GetUsernameHookRequest, GetUsernameHookResponse>
    {
        public GetUsername() { }

        public GetUsernameHookResponse Invoke(GetUsernameHookRequest request, Func<GetUsernameHookRequest, GetUsernameHookResponse> func)
        {
            return func(request);
        }
    }

Register Hook

services.AddTransient<IHook<GetUsernameHookRequest, GetUsernameHookResponse>, GetUsername>();

Request Model

{
  "Username": "string"
}

Response Model

{
  "Username": "string"
}
Was this article helpful?
0 out of 0 found this helpful
Previous Next

Comments

0 comments

Please sign in to leave a comment.