Interface IHummClient
An interface for the HummClient provided to allow mocking/stubbing etc.
Namespace: Yort.Humm.InStore
Assembly: Yort.Humm.InStore.dll
Syntax
public interface IHummClient
Methods
| Improve this Doc View SourceCreateKeyAsync(CreateKeyRequest)
Requests a new device key from Humm using the (initialisation) device token created in the Humm Seller (merchant) portal.
Declaration
Task<CreateKeyResponse> CreateKeyAsync(CreateKeyRequest request)
Parameters
Type | Name | Description |
---|---|---|
CreateKeyRequest | request | A CreateKeyRequest instance containing details of the request to make. |
Returns
Type | Description |
---|---|
Task<CreateKeyResponse> | A CreateKeyResponse instance containing the Humm response. |
Remarks
If the AutoUpdateClientToken argument is true and the request is successsful, the client will automatically call SetDeviceKey(String) with the value of Key for you, ensuring all future calls made with this client instance use the new token.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
See Also
| Improve this Doc View SourceInviteAsync(InviteRequest)
Sends an SMS to the customer's mobile phone inviting them to sign-up as a Humm customer.
Declaration
Task<InviteResponse> InviteAsync(InviteRequest request)
Parameters
Type | Name | Description |
---|---|---|
InviteRequest | request | A InviteRequest instance. |
Returns
Type | Description |
---|---|
Task<InviteResponse> |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
HummResponseSignatureException | Thrown if the response signature cannot be validated. |
ObjectDisposedException | Thrown if this instance has been disposed. |
InvalidOperationException | Thrown if this instance has not been initialised with a non-null device key (SetDeviceKey(String) and DeviceKey).. |
See Also
| Improve this Doc View SourceProcessAuthorisationAsync(ProcessAuthorisationRequest)
Requests an authorisation (for payment) be processed.
Declaration
Task<ProcessAuthorisationResponse> ProcessAuthorisationAsync(ProcessAuthorisationRequest request)
Parameters
Type | Name | Description |
---|---|---|
ProcessAuthorisationRequest | request | A ProcessAuthorisationRequest instance. |
Returns
Type | Description |
---|---|
Task<ProcessAuthorisationResponse> | A ProcessAuthorisationResponse instance. |
Remarks
This method is used to request a payment contract be setup for a specified amount using an approval code generated by the customer's device. It is the most common API call made to Humm in a 'happy path'.
If the AutoHandlePendingResponse value is true and the response indicates a Pending status then this call will raise the PendingAuthorisation event, wait for the specified retry interval, and the re-make the request again. This will be repeated until a non-pending status is returned, or an error is thrown from one of the handlers for the PendingAuthorisation event. In this case the response returned to the caller will be the final status (success/failure/error).
If AutoHandlePendingResponse is false then the first response will be returned to the caller and if the status is Pending it is up to the caller to repeat the request until a final state is reached.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
HummResponseSignatureException | Thrown if the response signature cannot be validated. |
ObjectDisposedException | Thrown if this instance has been disposed. |
InvalidOperationException | Thrown if this instance has not been initialised with a non-null device key (SetDeviceKey(String) and DeviceKey).. |
See Also
| Improve this Doc View SourceProcessSalesAdjustmentAsync(ProcessSalesAdjustmentRequest)
A sales adjustment is used to refund money in the case of an item that is returned or fails to ship etc.
Declaration
Task<ProcessSalesAdjustmentResponse> ProcessSalesAdjustmentAsync(ProcessSalesAdjustmentRequest request)
Parameters
Type | Name | Description |
---|---|---|
ProcessSalesAdjustmentRequest | request | A ProcessSalesAdjustmentRequest instance. |
Returns
Type | Description |
---|---|
Task<ProcessSalesAdjustmentResponse> | A ProcessSalesAdjustmentResponse instance. |
Remarks
A sales adjustment can be used for full or partial refund of previously approved ProcessAuthorisationAsync(ProcessAuthorisationRequest).
See the Humm documentation at https://docs.shophumm.com.au/pos/api/process_sales_adjustment/ and https://docs.shophumm.com.au/pos/api_information/retries_and_idempotency/
ProcessSalesAdjustmentReversalAsync(ProcessSalesAdjustmentReversalRequest)
This endpoint is used to process a reversal of a ProcessSalesAdjustmentAsync(ProcessSalesAdjustmentRequest) at the point-of-sale
Declaration
Task<ProcessSalesAdjustmentReversalResponse> ProcessSalesAdjustmentReversalAsync(ProcessSalesAdjustmentReversalRequest request)
Parameters
Type | Name | Description |
---|---|---|
ProcessSalesAdjustmentReversalRequest | request | A ProcessSalesAdjustmentReversalRequest instance. |
Returns
Type | Description |
---|---|
Task<ProcessSalesAdjustmentReversalResponse> | A ProcessSalesAdjustmentReversalResponse instance. |
Remarks
This is typically used to undo a refund in the case where it was made in error, or where the outcome was unknown (due to a network timeout/error) and an idempotent retry is not desirable. See the Humm documentation at; https://docs.shophumm.com.au/pos/api_information/retries_and_idempotency/
SendReceiptAsync(SendReceiptRequest)
Registers a POS transaction number against a prior authorisation.
Declaration
Task<SendReceiptResponse> SendReceiptAsync(SendReceiptRequest request)
Parameters
Type | Name | Description |
---|---|---|
SendReceiptRequest | request | A SendReceiptRequest instance. |
Returns
Type | Description |
---|---|
Task<SendReceiptResponse> | A SendReceiptResponse instance containing the result of the request. |
Remarks
This method is only used if the ClientTransactionReference was a temporary value and not a POS transaction number. In this case, when the POS finally assigns a permanent transaction number this method can be called to update the payment with the relevant reference.
See the Humm documentation at https://docs.shophumm.com.au/pos/api/send_receipt/ and https://docs.shophumm.com.au/pos/api_information/retries_and_idempotency/
SetDeviceKey(String)
Sets the device key used for generating digital signatures.
Declaration
void SetDeviceKey(string deviceKey)
Parameters
Type | Name | Description |
---|---|---|
String | deviceKey | A string containing the device key previously returns by a CreateKeyAsync(CreateKeyRequest) request. |
Remarks
The device key is usually provided via the HummClientConfiguration constructor argument if known before client is created. This method is typically used when registering a new device via CreateKeyAsync(CreateKeyRequest) and not electing to have the token automatically applied.
Null can be provided to clear the currently assigned device key (if any), prior to calling CreateKeyAsync(CreateKeyRequest) to generate a new device key.
See Also
Events
| Improve this Doc View SourcePendingAuthorisation
Raised when a ProcessAuthorisationResponse is received with a status of Pending and the AutoHandlePendingResponse property of the request was true.
Declaration
event EventHandler<PendingAuthorisationEventArgs> PendingAuthorisation
Event Type
Type | Description |
---|---|
EventHandler<PendingAuthorisationEventArgs> |
Remarks
While the AutoHandlePendingResponse option frees the client from having to handle the repeat API call logic to Humm in the case of a pending 'big things' purchase flow, this event can be used by the client to update it's UI to indicate the pending status and/or when the next recheck will occur if it desires.