Orders

using DirectScale.Disco.Extension.Hooks.Orders;

FinalizeAcceptedOrder

Define logic that for what happens at the end of the order processing, after the order is accepted. The default un-voids the order, sets InvoiceDate, sets CommissionDate, commits tax, updates services, and Informs the system of the order.

public class FinalizeAcceptedOrder : IHook<FinalizeAcceptedOrderHookRequest, FinalizeAcceptedOrderHookResponse>
{
  public FinalizeAcceptedOrder() { }
  
  public FinalizeAcceptedOrderHookResponse Invoke(FinalizeAcceptedOrderHookRequest request, Func<FinalizeAcceptedOrderHookRequest, FinalizeAcceptedOrderHookResponse> func)
  {
    return func(request);
  }
}
services.AddTransient<IHook<FinalizeAcceptedOrderHookRequest, FinalizeAcceptedOrderHookResponse>, FinalizeAcceptedOrder>();
{
  "Order": {
    "BackofficeId": "string",
    "LastModifiedDate": "0001-01-01T00:00:00",
    "BillPhone": "string",
    "CommissionDate": "0001-01-01T00:00:00",
    "AssociateId": 0,
    "Email": "string",
    "InvoiceDate": "0001-01-01T00:00:00",
    "LocalInvoiceNumber": 0,
    "Name": "string",
    "OrderDate": "0001-01-01T00:00:00",
    "OrderType": 0,
    "OrderNumber": 0,
    "SpecialInstructions": "string",
    "Status": "string",
    "TotalBonus": 0.0,
    "TotalCost": 0.0,
    "TotalCV": 0.0,
    "TotalQV": 0.0,
    "Void": false,
    "BillAddress": {
      "Id": 0,
      "AddressLine1": "string",
      "AddressLine2": "string",
      "AddressLine3": "string",
      "City": "string",
      "State": "string",
      "PostalCode": "string",
      "CountryCode": "string"
    },
    "PartyId": 0,
    "IsPaid": false,
    "IsShipped": false,
    "Custom": {
      "Field1": "string",
      "Field2": "string",
      "Field3": "string",
      "Field4": "string",
      "Field5": "string"
    },
    "CanRerun": false,
    "LineItems": [],
    "Packages": [],
    "Totals": [],
    "Payments": [],
    "OrderCoupons": [],
    "USDSubTotal": 0.0,
    "USDTotal": 0.0,
    "IsMoveable": {
      "IsOrderMovable": false,
      "MessageType": 0,
      "Message": "string"
    }
  }
}
{}


FinalizeNonAcceptedOrder

Define logic for what happens at the end of order processing, after payment failure. For example, you can have a notification sent if the order fails. The default un-voids the order.

public class FinalizeNonAcceptedOrder : IHook<FinalizeNonAcceptedOrderHookRequest, FinalizeNonAcceptedOrderHookResponse>
{
  public FinalizeNonAcceptedOrder() { }
  
  public FinalizeNonAcceptedOrderHookResponse Invoke(FinalizeNonAcceptedOrderHookRequest request, Func<FinalizeNonAcceptedOrderHookRequest, FinalizeNonAcceptedOrderHookResponse> func)
  {
    return func(request);
  }
}
services.AddTransient<IHook<FinalizeNonAcceptedOrderHookRequest, FinalizeNonAcceptedOrderHookResponse>, FinalizeNonAcceptedOrder>();
{
  "Order": {
    "BackofficeId": "string",
    "LastModifiedDate": "0001-01-01T00:00:00",
    "BillPhone": "string",
    "CommissionDate": "0001-01-01T00:00:00",
    "AssociateId": 0,
    "Email": "string",
    "InvoiceDate": "0001-01-01T00:00:00",
    "LocalInvoiceNumber": 0,
    "Name": "string",
    "OrderDate": "0001-01-01T00:00:00",
    "OrderType": 0,
    "OrderNumber": 0,
    "SpecialInstructions": "string",
    "Status": "string",
    "TotalBonus": 0.0,
    "TotalCost": 0.0,
    "TotalCV": 0.0,
    "TotalQV": 0.0,
    "Void": false,
    "BillAddress": {
      "Id": 0,
      "AddressLine1": "string",
      "AddressLine2": "string",
      "AddressLine3": "string",
      "City": "string",
      "State": "string",
      "PostalCode": "string",
      "CountryCode": "string"
    },
    "PartyId": 0,
    "IsPaid": false,
    "IsShipped": false,
    "Custom": {
      "Field1": "string",
      "Field2": "string",
      "Field3": "string",
      "Field4": "string",
      "Field5": "string"
    },
    "CanRerun": false,
    "LineItems": [],
    "Packages": [],
    "Totals": [],
    "Payments": [],
    "OrderCoupons": [],
    "USDSubTotal": 0.0,
    "USDTotal": 0.0,
    "IsMoveable": {
      "IsOrderMovable": false,
      "MessageType": 0,
      "Message": "string"
    }
  }
}
{}


