public class LocalPaymentFlow extends BasePaymentFlow
Should only be created by a BasePaymentFlowManager implementation. Created by Philip Vendil on 2019-01-01.
clock, expectedTokenType, invoice, order, orderRequest, paymentRequired, preImageHash, request, requestData, settlement, tokenClaims
Constructor and Description |
---|
LocalPaymentFlow(PaymentRequired paymentRequired,
CachableHttpServletRequest request,
OrderRequest orderRequest,
RequestPolicyFactory requestPolicyFactory,
LightningHandler lightningHandler,
PaymentHandler paymentHandler,
TokenGenerator tokenGenerator,
CurrencyConverter currencyConverter,
org.jose4j.jwt.JwtClaims tokenClaims,
ExpectedTokenType expectedTokenType,
java.time.Duration notBeforeDuration)
Default constructor initializing the local PaymentFlow.
|
Modifier and Type | Method and Description |
---|---|
InvoiceResult |
checkSettledInvoice()
Unsupported operation in local payment flow.
|
SettlementResult |
getSettlement()
Method to retrieve a settlement and generate a settlement token.
|
protected java.lang.String |
getSourceNode() |
boolean |
isSettled()
Method to check if related payment is settled by the end user.
|
InvoiceResult |
requestPayment()
Method to create and order and an invoice in local lightning handler..
|
getCurrencyConverter, getLightningHandler, getNotBeforeDate, getPaymentHandler, getPreImageHash, getRequestPolicyFactory, getTokenGenerator, getTokenIssuer, isPaymentRequired, isPayPerRequest, markAsExecuted
public LocalPaymentFlow(PaymentRequired paymentRequired, CachableHttpServletRequest request, OrderRequest orderRequest, RequestPolicyFactory requestPolicyFactory, LightningHandler lightningHandler, PaymentHandler paymentHandler, TokenGenerator tokenGenerator, CurrencyConverter currencyConverter, org.jose4j.jwt.JwtClaims tokenClaims, ExpectedTokenType expectedTokenType, java.time.Duration notBeforeDuration)
paymentRequired
- the annotation signaling the requested resource requires payment.
Never null.request
- the related HTTP Request in this phase of the payment flow.orderRequest
- the orderRequest calculated either from paymentRequired annotation
of extracted from JWT token depending on state in the payment flow.requestPolicyFactory
- the used RequestPolicyFactory. Never null.lightningHandler
- the used LightningHandler. Never null.paymentHandler
- the used PaymentHandler. Never null.tokenGenerator
- the user TokenGenerator, should never be null.currencyConverter
- the used CurrencyConverter.Never null.tokenClaims
- all claims parsed from the related JWT token. Null in no related token exists in current state.expectedTokenType
- the expected type of JWT token expected in this state of the payment flow.notBeforeDuration
- the duration for the not before field in generated
JWT tokens. This can be positive if it should be valid in the future, or negative
to support skewed clocked between systems. Use null if no not before date should
be set in generated JWT tokens.public InvoiceResult requestPayment() throws java.lang.IllegalArgumentException, java.io.IOException, InternalErrorException, InvalidCurrencyException, TokenException
java.lang.IllegalArgumentException
- if user specified parameters (used by the constructor) was invalid.java.io.IOException
- if communication problems occurred with underlying components.InternalErrorException
- if internal errors occurred processing the method.InvalidCurrencyException
- if problems occurred converting the currency in the order to the one
used in the invoice.TokenException
- if problems occurred generating or validating related JWT Token.public boolean isSettled() throws AlreadyExecutedException, java.lang.IllegalArgumentException, java.io.IOException, InternalErrorException
java.lang.IllegalArgumentException
- if user specified parameters (used by the constructor) was invalid.java.io.IOException
- if communication problems occurred with underlying components.InternalErrorException
- if internal errors occurred processing the method.AlreadyExecutedException
- if related payment is pay per request and is already executed.public SettlementResult getSettlement() throws AlreadyExecutedException, java.lang.IllegalArgumentException, java.io.IOException, InternalErrorException, TokenException
java.lang.IllegalArgumentException
- if user specified parameters (used by the constructor) was invalid.java.io.IOException
- if communication problems occurred with underlying components.InternalErrorException
- if internal errors occurred processing the method.TokenException
- if problem occurred generating the settlement token.AlreadyExecutedException
- if related payment is pay per request and is already executed.public InvoiceResult checkSettledInvoice() throws InternalErrorException
InternalErrorException
- if internal errors occurred processing the method.protected java.lang.String getSourceNode()
getSourceNode
in class BasePaymentFlow