- Add Stripe and Mercado Pago providers for handling subscriptions. - Create billing repository and access services for managing billing records. - Implement webhook handlers for processing events from Stripe and Mercado Pago. - Add routes for checkout, canceling subscriptions, and retrieving billing status. - Introduce billing status management with appropriate state transitions. - Create tests for billing functionalities including webhook idempotency and provider resolution. - Document the billing module architecture, environment variables, and API endpoints.
21 lines
606 B
TypeScript
21 lines
606 B
TypeScript
import { describe, expect, it } from 'bun:test';
|
|
import { mapWebhookTypeToStatus } from './helpers';
|
|
|
|
describe('status-transitions', () => {
|
|
it('activated maps to ACTIVE', () => {
|
|
expect(mapWebhookTypeToStatus('activated')).toBe('ACTIVE');
|
|
});
|
|
|
|
it('updated maps to ACTIVE', () => {
|
|
expect(mapWebhookTypeToStatus('updated')).toBe('ACTIVE');
|
|
});
|
|
|
|
it('payment_failed maps to PAST_DUE', () => {
|
|
expect(mapWebhookTypeToStatus('payment_failed')).toBe('PAST_DUE');
|
|
});
|
|
|
|
it('cancelled maps to CANCELED', () => {
|
|
expect(mapWebhookTypeToStatus('cancelled')).toBe('CANCELED');
|
|
});
|
|
});
|