fix(tax): wrong Request IP Address Sent to StripeE

Because:

* we don't want to use 127.0.0.1 to try to look up tax locations in stripe

This commit:

* uses the forwarded IP address from the client

Closes #
This commit is contained in:
Ivo Plamenac 2022-11-04 13:43:56 -07:00 коммит произвёл dschom
Родитель 2cae770329
Коммит cf5fde2edb
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: F26AEE99174EE68B
2 изменённых файлов: 4 добавлений и 11 удалений

Просмотреть файл

@ -423,7 +423,7 @@ export class StripeHandler {
>;
const country = request.app.geo.location?.country || 'US';
const ipAddress = request.info.remoteAddress;
const ipAddress = request.app.clientAddress;
const automaticTax = this.automaticTax;
const previewInvoice = await this.stripeHelper.previewInvoice({
@ -485,7 +485,7 @@ export class StripeHandler {
string
>;
const country = request.app.geo.location?.country || 'US';
const ipAddress = request.info.remoteAddress;
const ipAddress = request.app.clientAddress;
const automaticTax = this.automaticTax;
const couponDetails = this.stripeHelper.retrieveCouponDetails({

Просмотреть файл

@ -661,9 +661,6 @@ describe('DirectStripeRoutes', () => {
priceId: 'priceId',
};
VALID_REQUEST.app.geo = {};
VALID_REQUEST.info = {
remoteAddress: '1.1.1.1',
};
const actual = await directStripeRoutesInstance.previewInvoice(
VALID_REQUEST
);
@ -677,7 +674,7 @@ describe('DirectStripeRoutes', () => {
{
automaticTax: false,
country: 'US',
ipAddress: '1.1.1.1',
ipAddress: '127.0.0.1',
promotionCode: 'promotionCode',
priceId: 'priceId',
}
@ -818,10 +815,6 @@ describe('DirectStripeRoutes', () => {
priceId: 'priceId',
};
VALID_REQUEST.app.geo = {};
VALID_REQUEST.info = {
remoteAddress: '1.1.1.1',
};
const actual = await directStripeRoutesInstance.retrieveCouponDetails(
VALID_REQUEST
);
@ -831,7 +824,7 @@ describe('DirectStripeRoutes', () => {
{
automaticTax: false,
country: 'US',
ipAddress: '1.1.1.1',
ipAddress: '127.0.0.1',
promotionCode: 'promotionCode',
priceId: 'priceId',
}