mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-17 10:43:00 +00:00
Deleting user: if subscription is already cancelled, ignore and proceed.
This commit is contained in:
parent
68ddf04fe8
commit
e03d16e0cd
2 changed files with 16 additions and 0 deletions
|
@ -418,6 +418,9 @@ module.exports = RecurlyWrapper =
|
|||
url: "subscriptions/#{subscriptionId}/cancel",
|
||||
method: "put"
|
||||
}, (error, response, body) ->
|
||||
if error? and body?.match(/.*A canceled subscription can't transition to canceled.*/)
|
||||
logger.log {subscriptionId, error, body}, "subscription already cancelled, not really an error, proceeding"
|
||||
error = null
|
||||
callback(error)
|
||||
)
|
||||
|
||||
|
|
|
@ -314,6 +314,19 @@ describe "RecurlyWrapper", ->
|
|||
it "should send a cancel request to the API", ->
|
||||
@apiRequest.called.should.equal true
|
||||
|
||||
describe 'when the subscription is already cancelled', ->
|
||||
|
||||
beforeEach ->
|
||||
@RecurlyWrapper.apiRequest.restore()
|
||||
@recurlySubscriptionId = "subscription-id-123"
|
||||
@apiRequest = sinon.stub @RecurlyWrapper, "apiRequest", (options, callback) =>
|
||||
callback(new Error('woops'), {}, "<error><description>A canceled subscription can't transition to canceled</description></error>")
|
||||
|
||||
it 'should not produce an error', (done) ->
|
||||
@RecurlyWrapper.cancelSubscription @recurlySubscriptionId, (err) =>
|
||||
expect(err).to.equal null
|
||||
done()
|
||||
|
||||
describe "reactivateSubscription", ->
|
||||
beforeEach (done) ->
|
||||
@recurlySubscriptionId = "subscription-id-123"
|
||||
|
|
Loading…
Reference in a new issue