コード例 #1
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));
        }
コード例 #2
0
 public string GetApiEndPoint(ApiCredentialType apiCredentialType, ApiProtocol apiProtocol)
 {
     return(this.GetApiEndPoint(this.Api.ApiEnvironmentType, apiCredentialType, apiProtocol));
 }