mercredi 10 mai 2017

Defining an interface for external system integration

I want to integrate my application with X number of external systems. The integration with each external system will have same kind of actions but will be handled in a separate classes.

Hence the aim to define an interface that will make sure all integration classes conform to certain actions. e.g.

public interface IOrderIntegration
{
   //I want to define the ImportOrder action here, so that all future integrations conform
}

However each external system has its own closed SDK (cannot be edited) that needs to be referenced. e.g

public class EbayOrderIntegration : IOrderIntegration
{
    void ImportOrder(Ebay.SDK.Order order)
    {
        //Logic to import Ebay's order
    }
}


public class AmazonOrderIntegration : IOrderIntegration
{
    void ImportOrder(Amazon.SDK.Order order)
    {
        //Logic to import Amazon's order
    }
}

Is there a way to still use an interface in this case to ensure all integrations perform a certain action? Or perhaps another pattern ?

Aucun commentaire:

Enregistrer un commentaire