FullRefundOrder

Define logic for when an order has been fully refunded. The default validates and starts order clawbacks.

public class FullRefundOrder : IHook<FullRefundOrderHookRequest, FullRefundOrderHookResponse>
{
  public FullRefundOrder() { }
  
  public FullRefundOrderHookResponse Invoke(FullRefundOrderHookRequest request, Func<FullRefundOrderHookRequest, FullRefundOrderHookResponse> func)
  {
    return func(request);
  }
}
services.AddTransient<IHook<FullRefundOrderHookRequest, FullRefundOrderHookResponse>, FullRefundOrder>();
{
  "Order": {
    "BackofficeId": "string",
    "LastModifiedDate": "0001-01-01T00:00:00",
    "BillPhone": "string",
    "CommissionDate": "0001-01-01T00:00:00",
    "AssociateId": 0,
    "Email": "string",
    "InvoiceDate": "0001-01-01T00:00:00",
    "LocalInvoiceNumber": 0,
    "Name": "string",
    "OrderDate": "0001-01-01T00:00:00",
    "OrderType": 0,
    "OrderNumber": 0,
    "SpecialInstructions": "string",
    "Status": "string",
    "TotalBonus": 0.0,
    "TotalCost": 0.0,
    "TotalCV": 0.0,
    "TotalQV": 0.0,
    "Void": false,
    "BillAddress": {
      "Id": 0,
      "AddressLine1": "string",
      "AddressLine2": "string",
      "AddressLine3": "string",
      "City": "string",
      "State": "string",
      "PostalCode": "string",
      "CountryCode": "string"
    },
    "PartyId": 0,
    "IsPaid": false,
    "IsShipped": false,
    "Custom": {
      "Field1": "string",
      "Field2": "string",
      "Field3": "string",
      "Field4": "string",
      "Field5": "string"
    },
    "CanRerun": false,
    "LineItems": [],
    "Packages": [],
    "Totals": [],
    "Payments": [],
    "OrderCoupons": [],
    "USDSubTotal": 0.0,
    "USDTotal": 0.0,
    "IsMoveable": {
      "IsOrderMovable": false,
      "MessageType": 0,
      "Message": "string"
    }
  }
}
{}


RefundPayment

Define logic around the refund process. The default validates the call to payment provider merchant to refund money and adjust database tables.

public class RefundPayment : IHook<RefundPaymentHookRequest, RefundPaymentHookResponse>
{
  public RefundPayment() { }
  
  public RefundPaymentHookResponse Invoke(RefundPaymentHookRequest request, Func<RefundPaymentHookRequest, RefundPaymentHookResponse> func)
  {
    return func(request);
  }
}
services.AddTransient<IHook<RefundPaymentHookRequest, RefundPaymentHookResponse>, RefundPayment>();
{
  "OrderNumber": 0,
  "Refunds": [
    {
      "PaymentId": 0,
      "Amount": 0.0,
      "ManualRefund": false,
      "ManualTransactionId": "string"
    }
  ]
}
{}


AdjustNewOrderPayments

This is a Hook that allows payments to be adjusted before being applied to an order.

public class AdjustNewOrderPayments : IHook<AdjustNewOrderPaymentsHookRequest, AdjustNewOrderPaymentsHookResponse>
{
  public AdjustNewOrderPayments() { }
  
