Skip to content

Commit

Permalink
Add email receipt for stripe donations (#33)
Browse files Browse the repository at this point in the history
Co-authored-by: Jared Martin <jared@livechurchsolutions.org>
  • Loading branch information
tec7z7 and Jared Martin authored Oct 12, 2021
1 parent a818d48 commit 0442111
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/controllers/DonateController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class DonateController extends GivingBaseController {
if (secretKey === "") return this.json({}, 401);
const donationData = req.body;
const fundDonations: FundDonation[] = donationData.funds;
const paymentData: PaymentDetails = { amount: donationData.amount, currency: 'usd', customer: donationData.customerId, metadata: { funds: JSON.stringify(fundDonations), notes: donationData.notes } };
const paymentData: PaymentDetails = { amount: donationData.amount, currency: 'usd', customer: donationData.customerId, receipt_email: donationData.person.email, metadata: { funds: JSON.stringify(fundDonations), notes: donationData.notes } };
if (donationData.type === 'card') {
paymentData.payment_method = donationData.id;
paymentData.confirm = true;
Expand All @@ -64,7 +64,7 @@ export class DonateController extends GivingBaseController {
if (secretKey === "") return this.json({}, 401);

const { id, amount, customerId, type, billing_cycle_anchor, proration_behavior, interval, funds, person, notes } = req.body;
const paymentData: PaymentDetails = { payment_method_id: id, amount, currency: 'usd', customer: customerId, type, billing_cycle_anchor, proration_behavior, interval, metadata: { notes } };
const paymentData: PaymentDetails = { payment_method_id: id, amount, currency: 'usd', customer: customerId, receipt_email: person.email, type, billing_cycle_anchor, proration_behavior, interval, metadata: { notes } };
const gateways = await this.repositories.gateway.loadAll(au.churchId);
paymentData.productId = gateways[0].productId;

Expand Down
1 change: 1 addition & 0 deletions src/models/PaymentDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface PaymentDetails {
type?: string,
billing_cycle_anchor?: number,
proration_behavior?: string,
receipt_email?: string,
interval?: {},
metadata?: {}
}

0 comments on commit 0442111

Please sign in to comment.