mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-01 05:11:34 +02:00
if Recurly error, parse body xml rather than using regex match
This commit is contained in:
@@ -418,10 +418,15 @@ 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)
|
||||
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"
|
||||
callback(null)
|
||||
else
|
||||
callback(error)
|
||||
else
|
||||
callback(null)
|
||||
)
|
||||
|
||||
reactivateSubscription: (subscriptionId, callback) ->
|
||||
|
||||
Reference in New Issue
Block a user