  public AdjustNewOrderPaymentsHookResponse Invoke(AdjustNewOrderPaymentsHookRequest request, Func<AdjustNewOrderPaymentsHookRequest, AdjustNewOrderPaymentsHookResponse> func)
  {
    return func(request);
  }
}
services.AddTransient<IHook<AdjustNewOrderPaymentsHookRequest, AdjustNewOrderPaymentsHookResponse>, AdjustNewOrderPayments>();
{
  "Order": {
    "BackofficeId": "string",
    "LastModifiedDate": "0001-01-01T00:00:00",
    "BillPhone": "string",
    "CommissionDate": "0001-01-01T00:00:00",
    "AssociateId": 0,
    "Email": "string",
    "InvoiceDate": "0001-01-01T00:00:00",
    "LocalInvoiceNumber": 0,
    "Name": "string",
    "OrderDate": "0001-01-01T00:00:00",
    "OrderType": 0,
    "OrderNumber": 0,
    "SpecialInstructions": "string",
    "Status": "string",
    "TotalBonus": 0.0,
    "TotalCost": 0.0,
    "TotalCV": 0.0,
    "TotalQV": 0.0,
    "Void": false,
    "BillAddress": {
      "Id": 0,
      "AddressLine1": "string",
      "AddressLine2": "string",
      "AddressLine3": "string",
      "City": "string",
      "State": "string",
      "PostalCode": "string",
      "CountryCode": "string"
    },
    "PartyId": 0,
    "IsPaid": false,
    "IsShipped": false,
    "Custom": {
      "Field1": "string",
      "Field2": "string",
      "Field3": "string",
      "Field4": "string",
      "Field5": "string"
    },
    "CanRerun": false,
    "LineItems": [],
    "Packages": [],
    "Totals": [],
    "Payments": [],
    "OrderCoupons": [],
    "USDSubTotal": 0.0,
    "USDTotal": 0.0,
    "IsMoveable": {
      "IsOrderMovable": false,
      "MessageType": 0,
      "Message": "string"
    }
  },
  "NewOrderPayments": [
    {
      "Input1": "string",
      "Input2": "string",
      "Last4": "string",
      "CardType": "string",
      "InputMonth": 1,
      "InputYear": 1900,
      "SecurityCode": "string",
      "Address": {
        "Id": 0,
        "AddressLine1": "string",
        "AddressLine2": "string",
        "AddressLine3": "string",
        "City": "string",
        "State": "string",
        "PostalCode": "string",
        "CountryCode": "string"
      },
      "MerchantId": 0,
      "Amount": 0.0,
      "CurrencyCode": "string",
      "OrderPaymentId": 0,
      "RedirectUrl": "string",
      "PaymentMethodId": "string",
      "ProfileType": 0,
      "FraudPreventionData": {
        "FraudPreventionId": "string",
        "FraudPreventionProviderId": "string",
        "FraudPreventionType": 0,
        "IpAddress": "string"
      },
      "ExpireDate": "0001-01-01T00:00:00"
    }
  ]
}
{
  "Payment": [
    {
      "Input1": "string",
      "Input2": "string",
      "Last4": "string",
      "CardType": "string",
      "InputMonth": 1,
      "InputYear": 1900,
      "SecurityCode": "string",
      "Address": {
        "Id": 0,
        "AddressLine1": "string",
        "AddressLine2": "string",
        "AddressLine3": "string",
        "City": "string",
        "State": "string",
        "PostalCode": "string",
        "CountryCode": "string"
      },
      "MerchantId": 0,
      "Amount": 0.0,
      "CurrencyCode": "string",
      "OrderPaymentId": 0,
      "RedirectUrl": "string",
      "PaymentMethodId": "string",
      "ProfileType": 0,
      "FraudPreventionData": {
        "FraudPreventionId": "string",
        "FraudPreventionProviderId": "string",
        "FraudPreventionType": 0,
        "IpAddress": "string"
      },
      "ExpireDate": "0001-01-01T00:00:00"
    }
  ]
}


SubmitOrder

Define logic around order process. For example, you can change some of the information right before the order is created or right after. The default creates an order adding information to all the ORD_ tables in the database.

public class SubmitOrder : IHook<SubmitOrderHookRequest, SubmitOrderHookResponse>
{
  public SubmitOrder() { }
  
