mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Merge pull request #34730 from overleaf/rh-tax-id-verify
Validate tax ids and send emails on failed verification GitOrigin-RevId: 84d53fdaf00d7b23ced22dd540a071e3028ced93
This commit is contained in:
@@ -900,6 +900,91 @@ describe('EmailBuilder', function () {
|
||||
})
|
||||
})
|
||||
|
||||
describe('taxIdInvalidVat', function () {
|
||||
beforeEach(function (ctx) {
|
||||
ctx.emailAddress = 'customer@example.com'
|
||||
ctx.opts = {
|
||||
to: ctx.emailAddress,
|
||||
stripeCustomerId: 'cus_123456789',
|
||||
}
|
||||
ctx.email = ctx.EmailBuilder.buildEmail('taxIdInvalidVat', ctx.opts)
|
||||
ctx.dom = cheerio.load(ctx.email.html)
|
||||
})
|
||||
|
||||
it('should build the email', function (ctx) {
|
||||
expect(ctx.email.html).to.exist
|
||||
expect(ctx.email.text).to.exist
|
||||
})
|
||||
|
||||
describe('HTML email', function () {
|
||||
it('should include the Stripe customer ID', function (ctx) {
|
||||
expect(ctx.email.html).to.contain(ctx.opts.stripeCustomerId)
|
||||
})
|
||||
|
||||
it('should refer to the VAT number', function (ctx) {
|
||||
expect(ctx.email.html).to.contain('VAT number')
|
||||
})
|
||||
|
||||
it('should link to the subscription page', function (ctx) {
|
||||
expect(ctx.dom('a').attr('href')).to.contain('/user/subscription')
|
||||
})
|
||||
})
|
||||
|
||||
describe('plain text email', function () {
|
||||
it('should include the Stripe customer ID', function (ctx) {
|
||||
expect(ctx.email.text).to.contain(ctx.opts.stripeCustomerId)
|
||||
})
|
||||
|
||||
it('should refer to the VAT number', function (ctx) {
|
||||
expect(ctx.email.text).to.contain('VAT number')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('taxIdInvalidNonVat', function () {
|
||||
beforeEach(function (ctx) {
|
||||
ctx.emailAddress = 'customer@example.com'
|
||||
ctx.opts = {
|
||||
to: ctx.emailAddress,
|
||||
stripeCustomerId: 'cus_123456789',
|
||||
}
|
||||
ctx.email = ctx.EmailBuilder.buildEmail(
|
||||
'taxIdInvalidNonVat',
|
||||
ctx.opts
|
||||
)
|
||||
ctx.dom = cheerio.load(ctx.email.html)
|
||||
})
|
||||
|
||||
it('should build the email', function (ctx) {
|
||||
expect(ctx.email.html).to.exist
|
||||
expect(ctx.email.text).to.exist
|
||||
})
|
||||
|
||||
describe('HTML email', function () {
|
||||
it('should include the Stripe customer ID', function (ctx) {
|
||||
expect(ctx.email.html).to.contain(ctx.opts.stripeCustomerId)
|
||||
})
|
||||
|
||||
it('should refer to the tax ID', function (ctx) {
|
||||
expect(ctx.email.html).to.contain('tax ID')
|
||||
})
|
||||
|
||||
it('should link to the subscription page', function (ctx) {
|
||||
expect(ctx.dom('a').attr('href')).to.contain('/user/subscription')
|
||||
})
|
||||
})
|
||||
|
||||
describe('plain text email', function () {
|
||||
it('should include the Stripe customer ID', function (ctx) {
|
||||
expect(ctx.email.text).to.contain(ctx.opts.stripeCustomerId)
|
||||
})
|
||||
|
||||
it('should refer to the tax ID', function (ctx) {
|
||||
expect(ctx.email.text).to.contain('tax ID')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('groupMemberLimitWarning', function () {
|
||||
beforeEach(function (ctx) {
|
||||
ctx.emailAddress = 'example@overleaf.com'
|
||||
|
||||
Reference in New Issue
Block a user