From 9a87d95a41b5d30f5f76511dd1048e7a107172e4 Mon Sep 17 00:00:00 2001 From: Igor Zhutaiev Date: Sat, 28 Apr 2018 13:13:06 +0200 Subject: [PATCH] Allow to override HTTP transport by custom one --- adyen.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/adyen.go b/adyen.go index baaeecf..86c0eef 100644 --- a/adyen.go +++ b/adyen.go @@ -37,6 +37,7 @@ const ( // - Credentials instance of API creditials to connect to Adyen API // - Currency is a default request currency. Request data overrides this setting // - MerchantAccount is default merchant account to be used. Request data overrides this setting +// - client is http client instance // // Currency and MerchantAccount should be used only to store the data and be able to use it later. // Requests won't be automatically populated with given values @@ -117,6 +118,13 @@ func WithTimeout(d time.Duration) func(*Adyen) { } } +// WithTransport allows customer HTTP transports to be provider to the Adyen +func WithTransport(transport http.RoundTripper) func(*Adyen) { + return func(a *Adyen) { + a.client.Transport = transport + } +} + // WithCurrency allows for custom currencies to be provided to the Adyen. func WithCurrency(c string) func(*Adyen) { return func(a *Adyen) {