  public SubmitOrderHookResponse Invoke(SubmitOrderHookRequest request, Func<SubmitOrderHookRequest, SubmitOrderHookResponse> func)
  {
    return func(request);
  }
}
services.AddTransient<IHook<SubmitOrderHookRequest, SubmitOrderHookResponse>, SubmitOrder>();
{
  "Order": {
    "AssociateId": 0,
    "ShipToName": "string",
    "Attention": "string",
    "ShipAddress": {
      "Id": 0,
      "AddressLine1": "string",
      "AddressLine2": "string",
      "AddressLine3": "string",
      "City": "string",
      "State": "string",
      "PostalCode": "string",
      "CountryCode": "string"
    },
    "InvoiceDate": "0001-01-01T00:00:00",
    "CommissionDate": "0001-01-01T00:00:00",
    "ShipByDate": "0001-01-01T00:00:00",
    "ShipMethodId": 0,
    "WarehouseId": 0,
    "ShipPhone": "string",
    "PartyId": 0,
    "SpecialInstructions": "string",
    "OrderType": 0,
    "AssociateType": 0,
    "StoreId": 0,
    "CurrencyCode": "string",
    "CouponCodes": null,
    "LineItems": [
      {
        "ItemId": 0,
        "Quantity": 0.0,
        "Cost": 0.0,
        "Disabled": false,
        "ExtendedPrice": 0.0,
        "ExtendedOriginalPrice": 0.0,
        "ExtendedBonus": 0.0,
        "ExtendedCV": 0.0,
        "ExtendedQV": 0.0,
        "ExtendedRewardPoints": 0.0,
        "ExtendedCost": 0.0,
        "ProductName": "string",
        "Description": "string",
        "Specifications": "string",
        "LanguageCode": "string",
        "SKU": "string",
        "Category": {
          "Id": 0,
          "Name": "string",
          "CategoryTranslations": [],
          "Description": "string",
          "DisplayIndex": 0.0,
          "ImageUrl": "string",
          "ParentId": 0,
          "ProductLineId": 0,
          "ShortDescription": "string",
          "StoreIds": [],
          "HasChildren": false
        },
        "ChargeShipping": false,
        "Height": 0.0,
        "Image": "string",
        "Length": 0.0,
        "LengthUOM": "string",
        "MPN": "string",
        "PackCount": 0.0,
        "PackageGroupId": 0,
        "TaxClassId": 0,
        "UnitOfMeasure": "string",
        "UPC": "string",
        "Weight": 0.0,
        "WeightUOM": "string",
        "Width": 0.0,
        "FlagBirthDefects": false,
        "HasKitGroups": false,
        "FlagCancer": false,
        "PriceGroup": 0,
        "Custom": {
          "Field1": "string",
          "Field2": "string",
          "Field3": "string",
          "Field4": "string",
          "Field5": "string"
        },
        "Images": [
          {
            "Description": "string",
            "Path": "string"
          }
        ],
        "Prices": [
          {
            "GroupId": 0,
            "Price": 0.0,
            "PriceCurrency": "string",
            "OriginalPrice": 0.0,
            "Bonus": 0.0,
            "CV": 0.0,
            "QV": 0.0,
            "RewardPoints": 0.0
          }
        ],
        "Options": [
          {
            "OptionId": 0,
            "Option": "string"
          }
        ],
        "ItemOptions": [
          {
            "OptionId": 0,
            "Option": "string",
            "OptionType": 0,
            "Values": [
              {
                "Option": "string",
                "SkuExt": "string"
              }
            ]
          }
        ],
        "Languages": [
          {
            "Description": "string",
            "LanguageCode": "string",
            "ProductName": "string",
            "SEOKeywords": "string",
            "Specifications": "string"
          }
        ],
        "OptionsMap": [
          {
            "Key": "string",
            "Checked": false,
            "ItemId": 0,
            "Image": "string",
            "ExtSku": "string"
          }
        ],
        "HasOptions": false,
        "Price": 0.0,
        "PriceCurrency": "string",
        "OriginalPrice": 0.0,
        "Bonus": 0.0,
        "CV": 0.0,
        "QV": 0.0,
        "RewardPoints": 0.0,
        "CouponsBeingUsed": 0,
        "PriceGroups": [
          0
        ]
      }
    ],
    "ShipTaxOverride": {
      "Shipping": 0.0,
      "Tax": 0.0,
      "HasShippingOverride": false,
      "HasTaxOverride": false
    },
    "Custom": {
      "Field1": "string",
      "Field2": "string",
      "Field3": "string",
      "Field4": "string",
      "Field5": "string"
    }
  }
}
{
  "OrderNumber": 0,
  "Order": {
    "AssociateId": 0,
    "ShipToName": "string",
    "Attention": "string",
    "ShipAddress": {
      "Id": 0,
      "AddressLine1": "string",
      "AddressLine2": "string",
      "AddressLine3": "string",
      "City": "string",
      "State": "string",
      "PostalCode": "string",
      "CountryCode": "string"
    },
    "InvoiceDate": "0001-01-01T00:00:00",
    "CommissionDate": "0001-01-01T00:00:00",
    "ShipByDate": "0001-01-01T00:00:00",
    "ShipMethodId": 0,
    "WarehouseId": 0,
    "ShipPhone": "string",
    "PartyId": 0,
    "SpecialInstructions": "string",
    "OrderType": 0,
    "AssociateType": 0,
    "StoreId": 0,
    "CurrencyCode": "string",
    "CouponCodes": null,
    "LineItems": [
      {
        "ItemId": 0,
        "Quantity": 0.0,
        "Cost": 0.0,
        "Disabled": false,
        "ExtendedPrice": 0.0,
        "ExtendedOriginalPrice": 0.0,
        "ExtendedBonus": 0.0,
        "ExtendedCV": 0.0,
        "ExtendedQV": 0.0,
        "ExtendedRewardPoints": 0.0,
        "ExtendedCost": 0.0,
        "ProductName": "string",
        "Description": "string",
        "Specifications": "string",
        "LanguageCode": "string",
        "SKU": "string",
        "Category": {
          "Id": 0,
          "Name": "string",
          "CategoryTranslations": [],
          "Description": "string",
          "DisplayIndex": 0.0,
          "ImageUrl": "string",
          "ParentId": 0,
          "ProductLineId": 0,
          "ShortDescription": "string",
          "StoreIds": [],
          "HasChildren": false
        },
        "ChargeShipping": false,
        "Height": 0.0,
        "Image": "string",
        "Length": 0.0,
        "LengthUOM": "string",
        "MPN": "string",
        "PackCount": 0.0,
        "PackageGroupId": 0,
        "TaxClassId": 0,
        "UnitOfMeasure": "string",
        "UPC": "string",
        "Weight": 0.0,
        "WeightUOM": "string",
        "Width": 0.0,
        "FlagBirthDefects": false,
        "HasKitGroups": false,
        "FlagCancer": false,
        "PriceGroup": 0,
        "Custom": {
          "Field1": "string",
          "Field2": "string",
          "Field3": "string",
          "Field4": "string",
          "Field5": "string"
        },
        "Images": [
          {
            "Description": "string",
            "Path": "string"
          }
        ],
        "Prices": [
          {
            "GroupId": 0,
            "Price": 0.0,
            "PriceCurrency": "string",
            "OriginalPrice": 0.0,
            "Bonus": 0.0,
            "CV": 0.0,
            "QV": 0.0,
            "RewardPoints": 0.0
          }
        ],
        "Options": [
          {
            "OptionId": 0,
            "Option": "string"
          }
        ],
        "ItemOptions": [
          {
            "OptionId": 0,
            "Option": "string",
            "OptionType": 0,
            "Values": [
              {
                "Option": "string",
                "SkuExt": "string"
              }
            ]
          }
        ],
        "Languages": [
          {
            "Description": "string",
            "LanguageCode": "string",
            "ProductName": "string",
            "SEOKeywords": "string",
            "Specifications": "string"
          }
        ],
        "OptionsMap": [
          {
            "Key": "string",
            "Checked": false,
            "ItemId": 0,
            "Image": "string",
            "ExtSku": "string"
          }
        ],
        "HasOptions": false,
        "Price": 0.0,
        "PriceCurrency": "string",
        "OriginalPrice": 0.0,
        "Bonus": 0.0,
        "CV": 0.0,
        "QV": 0.0,
        "RewardPoints": 0.0,
        "CouponsBeingUsed": 0,
        "PriceGroups": [
          0
        ]
      }
    ],
    "ShipTaxOverride": {
      "Shipping": 0.0,
      "Tax": 0.0,
      "HasShippingOverride": false,
      "HasTaxOverride": false
    },
    "Custom": {
      "Field1": "string",
      "Field2": "string",
      "Field3": "string",
      "Field4": "string",
      "Field5": "string"
    }
  }
}


