Skip to content

Add configuration setting to set RestClient url and Host header independently of RunEnvironment setting #26

@wopietrz

Description

@wopietrz

I'm trying to call Cybersource Rest Api via Azure Api Management to meet security and complaince requirements. Unfortunately I run into some issues:

  1. I' m not able to set RestClient Url to Api Management endpoint independently of RunEnviroment setting.
  2. I'm not able to modify the Host header independently of RunEnviroment setting to establish ssl connection.
  3. When I set the value of RunEnvironemnt to Azure Api Management endpoint then it is possilbe to connect to APIM but, Cybersource refuses a request becasue of inccorrect value of Signature header

There is a possibility to initialize RestClient with a custom url, however in ApiClient.CallAuthtenticationHeaders the RestClient property is recreated:

ApiClient.cs:

    public void CallAuthenticationHeaders(string requestType, string requestTarget, string requestJsonData = null)
    {
       ...
        
        Configuration.DefaultHeader = authenticationHeaders;
        RestClient = new RestClient("https://" + merchantConfig.HostName);
        
        if (Configuration.Proxy != null)
        {
            RestClient.Proxy = Configuration.Proxy;
        }
    }

In above code merchantConfig.HostName points to RunEnvironement setting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions