public ApiSender(string apiRoot = "", ApiProtocol protocol = ApiProtocol.https, ApiSendDataType sendType = ApiSendDataType.Json) { _apiRoot = apiRoot; _apiRootProtocol = protocol; _sendType = sendType; _headerValue = new Dictionary <string, string>(); }
public void SetApiRootProtocol(ApiProtocol protocol) { _apiRootProtocol = protocol; }
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)); }
public string GetApiEndPoint(ApiCredentialType apiCredentialType, ApiProtocol apiProtocol) { return(this.GetApiEndPoint(this.Api.ApiEnvironmentType, apiCredentialType, apiProtocol)); }