IsMoveOrderPermitted

Validation around moving an order to another Associate. The default validates if it's OK to move the order.

public class IsMoveOrderPermitted : IHook<MoveOrderHookRequest, MoveOrderHookResponse>
{
  public IsMoveOrderPermitted() { }
  
  public MoveOrderHookResponse Invoke(MoveOrderHookRequest request, Func<MoveOrderHookRequest, MoveOrderHookResponse> func)
  {
    return func(request);
  }
}
services.AddTransient<IHook<MoveOrderHookRequest, MoveOrderHookResponse>, IsMoveOrderPermitted>();
{
  "Order": {
    "BackofficeId": "string",
    "LastModifiedDate": "0001-01-01T00:00:00",
    "BillPhone": "string",
    "CommissionDate": "0001-01-01T00:00:00",
    "AssociateId": 0,
    "Email": "string",
    "InvoiceDate": "0001-01-01T00:00:00",
    "LocalInvoiceNumber": 0,
    "Name": "string",
    "OrderDate": "0001-01-01T00:00:00",
    "OrderType": 0,
    "OrderNumber": 0,
    "SpecialInstructions": "string",
    "Status": "string",
    "TotalBonus": 0.0,
    "TotalCost": 0.0,
    "TotalCV": 0.0,
    "TotalQV": 0.0,
    "Void": false,
    "BillAddress": {
      "Id": 0,
      "AddressLine1": "string",
      "AddressLine2": "string",
      "AddressLine3": "string",
      "City": "string",
      "State": "string",
      "PostalCode": "string",
      "CountryCode": "string"
    },
    "PartyId": 0,
    "IsPaid": false,
    "IsShipped": false,
    "Custom": {
      "Field1": "string",
      "Field2": "string",
      "Field3": "string",
      "Field4": "string",
      "Field5": "string"
    },
    "CanRerun": false,
    "LineItems": [],
    "Packages": [],
    "Totals": [],
    "Payments": [],
    "OrderCoupons": [],
    "USDSubTotal": 0.0,
    "USDTotal": 0.0,
    "IsMoveable": {
      "IsOrderMovable": false,
      "MessageType": 0,
      "Message": "string"
    }
  },
  "IsOrderLocked": false
}
{
  "MoveOrderPermission": {
    "IsOrderMovable": false,
    "MessageType": 0,
    "Message": "string"
  }
}


ProcessOrderPayment

Define logic around order processing. The default sends a call to the payment provider merchant, then adds records to payment tables.

public class ProcessOrderPayment : IHook<ProcessOrderPaymentHookRequest, ProcessOrderPaymentHookResponse>
{
  public ProcessOrderPayment() { }
  
