feat: add per-org SMS wallet with adm panel and header credit
Bill all platform SMS (including OTP), allow negative balance with manual/auto cutoffs, and support own-panel bypass without wallet debit.
This commit is contained in:
@@ -15,7 +15,7 @@ import type {
|
||||
} from '@mento/shared';
|
||||
import { SMS_CAMPAIGN_CHUNK_SIZE } from '@mento/shared';
|
||||
import { PrismaService } from '../prisma/prisma.service';
|
||||
import { SmsService } from '../common/sms.service';
|
||||
import { SmsGatewayService } from '../sms-billing/sms-gateway.service';
|
||||
import { renderSmsText } from '../common/sms-text';
|
||||
import {
|
||||
type Actor,
|
||||
@@ -45,7 +45,7 @@ function leadAccessWhere(baseActor: Actor): Prisma.LeadWhereInput {
|
||||
export class SmsCampaignsService {
|
||||
constructor(
|
||||
private readonly prisma: PrismaService,
|
||||
private readonly sms: SmsService,
|
||||
private readonly sms: SmsGatewayService,
|
||||
private readonly tracking: TrackingService,
|
||||
private readonly outboundSms: OutboundSmsLogService,
|
||||
) {}
|
||||
@@ -583,10 +583,12 @@ export class SmsCampaignsService {
|
||||
body: withTokens,
|
||||
});
|
||||
|
||||
const result = await this.sms.sendSmsDetailed(
|
||||
recipient.mobile,
|
||||
personalized.body,
|
||||
);
|
||||
const result = await this.sms.send({
|
||||
organizationId: campaign.organizationId,
|
||||
phone: recipient.mobile,
|
||||
text: personalized.body,
|
||||
source: 'campaign',
|
||||
});
|
||||
await this.outboundSms.record({
|
||||
organizationId: campaign.organizationId,
|
||||
personId: recipient.personId,
|
||||
|
||||
Reference in New Issue
Block a user