fix(server): treat contributionAmount as cadence-unit (drop ×12)
ContributionAmountField now emits cadence-unit values (180 for $180/yr,
15 for $15/mo). Server endpoints were still multiplying annual by 12,
which would have charged $2160/yr instead of $180/yr after the form
ports in Tasks 2–3.
- helcim/subscription.post.js: recurringAmount = contributionAmount
(no more × 12 for annual)
- members/update-contribution.post.js: same drop in both Case 1
(free→paid) and Case 3 (paid→paid)
- slack.ts notifyNewMember: new positional `cadence` param so the
Slack notification suffix renders /yr or /mo instead of hardcoded
/month; all three call sites updated to pass member.billingCadence
- tests updated to match the new contract:
- helcim-subscription.test.js: annual tests now send the cadence-
unit amount (180, 600) and expect the same recurringAmount
- update-contribution.test.js: annual Case 1 and Case 3 tests
updated likewise
This commit is contained in:
parent
e0e7da5cca
commit
5023fb14ad
6 changed files with 24 additions and 22 deletions
|
|
@ -88,7 +88,7 @@ export default defineEventHandler(async (event) => {
|
|||
dateActivated: new Date().toISOString().split("T")[0],
|
||||
paymentPlanId: parseInt(paymentPlanId),
|
||||
customerCode,
|
||||
recurringAmount: cadence === 'annual' ? newAmount * 12 : newAmount,
|
||||
recurringAmount: newAmount,
|
||||
paymentMethod: "card",
|
||||
},
|
||||
idempotencyKey,
|
||||
|
|
@ -217,7 +217,7 @@ export default defineEventHandler(async (event) => {
|
|||
try {
|
||||
const subscriptionData = await updateHelcimSubscription(
|
||||
member.helcimSubscriptionId,
|
||||
{ recurringAmount: memberCadence === 'annual' ? newAmount * 12 : newAmount }
|
||||
{ recurringAmount: newAmount }
|
||||
);
|
||||
|
||||
await Member.findByIdAndUpdate(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue