mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
if Recurly error, parse body xml rather than using regex match
This commit is contained in:
parent
58280bf6ee
commit
a5d2183441
1 changed files with 9 additions and 4 deletions
|
@ -418,10 +418,15 @@ module.exports = RecurlyWrapper =
|
||||||
url: "subscriptions/#{subscriptionId}/cancel",
|
url: "subscriptions/#{subscriptionId}/cancel",
|
||||||
method: "put"
|
method: "put"
|
||||||
}, (error, response, body) ->
|
}, (error, response, body) ->
|
||||||
if error? and body?.match(/.*A canceled subscription can't transition to canceled.*/)
|
if error?
|
||||||
|
RecurlyWrapper._parseXml body, (_err, parsed) ->
|
||||||
|
if parsed?.error?.description == "A canceled subscription can't transition to canceled"
|
||||||
logger.log {subscriptionId, error, body}, "subscription already cancelled, not really an error, proceeding"
|
logger.log {subscriptionId, error, body}, "subscription already cancelled, not really an error, proceeding"
|
||||||
error = null
|
callback(null)
|
||||||
|
else
|
||||||
callback(error)
|
callback(error)
|
||||||
|
else
|
||||||
|
callback(null)
|
||||||
)
|
)
|
||||||
|
|
||||||
reactivateSubscription: (subscriptionId, callback) ->
|
reactivateSubscription: (subscriptionId, callback) ->
|
||||||
|
|
Loading…
Reference in a new issue