Skip to content

Commit 04b8e1b

Browse files
authored
feat: sync payment reviews (#146)
Backfill not supported as only open reviews can be fetched but not historical ones
1 parent 9543b54 commit 04b8e1b

16 files changed

+208
-9
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ This server synchronizes your Stripe account to a Postgres database. It can be a
102102
- [x] `product.updated` 🟢
103103
- [x] `radar.early_fraud_warning.created` 🟢
104104
- [x] `radar.early_fraud_warning.updated` 🟢
105+
- [x] `review.opened` 🟢
106+
- [x] `review.closed` 🟢
105107
- [x] `setup_intent.canceled` 🟢
106108
- [x] `setup_intent.created` 🟢
107109
- [x] `setup_intent.requires_action` 🟢

packages/fastify-app/src/test/helpers/mockStripe.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,59 @@ export const mockStripe = {
532532
})
533533
),
534534
},
535+
paymentIntents: {
536+
retrieve: vitest.fn((id) =>
537+
Promise.resolve({
538+
id,
539+
object: 'payment_intent',
540+
amount: 1000,
541+
amount_capturable: 0,
542+
amount_details: {
543+
tip: {},
544+
},
545+
amount_received: 0,
546+
application: null,
547+
application_fee_amount: null,
548+
automatic_payment_methods: null,
549+
canceled_at: null,
550+
cancellation_reason: null,
551+
capture_method: 'automatic',
552+
client_secret: 'pi_abc_secret_abc',
553+
confirmation_method: 'automatic',
554+
created: 1620984482,
555+
currency: 'usd',
556+
customer: null,
557+
description: 'Created by stripe.com/docs demo',
558+
invoice: null,
559+
last_payment_error: null,
560+
latest_charge: null,
561+
livemode: false,
562+
metadata: {},
563+
next_action: null,
564+
on_behalf_of: null,
565+
payment_method: null,
566+
payment_method_options: {
567+
card: {
568+
installments: null,
569+
mandate_options: null,
570+
network: null,
571+
request_three_d_secure: 'automatic',
572+
},
573+
},
574+
payment_method_types: ['card'],
575+
processing: null,
576+
receipt_email: null,
577+
review: null,
578+
setup_future_usage: null,
579+
shipping: null,
580+
statement_descriptor: null,
581+
statement_descriptor_suffix: null,
582+
status: 'requires_payment_method',
583+
transfer_data: null,
584+
transfer_group: null,
585+
})
586+
),
587+
},
535588
products: {
536589
retrieve: vitest.fn((id) =>
537590
Promise.resolve({

packages/fastify-app/src/test/stripe/payment_intent_amount_capturable_updated.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"canceled_at": null,
2020
"cancellation_reason": null,
2121
"capture_method": "automatic",
22-
"client_secret": "pi_1IqxJOJDPojXS6LN9uOebAea_secret_xAFUlXdrX2V3jcTfidX8eP14p",
22+
"client_secret": "pi_abc_secret_abc",
2323
"confirmation_method": "automatic",
2424
"created": 1620984482,
2525
"currency": "usd",

packages/fastify-app/src/test/stripe/payment_intent_canceled.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"canceled_at": null,
2020
"cancellation_reason": null,
2121
"capture_method": "automatic",
22-
"client_secret": "pi_1IqxJOJDPojXS6LN9uOebAea_secret_xAFUlXdrX2V3jcTfidX8eP14p",
22+
"client_secret": "pi_abc_secret_abc",
2323
"confirmation_method": "automatic",
2424
"created": 1620984482,
2525
"currency": "usd",

packages/fastify-app/src/test/stripe/payment_intent_created.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"canceled_at": null,
2020
"cancellation_reason": null,
2121
"capture_method": "automatic",
22-
"client_secret": "pi_1IqxJOJDPojXS6LN9uOebAea_secret_xAFUlXdrX2V3jcTfidX8eP14p",
22+
"client_secret": "pi_abc_secret_abc",
2323
"confirmation_method": "automatic",
2424
"created": 1620984482,
2525
"currency": "usd",

packages/fastify-app/src/test/stripe/payment_intent_partially_funded.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"canceled_at": null,
2020
"cancellation_reason": null,
2121
"capture_method": "automatic",
22-
"client_secret": "pi_1IqxJOJDPojXS6LN9uOebAea_secret_xAFUlXdrX2V3jcTfidX8eP14p",
22+
"client_secret": "pi_abc_secret_abc",
2323
"confirmation_method": "automatic",
2424
"created": 1620984482,
2525
"currency": "usd",

packages/fastify-app/src/test/stripe/payment_intent_payment_failed.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"canceled_at": null,
2020
"cancellation_reason": null,
2121
"capture_method": "automatic",
22-
"client_secret": "pi_1IqxJOJDPojXS6LN9uOebAea_secret_xAFUlXdrX2V3jcTfidX8eP14p",
22+
"client_secret": "pi_abc_secret_abc",
2323
"confirmation_method": "automatic",
2424
"created": 1620984482,
2525
"currency": "usd",

packages/fastify-app/src/test/stripe/payment_intent_processing.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"canceled_at": null,
2020
"cancellation_reason": null,
2121
"capture_method": "automatic",
22-
"client_secret": "pi_1IqxJOJDPojXS6LN9uOebAea_secret_xAFUlXdrX2V3jcTfidX8eP14p",
22+
"client_secret": "pi_abc_secret_abc",
2323
"confirmation_method": "automatic",
2424
"created": 1620984482,
2525
"currency": "usd",

packages/fastify-app/src/test/stripe/payment_intent_requires_action.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"canceled_at": null,
2020
"cancellation_reason": null,
2121
"capture_method": "automatic",
22-
"client_secret": "pi_1IqxJOJDPojXS6LN9uOebAea_secret_xAFUlXdrX2V3jcTfidX8eP14p",
22+
"client_secret": "pi_abc_secret_abc",
2323
"confirmation_method": "automatic",
2424
"created": 1620984482,
2525
"currency": "usd",

packages/fastify-app/src/test/stripe/payment_intent_succeeded.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"canceled_at": null,
2020
"cancellation_reason": null,
2121
"capture_method": "automatic",
22-
"client_secret": "pi_1IqxJOJDPojXS6LN9uOebAea_secret_xAFUlXdrX2V3jcTfidX8eP14p",
22+
"client_secret": "pi_abc_secret_abc",
2323
"confirmation_method": "automatic",
2424
"created": 1620984482,
2525
"currency": "usd",

0 commit comments

Comments
 (0)