Skip to content

Commit

Permalink
Merge pull request #559 from Pinelab-studio/fix/payment-event
Browse files Browse the repository at this point in the history
feat(accept-blue): add ctx for event, log order history entry
  • Loading branch information
martijnvdbrug authored Jan 9, 2025
2 parents a5f8ce8 + cc5600d commit 3ac3e8e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/vendure-plugin-accept-blue/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.0.1 (2025-01-09)

- Add ctx to AcceptBlueTransactionEvent

# 2.0.0 (2024-12-19)

- Update Vendure to 3.1.1
Expand Down
2 changes: 1 addition & 1 deletion packages/vendure-plugin-accept-blue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pinelab/vendure-plugin-accept-blue",
"version": "2.0.0",
"version": "2.0.1",
"description": "Vendure plugin for creating subscriptions with the Accept Blue platform",
"author": "Martijn van de Brug <[email protected]>",
"homepage": "https://pinelab-plugins.com/",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,7 @@ export class AcceptBlueService implements OnApplicationBootstrap {
});
await this.eventBus.publish(
new AcceptBlueTransactionEvent(
ctx,
event.type,
event,
orderLine,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { OrderLine, VendureEvent } from '@vendure/core';
import { OrderLine, RequestContext, VendureEvent } from '@vendure/core';
import { AcceptBlueEvent } from '../types';

/**
* This event is fired when a transaction is received from Accept Blue.
*/
export class AcceptBlueTransactionEvent extends VendureEvent {
constructor(
ctx: RequestContext,
public status: 'succeeded' | 'updated' | 'declined' | 'error' | 'status',
/**
* The entire data object received from Accept Blue webhook
Expand Down
3 changes: 3 additions & 0 deletions packages/vendure-plugin-accept-blue/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { RequestContext } from '@vendure/core';
import type { Request } from 'express';

export interface CustomFields {
custom1?: string;
}
Expand Down Expand Up @@ -348,6 +350,7 @@ export interface AcceptBlueChargeTransaction extends AcceptBlueTransaction {
}

export interface AcceptBlueEvent {
ctx: RequestContext;
type: 'succeeded' | 'updated' | 'declined' | 'error' | 'status';
subType: string;
event: 'transaction' | 'batch';
Expand Down

0 comments on commit 3ac3e8e

Please sign in to comment.