SudoSOS Back-end API / stripe / StripeWebhookService
Class: StripeWebhookService ​
Extends ​
Constructors ​
Constructor ​
new StripeWebhookService(manager?): StripeWebhookService;Parameters ​
| Parameter | Type |
|---|---|
manager? | EntityManager |
Returns ​
StripeWebhookService
Overrides ​
Properties ​
| Property | Modifier | Type | Inherited from |
|---|---|---|---|
manager | protected | EntityManager | WithManager.manager |
Methods ​
configureLogger() ​
protected configureLogger(logger): void;Parameters ​
| Parameter | Type |
|---|---|
logger | Logger |
Returns ​
void
Inherited from ​
constructWebhookEvent() ​
constructWebhookEvent(body, signature): Promise<Event>;Validate a Stripe webhook event
Parameters ​
| Parameter | Type | Description |
|---|---|---|
body | any | - |
signature | string | string[] | - |
Returns ​
Promise<Event>
createNewPaymentIntentStatus() ​
createNewPaymentIntentStatus(paymentIntentId, state): Promise<StripePaymentIntentStatus>;Append a new status to a StripePaymentIntent and, when the new state is terminal, run the side effects for whatever the intent is linked to. On SUCCEEDED this settles the deposit (and marks any linked PaymentRequest as paid) or finalises the terminal payment; on CANCELLED it propagates a Stripe-initiated cancellation to a linked terminal payment.
Rejects when the intent does not exist, when the status already exists, or when it would conflict with a mutually exclusive terminal state already present (SUCCEEDED/FAILED/CANCELLED).
Parameters ​
| Parameter | Type | Description |
|---|---|---|
paymentIntentId | number | The local (database) ID of the payment intent. |
state | StripePaymentIntentState | The new state to record. |
Returns ​
Promise<StripePaymentIntentStatus>
The persisted StripePaymentIntentStatus.
handleWebhookEvent() ​
handleWebhookEvent(event): Promise<void>;Handle the event by making the appropriate database additions
Parameters ​
| Parameter | Type | Description |
|---|---|---|
event | Event | {Stripe.Event} Event received from Stripe webhook |
Returns ​
Promise<void>