Open latompa opened 2 years ago
Heya, I generated a C# client from the openapi spec.
I noticed the generated API client will call paths relative to sandbox For example TokenizeApi.CreateTokenizeWithHttpInfoAsync
Notice the path ...PostAsync<TokenizeResponseSchema>("/digitization/static/1/0/tokenize",
...PostAsync<TokenizeResponseSchema>("/digitization/static/1/0/tokenize",
This works in sandbox, baseURL https://sandbox.api.mastercard.com/mdes + path /digitization/static/1/0/tokenize
https://sandbox.api.mastercard.com/mdes
/digitization/static/1/0/tokenize
However if I were to use the same client in mtf or prod, the resulting path would include /digitization/static/1/0, which would fail.
/digitization/static/1/0
According to the api reference, the environment domains are:
prod https://api.mastercard.com/mdes/digitization/1/0/tokenize mtf https://api.mastercard.com/mdes/digitization/mtf/1/0/tokenize sandbox https://sandbox.api.mastercard.com/mdes/digitization/static/1/0/tokenize
I could hack TokenizeApi (and the other Api classes) to ...PostAsync<TokenizeResponseSchema>("/1/0/tokenize", and use different baseURLs like
...PostAsync<TokenizeResponseSchema>("/1/0/tokenize",
https://api.mastercard.com/mdes/digitization https://api.mastercard.com/mdes/digitization/mtf https://sandbox.api.mastercard.com/mdes/digitization/static
Works, but it's a hack. What am I missing here?
https://sandbox.api.mastercard.com/mdes/digitization/static
Hey, Thomas. I researched a bit and thought you could create a wrapper around it to include config management, specifying the base url and define a config object that holds the base url for each environment
Heya, I generated a C# client from the openapi spec.
I noticed the generated API client will call paths relative to sandbox For example TokenizeApi.CreateTokenizeWithHttpInfoAsync
Notice the path
...PostAsync<TokenizeResponseSchema>("/digitization/static/1/0/tokenize",
This works in sandbox, baseURL
https://sandbox.api.mastercard.com/mdes
+ path/digitization/static/1/0/tokenize
However if I were to use the same client in mtf or prod, the resulting path would include
/digitization/static/1/0
, which would fail.According to the api reference, the environment domains are:
I could hack TokenizeApi (and the other Api classes) to
...PostAsync<TokenizeResponseSchema>("/1/0/tokenize",
and use different baseURLs likeWorks, but it's a hack. What am I missing here?