Interface IZipClient
An interface for the primary object used to access the Zip payments API.
Inherited Members
Namespace: Yort.Zip.InStore
Assembly: Yort.Zip.InStore.dll
Syntax
public interface IZipClient : IDisposable
Remarks
This interface exists primarily to support mocking/stubbing out of the api client for testing purposes. Ideally client code should use this interface as the type for all reference to the implementation instance to support runtime replacement of the implementation.
Methods
| Improve this Doc View SourceCancelOrderAsync(CancelOrderRequest)
Requests a previously created order be cancelled.
Declaration
Task<CancelOrderResponse> CancelOrderAsync(CancelOrderRequest request)
Parameters
Type | Name | Description |
---|---|---|
CancelOrderRequest | request | A CancelOrderRequest providing details of the order to be cancelled and operation/terminal that is requesting cancellation. |
Returns
Type | Description |
---|---|
Task<CancelOrderResponse> | A CancelOrderResponse instance. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
ArgumentException | Thrown if any sub-property of |
ZipApiException | Thrown if the Zip API returns an error response. |
UnauthorizedAccessException | Thrown if the request to Zip is unauthorised, or if insufficient/incorrect client authentication details have been provided via the ZipClientConfiguration. |
HttpRequestException | Thrown for some types of network and HTTP failures, usually where the request has not made it to the server for processing. |
OperationCanceledException | Thrown if a timeout occurs calling the Zip API. |
CommitOrderAsync(CommitOrderRequest)
Commits (completes) an order previously created via CreateOrderAsync(CreateOrderRequest) using the Auth flow.
Declaration
Task CommitOrderAsync(CommitOrderRequest request)
Parameters
Type | Name | Description |
---|---|---|
CommitOrderRequest | request | A CommitOrderRequest containing details of the order to commit. |
Returns
Type | Description |
---|---|
Task | A task that can be awaited to know when the operation has completed. If the task does not return an exception, the auth completed succesfully. Use the GetOrderStatusAsync(OrderStatusRequest) to confirm. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
ArgumentException | Thrown if any sub-property of |
ZipApiException | Thrown if the Zip API returns an error response. |
UnauthorizedAccessException | Thrown if the request to Zip is unauthorised, or if insufficient/incorrect client authentication details have been provided via the ZipClientConfiguration. |
HttpRequestException | Thrown for some types of network and HTTP failures, usually where the request has not made it to the server for processing. |
OperationCanceledException | Thrown if a timeout occurs calling the Zip API. |
CreateOrderAsync(CreateOrderRequest)
Creates a new order (payment) with Zip.
Declaration
Task<CreateOrderResponse> CreateOrderAsync(CreateOrderRequest request)
Parameters
Type | Name | Description |
---|---|---|
CreateOrderRequest | request | Details of the order to be created. |
Returns
Type | Description |
---|---|
Task<CreateOrderResponse> | Details of the created order if succesful, otherwise throws an exception. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
ArgumentException | Thrown if any sub-property of |
ZipApiException | Thrown if the Zip API returns an error response. |
UnauthorizedAccessException | Thrown if the request to Zip is unauthorised, or if insufficient/incorrect client authentication details have been provided via the ZipClientConfiguration. |
HttpRequestException | Thrown for some types of network and HTTP failures, usually where the request has not made it to the server for processing. |
OperationCanceledException | Thrown if a timeout occurs calling the Zip API. |
EnrolAsync(EnrolRequest)
Allows retrieval of the client id and secret used to request new auth tokens using the Zip device enrolment system.
Declaration
Task<EnrolResponse> EnrolAsync(EnrolRequest request)
Parameters
Type | Name | Description |
---|---|---|
EnrolRequest | request | A EnrolRequest instance providing details of the device to enrol. |
Returns
Type | Description |
---|---|
Task<EnrolResponse> | A EnrolResponse instance containing details of the token returned. |
Remarks
On a successful response, not only does the EnrolResponse returned contain the client id and secret so the caller can persist them for future sessions, but the client id and secret returned will be automatically applied to the configuration for this ZipClient instance.
NOTE: The 'enrollment system' is untested as the test account provided to the library authors did not support generating activation codes. This should work, but if it doesn't, please log an issue.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
ArgumentException | Thrown if any sub-property of |
ZipApiException | Thrown if the Zip API returns an error response. |
UnauthorizedAccessException | Thrown if the request to Zip is unauthorised, or if insufficient/incorrect client authentication details have been provided via the ZipClientConfiguration. |
HttpRequestException | Thrown for some types of network and HTTP failures, usually where the request has not made it to the server for processing. |
OperationCanceledException | Thrown if a timeout occurs calling the Zip API. |
GetOrderStatusAsync(OrderStatusRequest)
Requests the current status of the specified order from the Zip API.
Declaration
Task<OrderStatusResponse> GetOrderStatusAsync(OrderStatusRequest request)
Parameters
Type | Name | Description |
---|---|---|
OrderStatusRequest | request | A OrderStatusRequest providing details of the order to return the status of. |
Returns
Type | Description |
---|---|
Task<OrderStatusResponse> | If successful a OrderStatusResponse containing details of the specified order's status. Otherwise throws an exception. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
ArgumentException | Thrown if any sub-property of |
ZipApiException | Thrown if the Zip API returns an error response. |
UnauthorizedAccessException | Thrown if the request to Zip is unauthorised, or if insufficient/incorrect client authentication details have been provided via the ZipClientConfiguration. |
HttpRequestException | Thrown for some types of network and HTTP failures, usually where the request has not made it to the server for processing. |
OperationCanceledException | Thrown if a timeout occurs calling the Zip API. |
RefundOrderAsync(RefundOrderRequest)
Refunds some or all of the money taken as part of a previously completed order.
Declaration
Task<RefundOrderResponse> RefundOrderAsync(RefundOrderRequest request)
Parameters
Type | Name | Description |
---|---|---|
RefundOrderRequest | request | A RefundOrderRequest specifying details of the refund to create and the order to create it against. |
Returns
Type | Description |
---|---|
Task<RefundOrderResponse> | A RefundOrderResponse with details of a succesful outcome. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
ArgumentException | Thrown if any sub-property of |
ZipApiException | Thrown if the Zip API returns an error response. |
UnauthorizedAccessException | Thrown if the request to Zip is unauthorised, or if insufficient/incorrect client authentication details have been provided via the ZipClientConfiguration. |
HttpRequestException | Thrown for some types of network and HTTP failures, usually where the request has not made it to the server for processing. |
OperationCanceledException | Thrown if a timeout occurs calling the Zip API. |
RollbackOrderAsync(RollbackOrderRequest)
Rolls back (cancels/undoes) an order previously created via CreateOrderAsync(CreateOrderRequest) using the Auth flow.
Declaration
Task RollbackOrderAsync(RollbackOrderRequest request)
Parameters
Type | Name | Description |
---|---|---|
RollbackOrderRequest | request | A RollbackOrderRequest containing details of the order to rollback. |
Returns
Type | Description |
---|---|
Task | A task that can be awaited to know when the operation has completed. If the task does not return an exception, the auth rolled back succesfully. Use the GetOrderStatusAsync(OrderStatusRequest) to confirm. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
ArgumentException | Thrown if any sub-property of |
ZipApiException | Thrown if the Zip API returns an error response. |
UnauthorizedAccessException | Thrown if the request to Zip is unauthorised, or if insufficient/incorrect client authentication details have been provided via the ZipClientConfiguration. |
HttpRequestException | Thrown for some types of network and HTTP failures, usually where the request has not made it to the server for processing. |
OperationCanceledException | Thrown if a timeout occurs calling the Zip API. |