  public ProcessOrderPaymentHookResponse Invoke(ProcessOrderPaymentHookRequest request, Func<ProcessOrderPaymentHookRequest, ProcessOrderPaymentHookResponse> func)
  {
    return func(request);
  }
}
services.AddTransient<IHook<ProcessOrderPaymentHookRequest, ProcessOrderPaymentHookResponse>, ProcessOrderPayment>();
{
  "Order": {
    "BackofficeId": "string",
    "LastModifiedDate": "0001-01-01T00:00:00",
    "BillPhone": "string",
    "CommissionDate": "0001-01-01T00:00:00",
    "AssociateId": 0,
    "Email": "string",
    "InvoiceDate": "0001-01-01T00:00:00",
    "LocalInvoiceNumber": 0,
    "Name": "string",
    "OrderDate": "0001-01-01T00:00:00",
    "OrderType": 0,
    "OrderNumber": 0,
    "SpecialInstructions": "string",
    "Status": "string",
    "TotalBonus": 0.0,
    "TotalCost": 0.0,
    "TotalCV": 0.0,
    "TotalQV": 0.0,
    "Void": false,
    "BillAddress": {
      "Id": 0,
      "AddressLine1": "string",
      "AddressLine2": "string",
      "AddressLine3": "string",
      "City": "string",
      "State": "string",
      "PostalCode": "string",
      "CountryCode": "string"
    },
    "PartyId": 0,
    "IsPaid": false,
    "IsShipped": false,
    "Custom": {
      "Field1": "string",
      "Field2": "string",
      "Field3": "string",
      "Field4": "string",
      "Field5": "string"
    },
    "CanRerun": false,
    "LineItems": [],
    "Packages": [],
    "Totals": [],
    "Payments": [],
    "OrderCoupons": [],
    "USDSubTotal": 0.0,
    "USDTotal": 0.0,
    "IsMoveable": {
      "IsOrderMovable": false,
      "MessageType": 0,
      "Message": "string"
    }
  },
  "ShipMethodId": 0,
  "LanguageCode": "string",
  "Payments": [
    {
      "Input1": "string",
      "Input2": "string",
      "Last4": "string",
      "CardType": "string",
      "InputMonth": 1,
      "InputYear": 1900,
      "SecurityCode": "string",
      "Address": {
        "Id": 0,
        "AddressLine1": "string",
        "AddressLine2": "string",
        "AddressLine3": "string",
        "City": "string",
        "State": "string",
        "PostalCode": "string",
        "CountryCode": "string"
      },
      "MerchantId": 0,
      "Amount": 0.0,
      "CurrencyCode": "string",
      "OrderPaymentId": 0,
      "RedirectUrl": "string",
      "PaymentMethodId": "string",
      "ProfileType": 0,
      "FraudPreventionData": {
        "FraudPreventionId": "string",
        "FraudPreventionProviderId": "string",
        "FraudPreventionType": 0,
        "IpAddress": "string"
      },
      "ExpireDate": "0001-01-01T00:00:00"
    }
  ]
}
{
  "PaymentResponse": {
    "PaymentType": "string",
    "AuthorizationCode": "string",
    "Response": "string",
    "ResponseId": "string",
    "TransactionNumber": "string",
    "ReferenceNumber": "string",
    "Status": 0,
    "Amount": 0.0,
    "Currency": "string",
    "Merchant": 0,
    "FraudPreventionId": "string",
    "FraudPreventionProviderId": null,
    "OrderNumber": 0,
    "Redirect": false,
    "RedirectURL": "string",
    "SpecialInstructionsURL": "string",
    "SavedPaymentId": null
  }
}


MarkPackagesShipped

using DirectScale.Disco.Extension.Hooks.Orders.Packages;

Set order(s) as shipped. The default adds the shipped date and adjusts inventory stock levels.

public class MarkPackageShipped : IHook<MarkPackageShippedHookRequest, MarkPackageShippedHookResponse>
{
  public MarkPackageShipped() { }
  
  public MarkPackageShippedHookResponse Invoke(MarkPackageShippedHookRequest request, Func<MarkPackageShippedHookRequest, MarkPackageShippedHookResponse> func)
  {
    return func(request);
  }
}
services.AddTransient<IHook<MarkPackageShippedHookRequest, MarkPackageShippedHookResponse>, MarkPackageShipped>();
{
  "PackageStatusUpdates": null
}
{}


CancelOrder

Define logic for canceling an order. The default validates and voids the order, then adjusts stock levels.

public class CancelOrder : IHook<CancelOrderHookRequest, CancelOrderHookResponse>
{
  public CancelOrder() { }
  
  public CancelOrderHookResponse Invoke(CancelOrderHookRequest request, Func<CancelOrderHookRequest, CancelOrderHookResponse> func)
  {
    return func(request);
  }
}
services.AddTransient<IHook<CancelOrderHookRequest, CancelOrderHookResponse>, CancelOrder>();
{
  "OrderNumber": 0,
  "Validate": false
}
{}


ProcessCouponCodes

Define logic around the order coupon system, as well a calculates the discount amount. This Hook is great for building custom coupons and "three-then-free" programs. The default checks the system to see if a coupon applies and gives the applicable discount.

public class ProcessCouponCodes : IHook<ProcessCouponCodesHookRequest, ProcessCouponCodesHookResponse>
{
  public ProcessCouponCodes() { }
  
