Interface IOrderProcessor
- Namespace
- VpnHood.AppLib.Abstractions.Billing
- Assembly
- VpnHood.AppLib.Abstractions.dll
Backend-specific purchase reconciliation. The billing provider talks to the platform store; the order processor talks to the account backend before and after the store purchase.
public interface IOrderProcessor
Methods
CompleteOrder(PurchaseProof, CancellationToken)
Hand the store's proof of purchase to the backend and wait until it is turned into access.
Task CompleteOrder(PurchaseProof purchaseProof, CancellationToken cancellationToken)
Parameters
purchaseProofPurchaseProofThe store's proof of purchase.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
- Task
A task that completes once the purchase is turned into access.
Exceptions
- InvalidOperationException
The store had not settled the payment by the processor's last try; a later call may succeed.
- ApiException
The account backend refused the request.
- OperationCanceledException
cancellationTokenwas canceled.
PreparePurchase(CancellationToken)
Called before the store's payment flow opens: answers what the purchase must be attributed to, and is the point where a backend could also reserve an order of its own.
Task<PurchaseAttribution> PreparePurchase(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Returns
- Task<PurchaseAttribution>
A task whose result is what the purchase must be attributed to.
Exceptions
- AuthenticationException
Nobody is signed in.