Skip to content

Commit

Permalink
Add missing permissions to typings (#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
lkostrowski authored Nov 29, 2023
1 parent 12ee18d commit 3c68c4c
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/happy-seahorses-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@saleor/app-sdk": minor
---

Added definition for payment and transaction events. From now on, sync webhook factory will autocomplete response expected by Saleor
5 changes: 5 additions & 0 deletions .changeset/proud-llamas-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@saleor/app-sdk": minor
---

Added new permission - MANAGE_ORDERS_IMPORT - to Permission type
5 changes: 5 additions & 0 deletions .changeset/thirty-doors-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@saleor/app-sdk": minor
---

Added missing payment transactions sync events
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"react-dom": "18.2.0",
"tsm": "^2.2.2",
"tsup": "^6.2.3",
"typescript": "^4.9.5",
"typescript": "4.9.5",
"vi-fetch": "^0.8.0",
"vite": "^4.0.4",
"vitest": "^0.28.1"
Expand Down
6 changes: 5 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 71 additions & 0 deletions src/handlers/next/saleor-webhooks/sync-webhook-response-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,77 @@ export type SyncWebhookResponsesMap = {
externalUrl?: string;
message?: string;
};
PAYMENT_METHOD_PROCESS_TOKENIZATION_SESSION:
| {
result: "SUCCESSFULLY_TOKENIZED";
id: string;
data: unknown;
}
| {
result: "ADDITIONAL_ACTION_REQUIRED";
id: string;
data: unknown;
}
| {
result: "PENDING";
data: unknown;
}
| {
result: "FAILED_TO_TOKENIZE";
error: string;
};
PAYMENT_METHOD_INITIALIZE_TOKENIZATION_SESSION:
| {
result: "SUCCESSFULLY_TOKENIZED";
id: string;
data: unknown;
}
| {
result: "ADDITIONAL_ACTION_REQUIRED";
id: string;
data: unknown;
}
| {
result: "PENDING";
data: unknown;
}
| {
result: "FAILED_TO_TOKENIZE";
error: string;
};
PAYMENT_GATEWAY_INITIALIZE_TOKENIZATION_SESSION:
| {
result: "SUCCESSFULLY_INITIALIZED";
data: unknown;
}
| {
result: "FAILED_TO_INITIALIZE";
error: string;
};
STORED_PAYMENT_METHOD_DELETE_REQUESTED:
| {
result: "SUCCESSFULLY_DELETED";
}
| {
result: "FAILED_TO_DELETE";
error: string;
};
LIST_STORED_PAYMENT_METHODS: {
paymentMethods: Array<{
id: string;
supportedPaymentFlows: Array<"INTERACTIVE">;
type: string;
creditCardInfo?: {
brand: string;
lastDigits: string;
expMonth: string;
expYear: string;
firstDigits?: string;
};
name?: string;
data?: unknown;
}>;
};
};

/**
Expand Down
8 changes: 7 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export type Permission =
| "MANAGE_GIFT_CARD"
| "MANAGE_MENUS"
| "MANAGE_ORDERS"
| "MANAGE_ORDERS_IMPORT"
| "MANAGE_PAGES"
| "MANAGE_PAGE_TYPES_AND_ATTRIBUTES"
| "HANDLE_PAYMENTS"
Expand Down Expand Up @@ -187,7 +188,12 @@ export type SyncWebhookEventType =
| "TRANSACTION_CANCELATION_REQUESTED"
| "PAYMENT_GATEWAY_INITIALIZE_SESSION"
| "TRANSACTION_INITIALIZE_SESSION"
| "TRANSACTION_PROCESS_SESSION";
| "TRANSACTION_PROCESS_SESSION"
| "LIST_STORED_PAYMENT_METHODS"
| "STORED_PAYMENT_METHOD_DELETE_REQUESTED"
| "PAYMENT_GATEWAY_INITIALIZE_TOKENIZATION_SESSION"
| "PAYMENT_METHOD_INITIALIZE_TOKENIZATION_SESSION"
| "PAYMENT_METHOD_PROCESS_TOKENIZATION_SESSION";

export interface AppExtension {
/** Name which will be displayed in the dashboard */
Expand Down

0 comments on commit 3c68c4c

Please sign in to comment.