In what way could I create a class that would serve both API sandbox and API production?

1

I am integrating the CIELO API into my system, they have two types of API, the sandbox and production. Each one with its merchantKey , merchantID , apiUrl and apiUrlQuery query, that is, I have 4 constants for each environment. My initial idea was to implement the following:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace SiteTeste.APIS.CIELO
{
    public class CieloAPI
    {
        string merchantKey, merchantID, apiUrl, apiUrlQuery;
        public CieloAPI(string merchantKey, string merchantID, string apiUrl, string apiUrlQuery)
        {
            this.merchantKey = merchantKey;
            this.merchantID = merchantID;
            this.apiUrl = apiUrl;
            this.apiUrlQuery = apiUrl;
        }
     }
}

But whenever I was instantiating a new class CieloAPI would have to be passing the keys, otherwise I would not know what the sandbox key and production would be.

I do not want everything chewed, but do I need a north of which feature to use, abstract class? interface? and etc.

    
asked by anonymous 25.10.2017 / 14:58

0 answers