зеркало из https://github.com/mozilla/fxa.git
Merge pull request #14695 from mozilla/fxa-6543-auth-invoice-preview
fix(payments): only checkIpOnly if no credentials
This commit is contained in:
Коммит
abfd9790ac
|
@ -415,7 +415,6 @@ export class StripeHandler {
|
||||||
request: AuthRequest
|
request: AuthRequest
|
||||||
): Promise<invoiceDTO.firstInvoicePreviewSchema> {
|
): Promise<invoiceDTO.firstInvoicePreviewSchema> {
|
||||||
this.log.begin('subscriptions.previewInvoice', request);
|
this.log.begin('subscriptions.previewInvoice', request);
|
||||||
await this.customs.checkIpOnly(request, 'previewInvoice');
|
|
||||||
|
|
||||||
const { promotionCode, priceId } = request.payload as Record<
|
const { promotionCode, priceId } = request.payload as Record<
|
||||||
string,
|
string,
|
||||||
|
@ -431,6 +430,8 @@ export class StripeHandler {
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
this.log.error('previewInvoice.fetchCustomer', { error: e, uid });
|
this.log.error('previewInvoice.fetchCustomer', { error: e, uid });
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
await this.customs.checkIpOnly(request, 'previewInvoice');
|
||||||
}
|
}
|
||||||
|
|
||||||
const country = request.app.geo.location?.country || 'US';
|
const country = request.app.geo.location?.country || 'US';
|
||||||
|
|
|
@ -665,8 +665,9 @@ describe('DirectStripeRoutes', () => {
|
||||||
VALID_REQUEST
|
VALID_REQUEST
|
||||||
);
|
);
|
||||||
sinon.assert.calledOnceWithExactly(
|
sinon.assert.calledOnceWithExactly(
|
||||||
directStripeRoutesInstance.customs.checkIpOnly,
|
directStripeRoutesInstance.customs.check,
|
||||||
VALID_REQUEST,
|
VALID_REQUEST,
|
||||||
|
TEST_EMAIL,
|
||||||
'previewInvoice'
|
'previewInvoice'
|
||||||
);
|
);
|
||||||
sinon.assert.calledOnceWithExactly(
|
sinon.assert.calledOnceWithExactly(
|
||||||
|
@ -707,8 +708,9 @@ describe('DirectStripeRoutes', () => {
|
||||||
VALID_REQUEST
|
VALID_REQUEST
|
||||||
);
|
);
|
||||||
sinon.assert.calledOnceWithExactly(
|
sinon.assert.calledOnceWithExactly(
|
||||||
directStripeRoutesInstance.customs.checkIpOnly,
|
directStripeRoutesInstance.customs.check,
|
||||||
VALID_REQUEST,
|
VALID_REQUEST,
|
||||||
|
TEST_EMAIL,
|
||||||
'previewInvoice'
|
'previewInvoice'
|
||||||
);
|
);
|
||||||
sinon.assert.calledOnceWithExactly(
|
sinon.assert.calledOnceWithExactly(
|
||||||
|
@ -747,8 +749,9 @@ describe('DirectStripeRoutes', () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
sinon.assert.calledOnceWithExactly(
|
sinon.assert.calledOnceWithExactly(
|
||||||
directStripeRoutesInstance.customs.checkIpOnly,
|
directStripeRoutesInstance.customs.check,
|
||||||
VALID_REQUEST,
|
VALID_REQUEST,
|
||||||
|
TEST_EMAIL,
|
||||||
'previewInvoice'
|
'previewInvoice'
|
||||||
);
|
);
|
||||||
sinon.assert.calledOnceWithExactly(
|
sinon.assert.calledOnceWithExactly(
|
||||||
|
|
Загрузка…
Ссылка в новой задаче