  public ProcessCouponCodesHookResponse Invoke(ProcessCouponCodesHookRequest request, Func<ProcessCouponCodesHookRequest, ProcessCouponCodesHookResponse> func)
  {
    return func(request);
  }
}
services.AddTransient<IHook<ProcessCouponCodesHookRequest, ProcessCouponCodesHookResponse>, ProcessCouponCodes>();
{
  "CouponCodes": null,
  "RegionId": 0,
  "SubTotal": 0.0,
  "Currency": "string",
  "LineItems": null,
  "ShipMethodId": 0,
  "ShippingCost": 0.0,
  "OrderType": 0,
  "AssociateId": 0,
  "TaxItems": null
}
{
  "OrderCoupons": {
    "DiscountTotal": 0.0,
    "UsedCoupons": null
  },
  "CouponAdjustedTax": null
}

👍

Read more

See a full example here ProcessCouponCodes Hook Coupon: Associate's First AutoShip Purchase.



GetCouponAdjustedVolume

Define logic for the commission volume adjustments a coupon might give. The default keeps the original commission volume numbers.

public class GetCouponAdjustedVolume : IHook<GetCouponAdjustedVolumeHookRequest, GetCouponAdjustedVolumeHookResponse>
{
  public GetCouponAdjustedVolume() { }
  
  public GetCouponAdjustedVolumeHookResponse Invoke(GetCouponAdjustedVolumeHookRequest request, Func<GetCouponAdjustedVolumeHookRequest, GetCouponAdjustedVolumeHookResponse> func)
  {
    return func(request);
  }
}
services.AddTransient<IHook<GetCouponAdjustedVolumeHookRequest, GetCouponAdjustedVolumeHookResponse>, GetCouponAdjustedVolume>();
{
  "Volume": {
    "Cv": 0.0,
    "Qv": 0.0
  },
  "Totals": [
    {
      "Id": 0,
      "TaxableSubTotal": 0.0,
      "CurrencyCode": "string",
      "ExchangeRate": 0.0,
      "OrderNumber": 0,
      "Shipping": 0.0,
      "SubTotal": 0.0,
      "Tax": 0.0,
      "TaxInfo": {
        "TransactionId": "string",
        "RefundTransactionId": "string",
        "TaxProvider": 0,
        "LineItems": [
          {
            "Detail": [],
            "ItemId": 0,
            "TaxRate": 0.0,
            "TaxAmount": 0.0,
            "Street": null,
            "City": null,
            "County": null,
            "State": null,
            "Country": null,
            "Zip": null,
            "WarehouseAddressId": 0
          }
        ],
        "TaxAmount": 0.0,
        "TaxRate": 0.0,
        "ShippingAmount": 0.0
      },
      "TaxTransactionId": "string",
      "TaxProvider": 0,
      "DiscountTotal": 0.0,
      "Coupons": {
        "DiscountTotal": 0.0,
        "UsedCoupons": null
      },
      "CurrencySymbol": "string",
      "OverridenShippingTax": false,
      "Total": 0.0,
      "PaidAmount": 0.0,
      "TotalDue": 0.0
    }
  ]
}
{
  "CouponAdjustedVolume": {
    "Cv": 0.0,
    "Qv": 0.0
  }
}


GetShipping

using DirectScale.Disco.Extension.Hooks.Orders.Shipping;

Hook around getting the shipping method for an order. By default, the system looks at the admin added shipping methods and shipping types (Flat, Per Pound, or Shipping Table).

public class GetShipping : IHook<GetShippingHookRequest, GetShippingHookResponse>
{
  public GetShipping() { }
  
