зеркало из https://github.com/mozilla/fxa.git
Merge pull request #16405 from mozilla/FXA-9011
fix(auth): Revise eligibilityFromEligibilityManager - blocked_iap
This commit is contained in:
Коммит
a686218f97
|
@ -383,13 +383,10 @@ export class CapabilityService {
|
||||||
subscriptionEligibilityResult: SubscriptionEligibilityResult.INVALID,
|
subscriptionEligibilityResult: SubscriptionEligibilityResult.INVALID,
|
||||||
};
|
};
|
||||||
const iapProductIds = iapSubscribedPlans.map((p) => p.product_id);
|
const iapProductIds = iapSubscribedPlans.map((p) => p.product_id);
|
||||||
const planIds = [
|
const planIds = stripeSubscribedPlans.map((p) => p.plan_id);
|
||||||
...stripeSubscribedPlans.map((p) => p.plan_id),
|
|
||||||
...iapSubscribedPlans.map((p) => p.plan_id),
|
|
||||||
];
|
|
||||||
const overlaps = await this.eligibilityManager.getOfferingOverlap(
|
const overlaps = await this.eligibilityManager.getOfferingOverlap(
|
||||||
planIds,
|
planIds,
|
||||||
[],
|
iapProductIds,
|
||||||
targetPlan.plan_id
|
targetPlan.plan_id
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -820,6 +820,48 @@ describe('CapabilityService', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('eligibilityManagerResult and stripeEligibilityResult should match', () => {
|
||||||
|
let mockEligibilityManager;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
mockEligibilityManager = {};
|
||||||
|
Container.set(EligibilityManager, mockEligibilityManager);
|
||||||
|
capabilityService = new CapabilityService();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns blocked_iap result from both', async () => {
|
||||||
|
mockEligibilityManager.getOfferingOverlap = sinon.fake.resolves([
|
||||||
|
{
|
||||||
|
comparison: 'same',
|
||||||
|
offeringProductId: mockPlanTier1ShortInterval.product_id,
|
||||||
|
type: 'offering',
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
capabilityService.fetchSubscribedPricesFromAppStore =
|
||||||
|
sinon.fake.resolves(['plan_123456']);
|
||||||
|
|
||||||
|
const eligiblityActual =
|
||||||
|
await capabilityService.eligibilityFromEligibilityManager(
|
||||||
|
[],
|
||||||
|
[mockPlanTier1ShortInterval],
|
||||||
|
mockPlanTier1LongInterval
|
||||||
|
);
|
||||||
|
|
||||||
|
const stripeActual =
|
||||||
|
await capabilityService.eligibilityFromStripeMetadata(
|
||||||
|
[],
|
||||||
|
[mockPlanTier1ShortInterval],
|
||||||
|
mockPlanTier1LongInterval
|
||||||
|
);
|
||||||
|
|
||||||
|
assert.deepEqual(
|
||||||
|
eligiblityActual.subscriptionEligibilityResult,
|
||||||
|
stripeActual.subscriptionEligibilityResult
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('processPriceIdDiff', () => {
|
describe('processPriceIdDiff', () => {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче