-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9aebe1b
commit dcdc1a5
Showing
14 changed files
with
1,183 additions
and
911 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,154 +1,162 @@ | ||
using Checkout.Accounts; | ||
using Checkout.Balances; | ||
using Checkout.Customers; | ||
using Checkout.Disputes; | ||
using Checkout.Forex; | ||
using Checkout.Instruments; | ||
using Checkout.Payments; | ||
using Checkout.Payments.Hosted; | ||
using Checkout.Payments.Links; | ||
using Checkout.Risk; | ||
using Checkout.Sessions; | ||
using Checkout.Tokens; | ||
using Checkout.Transfers; | ||
using Checkout.Workflows; | ||
|
||
namespace Checkout | ||
{ | ||
public class CheckoutApi : ICheckoutApi | ||
{ | ||
private readonly ITokensClient _tokensClient; | ||
private readonly ICustomersClient _customersClient; | ||
private readonly IPaymentsClient _paymentsClient; | ||
private readonly IInstrumentsClient _instrumentsClient; | ||
private readonly IDisputesClient _disputesClient; | ||
private readonly IRiskClient _riskClient; | ||
private readonly IForexClient _forexClient; | ||
private readonly IWorkflowsClient _workflowsClient; | ||
private readonly ISessionsClient _sessionsClient; | ||
private readonly IAccountsClient _accountsClient; | ||
private readonly IPaymentLinksClient _paymentLinksClient; | ||
private readonly IHostedPaymentsClient _hostedPaymentsClient; | ||
private readonly IBalancesClient _balancesClient; | ||
private readonly ITransfersClient _transfersClient; | ||
|
||
public CheckoutApi(CheckoutConfiguration configuration) | ||
{ | ||
var baseApiClient = BaseApiClient(configuration); | ||
_tokensClient = new TokensClient(baseApiClient, configuration); | ||
_customersClient = new CustomersClient(baseApiClient, configuration); | ||
_paymentsClient = new PaymentsClient(baseApiClient, configuration); | ||
_instrumentsClient = new InstrumentsClient(baseApiClient, configuration); | ||
_disputesClient = new DisputesClient(baseApiClient, configuration); | ||
_riskClient = new RiskClient(baseApiClient, configuration); | ||
_forexClient = new ForexClient(baseApiClient, configuration); | ||
_workflowsClient = new WorkflowsClient(baseApiClient, configuration); | ||
_sessionsClient = new SessionsClient(baseApiClient, configuration); | ||
_accountsClient = new AccountsClient( | ||
baseApiClient, | ||
FilesApiClient(configuration), | ||
configuration); | ||
_paymentLinksClient = new PaymentLinksClient(baseApiClient, configuration); | ||
_hostedPaymentsClient = new HostedPaymentsClient(baseApiClient, configuration); | ||
_balancesClient = new BalancesClient(BalancesApiClient(configuration), | ||
configuration); | ||
_transfersClient = new TransfersClient(TransfersApiClient(configuration), | ||
configuration); | ||
} | ||
|
||
private static ApiClient BaseApiClient(CheckoutConfiguration configuration) | ||
{ | ||
return new ApiClient(configuration.HttpClientFactory, | ||
configuration.Environment.GetAttribute<EnvironmentAttribute>().ApiUri); | ||
} | ||
|
||
private static ApiClient FilesApiClient(CheckoutConfiguration configuration) | ||
{ | ||
return new ApiClient(configuration.HttpClientFactory, | ||
configuration.Environment.GetAttribute<EnvironmentAttribute>().FilesApiUri); | ||
} | ||
|
||
private static ApiClient TransfersApiClient(CheckoutConfiguration configuration) | ||
{ | ||
return new ApiClient(configuration.HttpClientFactory, | ||
configuration.Environment.GetAttribute<EnvironmentAttribute>().TransfersApiUri); | ||
} | ||
|
||
private static ApiClient BalancesApiClient(CheckoutConfiguration configuration) | ||
{ | ||
return new ApiClient(configuration.HttpClientFactory, | ||
configuration.Environment.GetAttribute<EnvironmentAttribute>().BalancesApiUri); | ||
} | ||
|
||
|
||
public ITokensClient TokensClient() | ||
{ | ||
return _tokensClient; | ||
} | ||
|
||
public ICustomersClient CustomersClient() | ||
{ | ||
return _customersClient; | ||
} | ||
|
||
public IPaymentsClient PaymentsClient() | ||
{ | ||
return _paymentsClient; | ||
} | ||
|
||
public IInstrumentsClient InstrumentsClient() | ||
{ | ||
return _instrumentsClient; | ||
} | ||
|
||
public IDisputesClient DisputesClient() | ||
{ | ||
return _disputesClient; | ||
} | ||
|
||
public IRiskClient RiskClient() | ||
{ | ||
return _riskClient; | ||
} | ||
|
||
public IForexClient ForexClient() | ||
{ | ||
return _forexClient; | ||
} | ||
|
||
public IWorkflowsClient WorkflowsClient() | ||
{ | ||
return _workflowsClient; | ||
} | ||
|
||
public ISessionsClient SessionsClient() | ||
{ | ||
return _sessionsClient; | ||
} | ||
|
||
public IAccountsClient AccountsClient() | ||
{ | ||
return _accountsClient; | ||
} | ||
|
||
public IPaymentLinksClient PaymentLinksClient() | ||
{ | ||
return _paymentLinksClient; | ||
} | ||
|
||
public IHostedPaymentsClient HostedPaymentsClient() | ||
{ | ||
return _hostedPaymentsClient; | ||
} | ||
|
||
public IBalancesClient BalancesClient() | ||
{ | ||
return _balancesClient; | ||
} | ||
|
||
public ITransfersClient TransfersClient() | ||
{ | ||
return _transfersClient; | ||
} | ||
} | ||
} | ||
using Checkout.Accounts; | ||
using Checkout.Balances; | ||
using Checkout.Customers; | ||
using Checkout.Disputes; | ||
using Checkout.Forex; | ||
using Checkout.Instruments; | ||
using Checkout.Payments; | ||
using Checkout.Payments.Hosted; | ||
using Checkout.Payments.Links; | ||
using Checkout.Reports; | ||
using Checkout.Risk; | ||
using Checkout.Sessions; | ||
using Checkout.Tokens; | ||
using Checkout.Transfers; | ||
using Checkout.Workflows; | ||
|
||
namespace Checkout | ||
{ | ||
public class CheckoutApi : ICheckoutApi | ||
{ | ||
private readonly ITokensClient _tokensClient; | ||
private readonly ICustomersClient _customersClient; | ||
private readonly IPaymentsClient _paymentsClient; | ||
private readonly IInstrumentsClient _instrumentsClient; | ||
private readonly IDisputesClient _disputesClient; | ||
private readonly IRiskClient _riskClient; | ||
private readonly IForexClient _forexClient; | ||
private readonly IWorkflowsClient _workflowsClient; | ||
private readonly ISessionsClient _sessionsClient; | ||
private readonly IAccountsClient _accountsClient; | ||
private readonly IPaymentLinksClient _paymentLinksClient; | ||
private readonly IHostedPaymentsClient _hostedPaymentsClient; | ||
private readonly IBalancesClient _balancesClient; | ||
private readonly ITransfersClient _transfersClient; | ||
private readonly IReportsClient _reportsClient; | ||
|
||
public CheckoutApi(CheckoutConfiguration configuration) | ||
{ | ||
var baseApiClient = BaseApiClient(configuration); | ||
_tokensClient = new TokensClient(baseApiClient, configuration); | ||
_customersClient = new CustomersClient(baseApiClient, configuration); | ||
_paymentsClient = new PaymentsClient(baseApiClient, configuration); | ||
_instrumentsClient = new InstrumentsClient(baseApiClient, configuration); | ||
_disputesClient = new DisputesClient(baseApiClient, configuration); | ||
_riskClient = new RiskClient(baseApiClient, configuration); | ||
_forexClient = new ForexClient(baseApiClient, configuration); | ||
_workflowsClient = new WorkflowsClient(baseApiClient, configuration); | ||
_sessionsClient = new SessionsClient(baseApiClient, configuration); | ||
_accountsClient = new AccountsClient( | ||
baseApiClient, | ||
FilesApiClient(configuration), | ||
configuration); | ||
_paymentLinksClient = new PaymentLinksClient(baseApiClient, configuration); | ||
_hostedPaymentsClient = new HostedPaymentsClient(baseApiClient, configuration); | ||
_balancesClient = new BalancesClient(BalancesApiClient(configuration), | ||
configuration); | ||
_transfersClient = new TransfersClient(TransfersApiClient(configuration), | ||
configuration); | ||
_reportsClient = new ReportsClient(baseApiClient, configuration); | ||
} | ||
|
||
private static ApiClient BaseApiClient(CheckoutConfiguration configuration) | ||
{ | ||
return new ApiClient(configuration.HttpClientFactory, | ||
configuration.Environment.GetAttribute<EnvironmentAttribute>().ApiUri); | ||
} | ||
|
||
private static ApiClient FilesApiClient(CheckoutConfiguration configuration) | ||
{ | ||
return new ApiClient(configuration.HttpClientFactory, | ||
configuration.Environment.GetAttribute<EnvironmentAttribute>().FilesApiUri); | ||
} | ||
|
||
private static ApiClient TransfersApiClient(CheckoutConfiguration configuration) | ||
{ | ||
return new ApiClient(configuration.HttpClientFactory, | ||
configuration.Environment.GetAttribute<EnvironmentAttribute>().TransfersApiUri); | ||
} | ||
|
||
private static ApiClient BalancesApiClient(CheckoutConfiguration configuration) | ||
{ | ||
return new ApiClient(configuration.HttpClientFactory, | ||
configuration.Environment.GetAttribute<EnvironmentAttribute>().BalancesApiUri); | ||
} | ||
|
||
|
||
public ITokensClient TokensClient() | ||
{ | ||
return _tokensClient; | ||
} | ||
|
||
public ICustomersClient CustomersClient() | ||
{ | ||
return _customersClient; | ||
} | ||
|
||
public IPaymentsClient PaymentsClient() | ||
{ | ||
return _paymentsClient; | ||
} | ||
|
||
public IInstrumentsClient InstrumentsClient() | ||
{ | ||
return _instrumentsClient; | ||
} | ||
|
||
public IDisputesClient DisputesClient() | ||
{ | ||
return _disputesClient; | ||
} | ||
|
||
public IRiskClient RiskClient() | ||
{ | ||
return _riskClient; | ||
} | ||
|
||
public IForexClient ForexClient() | ||
{ | ||
return _forexClient; | ||
} | ||
|
||
public IWorkflowsClient WorkflowsClient() | ||
{ | ||
return _workflowsClient; | ||
} | ||
|
||
public ISessionsClient SessionsClient() | ||
{ | ||
return _sessionsClient; | ||
} | ||
|
||
public IAccountsClient AccountsClient() | ||
{ | ||
return _accountsClient; | ||
} | ||
|
||
public IPaymentLinksClient PaymentLinksClient() | ||
{ | ||
return _paymentLinksClient; | ||
} | ||
|
||
public IHostedPaymentsClient HostedPaymentsClient() | ||
{ | ||
return _hostedPaymentsClient; | ||
} | ||
|
||
public IBalancesClient BalancesClient() | ||
{ | ||
return _balancesClient; | ||
} | ||
|
||
public ITransfersClient TransfersClient() | ||
{ | ||
return _transfersClient; | ||
} | ||
|
||
public IReportsClient ReportsClient() | ||
{ | ||
return _reportsClient; | ||
} | ||
} | ||
} |
Oops, something went wrong.