diff --git a/services/web/app/src/Features/Subscription/RecurlyWrapper.js b/services/web/app/src/Features/Subscription/RecurlyWrapper.js index cba5b602d3..dfbe415931 100644 --- a/services/web/app/src/Features/Subscription/RecurlyWrapper.js +++ b/services/web/app/src/Features/Subscription/RecurlyWrapper.js @@ -51,7 +51,7 @@ const promises = { ) throw error } - if (response.statusCode === 404) { + if (response.status === 404) { // actually not an error in this case, just no existing account logger.debug( { userId: user._id }, @@ -355,7 +355,7 @@ const promises = { expect422: true, }) - if (response.statusCode === 422) { + if (response.status === 422) { return await RecurlyWrapper.promises._handle422Response(body) } else { return await RecurlyWrapper.promises._parseSubscriptionXml(body) @@ -713,7 +713,7 @@ const promises = { }, expect404: true, }) - if (response.statusCode === 404) { + if (response.status === 404) { return [] } else { return await RecurlyWrapper.promises._parseSubscriptionsXml(body) diff --git a/services/web/test/acceptance/src/CollectPayPalPastDueInvoiceTest.js b/services/web/test/acceptance/src/CollectPayPalPastDueInvoiceTest.js index 9ce288da30..14b9f41352 100644 --- a/services/web/test/acceptance/src/CollectPayPalPastDueInvoiceTest.js +++ b/services/web/test/acceptance/src/CollectPayPalPastDueInvoiceTest.js @@ -166,7 +166,7 @@ const getInvoicePage = fullInvoicesIds => queryOptions => { const hasMore = end < fullInvoicesIds.length const nextPageCursor = hasMore ? `${end}%3A${end + ITEMS_PER_PAGE}&v=2` : null const response = { - statusCode: 200, + status: 200, headers: { link: hasMore ? `https://fakerecurly.com/v2/invoices?cursor=${nextPageCursor}` @@ -188,7 +188,7 @@ describe('CollectPayPalPastDueInvoice', function () { if (/accounts\/(\d+)\/billing_info/.test(options.url)) { return { - response: { statusCode: 200, headers: {} }, + response: { status: 200, headers: {} }, body: billingInfoXml, } } @@ -197,7 +197,7 @@ describe('CollectPayPalPastDueInvoice', function () { const invoiceId = options.url.match(/invoices\/(\d+)\/collect/)[1] if (invoiceId < 400) { return { - response: { statusCode: 200, headers: {} }, + response: { status: 200, headers: {} }, body: invoiceCollectXml, } } diff --git a/services/web/test/unit/src/Subscription/RecurlyWrapperTests.js b/services/web/test/unit/src/Subscription/RecurlyWrapperTests.js index 60f2f25425..50aff9c3e6 100644 --- a/services/web/test/unit/src/Subscription/RecurlyWrapperTests.js +++ b/services/web/test/unit/src/Subscription/RecurlyWrapperTests.js @@ -94,13 +94,12 @@ const mockApiRequest = function (options) { if (fixtures[options.url]) { return { err: null, - response: { statusCode: 200 }, + response: { status: 200 }, body: fixtures[options.url], } } else { return { err: new Error('Not found'), - response: { statusCode: 404 }, } } } @@ -585,7 +584,7 @@ describe('RecurlyWrapper', function () { threeDSecureActionResult: 'a-3d-token-id', } this.apiRequest = sinon.stub(this.RecurlyWrapper.promises, 'apiRequest') - this.response = { statusCode: 200 } + this.response = { status: 200 } this.body = 'is_bad' this.apiRequest.resolves({ response: this.response, @@ -684,7 +683,7 @@ describe('RecurlyWrapper', function () { ` // this.apiRequest.yields(null, { statusCode: 422 }, body) this.apiRequest.resolves({ - response: { statusCode: 422 }, + response: { status: 422 }, body, }) }) @@ -948,7 +947,7 @@ describe('RecurlyWrapper', function () { const resultXml = 'abc' this.apiRequest.resolves({ - response: { statusCode: 200 }, + response: { status: 200 }, body: resultXml, }) }) @@ -987,7 +986,7 @@ describe('RecurlyWrapper', function () { describe('when the account does not exist', function () { beforeEach(function () { this.apiRequest.resolves({ - response: { statusCode: 404 }, + response: { status: 404 }, body: '', }) }) @@ -1095,7 +1094,7 @@ describe('RecurlyWrapper', function () { const resultXml = 'abc' this.apiRequest.resolves({ - response: { statusCode: 200 }, + response: { status: 200 }, body: resultXml, }) }) @@ -1174,7 +1173,7 @@ describe('RecurlyWrapper', function () { beforeEach(function () { const resultXml = '1' this.apiRequest.resolves({ - response: { statusCode: 200 }, + response: { status: 200 }, body: resultXml, }) }) @@ -1260,7 +1259,7 @@ describe('RecurlyWrapper', function () { beforeEach(function () { const resultXml = 'London' this.apiRequest.resolves({ - response: { statusCode: 200 }, + response: { status: 200 }, body: resultXml, }) }) @@ -1328,7 +1327,7 @@ describe('RecurlyWrapper', function () { beforeEach(function () { const resultXml = '1' this.apiRequest.resolves({ - response: { statusCode: 200 }, + response: { status: 200 }, body: resultXml, }) }) @@ -1437,7 +1436,7 @@ describe('RecurlyWrapper', function () { describe('without an account', function () { beforeEach(async function () { - this.response.statusCode = 404 + this.response.status = 404 this.accountActiveSubscriptions = await this.RecurlyWrapper.promises.listAccountActiveSubscriptions( this.user_id