Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Class ApiService

Api service for bolt

Inheritance
System.Object
ApiService
Implements
Namespace: EPiServer.Commerce.Bolt
Assembly: EPiServer.Commerce.Bolt.dll
Version: 14.26.0
Syntax
public class ApiService : Object, IApiService

Constructors

ApiService(IHttpClientFactory, ILogger<ApiService>, BoltOptions)

Default ccontructor

Declaration
public ApiService(IHttpClientFactory httpClientFactory, ILogger<ApiService> logger, BoltOptions boltOptions)
Parameters
Type Name Description
System.Net.Http.IHttpClientFactory httpClientFactory
Microsoft.Extensions.Logging.ILogger<ApiService> logger

The logger

BoltOptions boltOptions

Methods

AddAddressAsync(Address, String)

Adds and address to an account in Bolt

Declaration
public Task<Address> AddAddressAsync(Address address, string token)
Parameters
Type Name Description
Address address
System.String token

The token

Returns
Type Description
System.Threading.Tasks.Task<Address>

A System.Threading.Tasks.Task<>

AddPaymentMethodAsync(CreatePaymentMethod, String)

Adds a payment methods to Bolt

Declaration
public Task<PaymentMethod> AddPaymentMethodAsync(CreatePaymentMethod paymentMethod, string token)
Parameters
Type Name Description
CreatePaymentMethod paymentMethod

The payment method

System.String token

The token.

Returns
Type Description
System.Threading.Tasks.Task<PaymentMethod>

A System.Threading.Tasks.Task<>

AuthorizeAsync(Authorize, String)

Authorize a tokenized card

Declaration
public Task<AuthorizeResponse> AuthorizeAsync(Authorize authorize, string token)
Parameters
Type Name Description
Authorize authorize

The authorize request

System.String token

The token

Returns
Type Description
System.Threading.Tasks.Task<AuthorizeResponse>

A System.Threading.Tasks.Task<>

CaptureAsync(Capture)

Captures an authorized trasnaction

Declaration
public Task<Transaction> CaptureAsync(Capture capture)
Parameters
Type Name Description
Capture capture

The capture request

Returns
Type Description
System.Threading.Tasks.Task<Transaction>

A System.Threading.Tasks.Task<>

CreateAccountAsync(CreateAccount)

Creates and account in Bolt

Declaration
public Task<Account> CreateAccountAsync(CreateAccount account)
Parameters
Type Name Description
CreateAccount account

The account object

Returns
Type Description
System.Threading.Tasks.Task<Account>

A System.Threading.Tasks.Task<>

DeleteAddressAsync(String, String)

Deletete and address in bolt

Declaration
public Task<string> DeleteAddressAsync(string id, string token)
Parameters
Type Name Description
System.String id
System.String token

The token

Returns
Type Description
System.Threading.Tasks.Task<System.String>

A System.Threading.Tasks.Task

DeletePaymentMethodAsync(String, String)

Delete the payment method from Bolt

Declaration
public Task<string> DeletePaymentMethodAsync(string id, string token)
Parameters
Type Name Description
System.String id
System.String token

The token

Returns
Type Description
System.Threading.Tasks.Task<System.String>

A System.Threading.Tasks.Task

DetectAccountAsync(String)

Detects an account by email

Declaration
public Task<Account> DetectAccountAsync(string email)
Parameters
Type Name Description
System.String email

The email

Returns
Type Description
System.Threading.Tasks.Task<Account>

A System.Threading.Tasks.Task<>

EditAddressAsync(Address, String)

Edits and address in Bolt

Declaration
public Task<Address> EditAddressAsync(Address address, string token)
Parameters
Type Name Description
Address address
System.String token

The token

Returns
Type Description
System.Threading.Tasks.Task<Address>

A System.Threading.Tasks.Task<>.

GetAccountAsync(String)

Get account from bolt

Declaration
public Task<Account> GetAccountAsync(string token)
Parameters
Type Name Description
System.String token

The access token

Returns
Type Description
System.Threading.Tasks.Task<Account>

A System.Threading.Tasks.Task<>

GetTokenAsync(String, String)

Gets a tokem for using with the api service.

Declaration
public Task<Token> GetTokenAsync(string code, string scope)
Parameters
Type Name Description
System.String code

The code

System.String scope

The scope

Returns
Type Description
System.Threading.Tasks.Task<Token>

A System.Threading.Tasks.Task<>

RefundAsync(Refund)

Refunds a transaction

Declaration
public Task<Transaction> RefundAsync(Refund refund)
Parameters
Type Name Description
Refund refund

The refund request

Returns
Type Description
System.Threading.Tasks.Task<Transaction>

A System.Threading.Tasks.Task<>

SavedCardAuthorizeAsync(AuthorizeSavedCard, String)

Authorize a tokenized card

Declaration
public Task<AuthorizeResponse> SavedCardAuthorizeAsync(AuthorizeSavedCard authorize, string token)
Parameters
Type Name Description
AuthorizeSavedCard authorize

The authorize saved card request

System.String token

The token

Returns
Type Description
System.Threading.Tasks.Task<AuthorizeResponse>

A System.Threading.Tasks.Task<>

VoidAsync(Void)

Voids a transaction

Declaration
public Task<Transaction> VoidAsync(Void voidRequest)
Parameters
Type Name Description
Void voidRequest

The void request

Returns
Type Description
System.Threading.Tasks.Task<Transaction>

A System.Threading.Tasks.Task<>

Implements