mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-11 23:20:47 +02:00
Merge pull request #2343 from overleaf/ta-invoice-attempt-callback
Collect Past Due Invoices on Paypal Billing Info Updates GitOrigin-RevId: 6a0d298db8589ae6ba7cb62e4dfd562a1f292db0
This commit is contained in:
committed by
sharelatex
parent
012bef257d
commit
e000fd4615
@@ -60,7 +60,8 @@ describe('SubscriptionController', function() {
|
||||
updateSubscription: sinon.stub().callsArgWith(3),
|
||||
reactivateSubscription: sinon.stub().callsArgWith(1),
|
||||
cancelSubscription: sinon.stub().callsArgWith(1),
|
||||
recurlyCallback: sinon.stub().yields(),
|
||||
syncSubscription: sinon.stub().yields(),
|
||||
attemptPaypalInvoiceCollection: sinon.stub().yields(),
|
||||
startFreeTrial: sinon.stub()
|
||||
}
|
||||
|
||||
@@ -514,7 +515,7 @@ describe('SubscriptionController', function() {
|
||||
})
|
||||
|
||||
describe('recurly callback', function() {
|
||||
describe('with a actionable request', function() {
|
||||
describe('with a sync subscription request', function() {
|
||||
beforeEach(function(done) {
|
||||
this.req = {
|
||||
body: {
|
||||
@@ -535,7 +536,7 @@ describe('SubscriptionController', function() {
|
||||
})
|
||||
|
||||
it('should tell the SubscriptionHandler to process the recurly callback', function(done) {
|
||||
this.SubscriptionHandler.recurlyCallback.called.should.equal(true)
|
||||
this.SubscriptionHandler.syncSubscription.called.should.equal(true)
|
||||
return done()
|
||||
})
|
||||
|
||||
@@ -545,6 +546,39 @@ describe('SubscriptionController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('with a billing info updated request', function() {
|
||||
beforeEach(function(done) {
|
||||
this.req = {
|
||||
body: {
|
||||
billing_info_updated_notification: {
|
||||
account: {
|
||||
account_code: 'mock-account-code'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.res = {
|
||||
sendStatus() {
|
||||
done()
|
||||
}
|
||||
}
|
||||
sinon.spy(this.res, 'sendStatus')
|
||||
this.SubscriptionController.recurlyCallback(this.req, this.res)
|
||||
})
|
||||
|
||||
it('should call attemptPaypalInvoiceCollection', function(done) {
|
||||
this.SubscriptionHandler.attemptPaypalInvoiceCollection
|
||||
.calledWith('mock-account-code')
|
||||
.should.equal(true)
|
||||
done()
|
||||
})
|
||||
|
||||
it('should send a 200', function(done) {
|
||||
this.res.sendStatus.calledWith(200)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
describe('with a non-actionable request', function() {
|
||||
beforeEach(function(done) {
|
||||
this.user.id = this.activeRecurlySubscription.account.account_code
|
||||
@@ -567,7 +601,8 @@ describe('SubscriptionController', function() {
|
||||
})
|
||||
|
||||
it('should not call the subscriptionshandler', function() {
|
||||
return this.SubscriptionHandler.recurlyCallback.called.should.equal(
|
||||
this.SubscriptionHandler.syncSubscription.called.should.equal(false)
|
||||
this.SubscriptionHandler.attemptPaypalInvoiceCollection.called.should.equal(
|
||||
false
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user