  public GetShippingHookResponse Invoke(GetShippingHookRequest request, Func<GetShippingHookRequest, GetShippingHookResponse> func)
  {
    return func(request);
  }
}
services.AddTransient<IHook<GetShippingHookRequest, GetShippingHookResponse>, GetShipping>();
{
  "Items": [
    {
      "ItemId": 0,
      "Quantity": 0.0,
      "Cost": 0.0,
      "Disabled": false,
      "ExtendedPrice": 0.0,
      "ExtendedOriginalPrice": 0.0,
      "ExtendedBonus": 0.0,
      "ExtendedCV": 0.0,
      "ExtendedQV": 0.0,
      "ExtendedRewardPoints": 0.0,
      "ExtendedCost": 0.0,
      "ProductName": "string",
      "Description": "string",
      "Specifications": "string",
      "LanguageCode": "string",
      "SKU": "string",
      "Category": {
        "Id": 0,
        "Name": "string",
        "CategoryTranslations": [],
        "Description": "string",
        "DisplayIndex": 0.0,
        "ImageUrl": "string",
        "ParentId": 0,
        "ProductLineId": 0,
        "ShortDescription": "string",
        "StoreIds": [],
        "HasChildren": false
      },
      "ChargeShipping": false,
      "Height": 0.0,
      "Image": "string",
      "Length": 0.0,
      "LengthUOM": "string",
      "MPN": "string",
      "PackCount": 0.0,
      "PackageGroupId": 0,
      "TaxClassId": 0,
      "UnitOfMeasure": "string",
      "UPC": "string",
      "Weight": 0.0,
      "WeightUOM": "string",
      "Width": 0.0,
      "FlagBirthDefects": false,
      "HasKitGroups": false,
      "FlagCancer": false,
      "PriceGroup": 0,
      "Custom": {
        "Field1": "string",
        "Field2": "string",
        "Field3": "string",
        "Field4": "string",
        "Field5": "string"
      },
      "Images": [
        {
          "Description": "string",
          "Path": "string"
        }
      ],
      "Prices": [
        {
          "GroupId": 0,
          "Price": 0.0,
          "PriceCurrency": "string",
          "OriginalPrice": 0.0,
          "Bonus": 0.0,
          "CV": 0.0,
          "QV": 0.0,
          "RewardPoints": 0.0
        }
      ],
      "Options": [
        {
          "OptionId": 0,
          "Option": "string"
        }
      ],
      "ItemOptions": [
        {
          "OptionId": 0,
          "Option": "string",
          "OptionType": 0,
          "Values": [
            {
              "Option": "string",
              "SkuExt": "string"
            }
          ]
        }
      ],
      "Languages": [
        {
          "Description": "string",
          "LanguageCode": "string",
          "ProductName": "string",
          "SEOKeywords": "string",
          "Specifications": "string"
        }
      ],
      "OptionsMap": [
        {
          "Key": "string",
          "Checked": false,
          "ItemId": 0,
          "Image": "string",
          "ExtSku": "string"
        }
      ],
      "HasOptions": false,
      "Price": 0.0,
      "PriceCurrency": "string",
      "OriginalPrice": 0.0,
      "Bonus": 0.0,
      "CV": 0.0,
      "QV": 0.0,
      "RewardPoints": 0.0,
      "CouponsBeingUsed": 0,
      "PriceGroups": [
        0
      ]
    }
  ],
  "WarehouseId": 0,
  "Address": {
    "Id": 0,
    "AddressLine1": "string",
    "AddressLine2": "string",
    "AddressLine3": "string",
    "City": "string",
    "State": "string",
    "PostalCode": "string",
    "CountryCode": "string"
  },
  "ShipMethodId": 0
}
{
  "ShippingAmount": 0.0
}


CreateRma

using DirectScale.Disco.Extension.Hooks.Orders.Rma;

Hook in custom code into the Return Merchandise Authorization (RMA) process, called when an RMA is created. Learn more about the default RMA process in the Returns and Refunds Guide.

public class CreateRma : IHook<CreateRmaHookRequest, CreateRmaHookResponse>
{
  public CreateRma() { }
  
  public CreateRmaHookResponse Invoke(CreateRmaHookRequest request, Func<CreateRmaHookRequest, CreateRmaHookResponse> func)
  {
    return func(request);
  }
}
services.AddTransient<IHook<CreateRmaHookRequest, CreateRmaHookResponse>, CreateRma>();
{
  "Rma": {
    "Id": 0,
    "AssociateId": 0,
    "OrderNumber": 0,
    "WarehouseId": 0,
    "Date": "0001-01-01T00:00:00",
    "ShipMethod": "string",
    "DateShipped": "0001-01-01T00:00:00",
    "DateReceived": "0001-01-01T00:00:00",
    "TrackingNumber": "string",
    "Notes": "string",
    "CurrencyCode": "string",
    "LineItems": [],
    "Status": "New",
    "Total": 0.0,
    "Shipped": false,
    "Received": false
  }
}
{
  "RmaId": 0
}


ImportOrder

Override logic that imports orders processed by a system external to DirectScale.

public class ImportOrder: IHook<ImportOrderHookRequest, ImportOrderHookResponse>
{
  public ImportOrder() { }
  
  public ImportOrderHookResponse Invoke(ImportOrderHookRequest request, Func<ImportOrderHookRequest, ImportOrderHookResponse> func)
  {
    return func(request);
  }
}
services.AddTransient<IHook<ImportOrderHookRequest, ImportOrderHookResponse>, ImportOrder>();
{
  "AssociateId": 0,
  "ShipAddress": {
    "Id": 0,
    "AddressLine1": "string",
    "AddressLine2": "string",
    "AddressLine3": "string",
    "City": "string",
    "State": "string",
    "PostalCode": "string",
    "CountryCode": "string"
  },
  "InvoiceDate": "0001-01-01T00:00:00",
  "CommissionDate": "0001-01-01T00:00:00",
  "OrderDate": "0001-01-01T00:00:00",
  "TotalCV": 0.0,
  "TotalQV": 0.0,
  "TotalBonus": 0.0,
  "ShipPhone": "string",
  "PartyId": 0,
  "EmailAddress": "string",
  "ExtOrderNumber": "string",
  "SpecialInstructions": "string",
  "OrderName": "string",
  "OrderType": 0,
  "LineItems": [
    {
      "ItemId": 0,
      "SKU": "string",
      "Quantity": 0.0,
      "Price": 0.0,
      "CurrencyCode": "string",
      "ProductName": "string"
    }
  ],
  "SubTotal": 0.0,
  "ShippingTotal": 0.0,
  "TaxTotal": 0.0
}
{
  "OrderNumber": 0
}

Did this page help you?