feat(payments): add upsertPaymentFromHelcim helper with idempotent insert
Takes a Member doc + a normalized Helcim transaction and inserts a Payment row if helcimTransactionId is unseen. Maps helcim status paid→success, refunded→refunded, failed→failed; skips 'other'. opts.paymentType overrides the cadence fallback for mid-flight cadence changes. opts.sendConfirmation triggers a Resend payment-confirmation email ONLY on new inserts — swallows send failures so email trouble cannot break the upstream payment flow. The Resend template lives in server/emails/paymentConfirmation.js. It is CRA-safe (charity name + 'not an official donation receipt / tax receipts available later in 2026' disclaimer) so it can be used in either Task 8 branch without copy changes.
This commit is contained in:
parent
bf5a333117
commit
be7145f96c
3 changed files with 238 additions and 0 deletions
16
server/emails/paymentConfirmation.js
Normal file
16
server/emails/paymentConfirmation.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
export const paymentConfirmationEmail = ({ member, amount, paymentDate, transactionId }) => ({
|
||||
from: 'Ghost Guild <ghostguild@babyghosts.org>',
|
||||
to: member.email,
|
||||
subject: 'Payment confirmation — Ghost Guild',
|
||||
text: `Hi ${member.name || 'there'},
|
||||
|
||||
We received your payment of $${Number(amount).toFixed(2)} CAD on ${new Date(paymentDate).toLocaleDateString('en-CA')}.
|
||||
|
||||
Baby Ghosts Studio Development Fund (BN 788709350 RR 0001)
|
||||
Helcim transaction ID: ${transactionId}
|
||||
|
||||
This is a payment confirmation, not an official donation receipt for Canadian tax purposes. Tax receipts for eligible members will be available starting later in 2026.
|
||||
|
||||
Thanks for being part of Ghost Guild.
|
||||
`
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue