Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: authorize webhooks #57

Merged
merged 33 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
38ebc07
chore: :construction_worker: change ports on dev
peelar Dec 14, 2023
75e03f4
Update @types/node to version 20.10.4
peelar Dec 14, 2023
a6e7ab8
Add signature key to app config and authorize-net config
peelar Dec 14, 2023
085966f
Add webhooks to provider configuration
peelar Dec 14, 2023
9f5d1b3
Add createAuthorizeWebhooksFetch function for Authorize.net webhooks …
peelar Dec 14, 2023
879fb5a
Add AuthorizeNetWebhooksClient and refactor webhooks with AppInitializer
peelar Dec 14, 2023
bb503ba
refactor: :recycle: break up app-initializer
peelar Dec 18, 2023
3f8a739
Refactor webhook registration and resolve app configuration
peelar Dec 18, 2023
e70f5cc
Rename AuthorizeWebhookInitializer -> AuthorizeWebhookManager
peelar Dec 18, 2023
c54a4c7
extract AuthorizeWebhookVerifier; merge app-configurator
peelar Dec 18, 2023
c296c71
Move around
peelar Dec 19, 2023
f230656
Update transaction webhook log messages
peelar Dec 19, 2023
f33f36a
Move AuthorizeNetWebhookManager class
peelar Dec 19, 2023
ad7bccf
Fix various bugs and refactor code
peelar Dec 19, 2023
e14ec6e
Add new webhook event for priorAuthCapture
peelar Jan 2, 2024
7a77a4d
Refactor webhook signature verification and parsing
peelar Jan 4, 2024
8012654
Refactor createTransaction method in CreateTransactionClient
peelar Jan 4, 2024
4f90ee9
Remove logger.trace statement in TransactionInitializeSessionService
peelar Jan 4, 2024
0592da7
Update AuthorizeNetWebhookManager eventTypes
peelar Jan 4, 2024
8bc8503
Add Transaction GraphQL fragment
peelar Jan 4, 2024
88ee402
Add synchronized transaction functionality
peelar Jan 4, 2024
e4f3784
Refactor hosted payment page settings, hide order details
peelar Jan 5, 2024
53801ef
Refactor authorize-net-config and saleor-transaction-id-converter
peelar Jan 5, 2024
c63097b
Update README.md with Checkout UI instructions
peelar Jan 8, 2024
5dd7355
add comment
peelar Jan 8, 2024
3cec9d2
cleanup
peelar Jan 8, 2024
9c2e467
fix test
peelar Jan 8, 2024
c6e645a
build: :construction_worker: add changeset
peelar Jan 8, 2024
a868e7e
Update env.mjs file with required variables
peelar Jan 9, 2024
18b9826
Add micro package and its dependencies
peelar Jan 9, 2024
f92db39
Make webhook verification work
peelar Jan 9, 2024
9bbd123
address pr feedback
peelar Jan 9, 2024
a0db74e
Update amount in transaction initialize session webhook
peelar Jan 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💪

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Important:

- Checkout UI relies on "Authorize transactions instead of charging" in the Saleor Dashboard -> Configuration -> Channels -> [channel] settings.
- The `example` Checkout UI relies on the "Authorize transactions instead of charging" setting in the Saleor Dashboard -> Configuration -> Channels -> [channel] settings.

- The Saleor transaction id is stored in Authorize transaction `order.description`. Ideally, we would store it in `refId` but that field is max. 20 characters long and the Saleor transaction id is longer than that.
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"dev": "next dev --port 8001",
"build": "next build",
"start": "next start",
"lint": "next lint --fix --dir src",
Expand Down
22 changes: 22 additions & 0 deletions graphql/fragments/Transaction.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
fragment Transaction on TransactionItem {
id
pspReference
sourceObject: order {
... on Order {
total {
gross {
...Money
}
}
}
...OrderOrCheckoutLines
}
privateMetadata {
key
value
}
authorizedAmount {
amount
currency
}
}
17 changes: 1 addition & 16 deletions graphql/fragments/TransactionCancelationRequestedEvent.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,6 @@ fragment TransactionCancelationRequestedEvent on TransactionCancelationRequested
amount
}
transaction {
id
pspReference
sourceObject: order {
channel {
id
slug
}
}
privateMetadata {
key
value
}
authorizedAmount {
amount
currency
}
...Transaction
}
}
13 changes: 1 addition & 12 deletions graphql/fragments/TransactionChargeRequestedEvent.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,6 @@ fragment TransactionChargeRequestedEvent on TransactionChargeRequested {
actionType
}
transaction {
id
pspReference
sourceObject: order {
... on Order {
total {
gross {
...Money
}
}
}
...OrderOrCheckoutLines
}
...Transaction
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fragment TransactionInitializeSessionEvent on TransactionInitializeSession {
}
}
transaction {
id
...Transaction
}
sourceObject {
__typename
Expand Down
2 changes: 1 addition & 1 deletion graphql/fragments/TransactionProcessSessionEvent.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fragment TransactionProcessSessionEvent on TransactionProcessSession {
actionType
}
transaction {
id
...Transaction
}
sourceObject {
__typename
Expand Down
17 changes: 1 addition & 16 deletions graphql/fragments/TransactionRefundRequestedEvent.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,6 @@ fragment TransactionRefundRequestedEvent on TransactionRefundRequested {
actionType
}
transaction {
id
pspReference
sourceObject: order {
... on Order {
total {
gross {
...Money
}
}
}
...OrderOrCheckoutLines
}
privateMetadata {
key
value
}
...Transaction
}
}
4 changes: 2 additions & 2 deletions graphql/mutations/TransactionEventReport.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ mutation TransactionEventReport(
$transactionId: ID!
$amount: PositiveDecimal!
$availableActions: [TransactionActionEnum!]!
$externalUrl: String!
$externalUrl: String
$message: String
$pspReference: String!
$time: DateTime!
$time: DateTime
$type: TransactionEventTypeEnum!
) {
transactionEventReport(
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"type": "module",
"scripts": {
"dev": "pnpm generate && next dev",
"dev": "pnpm generate && next dev --port 8000",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please mention the ports in the readme

"build": "pnpm generate && next build",
"deploy": "tsx ./src/deploy.ts",
"start": "next start",
Expand Down Expand Up @@ -108,7 +108,7 @@
"@types/authorizenet": "1.0.1",
"@types/bluebird": "3.5.38",
"@types/lodash-es": "4.17.8",
"@types/node": "20.5.4",
"@types/node": "20.10.4",
"@types/omit-deep-lodash": "1.1.1",
"@types/react": "18.2.21",
"@types/react-dom": "18.2.7",
Expand Down
Loading