Exemplo n.º 1
0
 public ApiSender(string apiRoot = "", ApiProtocol protocol = ApiProtocol.https, ApiSendDataType sendType = ApiSendDataType.Json)
 {
     _apiRoot         = apiRoot;
     _apiRootProtocol = protocol;
     _sendType        = sendType;
     _headerValue     = new Dictionary <string, string>();
 }
Exemplo n.º 2
0
 public void SetApiRootProtocol(ApiProtocol protocol)
 {
     _apiRootProtocol = protocol;
 }
Exemplo n.º 3
0
        protected virtual string GetApiEndPoint(ApiEnvironmentType apiEnvironment, ApiCredentialType apiCredentialType, ApiProtocol apiProtocol)
        {
            if (apiEnvironment != ApiEnvironmentType.Sandbox && apiEnvironment != ApiEnvironmentType.Production)
            {
                throw new Exception(string.Format("Invalid value of apiEnvironment: {0}", apiEnvironment));
            }

            if (apiCredentialType != ApiCredentialType.Signature && apiCredentialType != ApiCredentialType.Certificate)
            {
                throw new Exception(string.Format("Invalid value of apiCredentialType: {0}", apiCredentialType));
            }

            if (apiProtocol != ApiProtocol.NVP && apiProtocol != ApiProtocol.SOAP)
            {
                throw new Exception(string.Format("Invalid value of apiProtocol: {0}", apiProtocol));
            }

            return(string.Format(SignatureApiUrl,
                                 apiEnvironment == ApiEnvironmentType.Sandbox ? Sandbox : Production,
                                 apiCredentialType == ApiCredentialType.Signature ? Signature : Certificate,
                                 apiProtocol == ApiProtocol.NVP ? NVP : SOAP));
        }
Exemplo n.º 4
0
 public string GetApiEndPoint(ApiCredentialType apiCredentialType, ApiProtocol apiProtocol)
 {
     return(this.GetApiEndPoint(this.Api.ApiEnvironmentType, apiCredentialType, apiProtocol));
 }