Merge pull request #6029 from mempool/nymkappa/accelerator-checkout-fix

[accelerator] we don't need to start a new price subscription at checkout
This commit is contained in:
nymkappa
2025-09-09 14:55:05 +02:00
committed by GitHub

View File

@@ -474,19 +474,14 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
if (this.processing) {
return;
}
if (this.conversionsSubscription) {
this.conversionsSubscription.unsubscribe();
}
this.processing = true;
this.conversionsSubscription = this.stateService.conversions$.subscribe(
async (conversions) => {
this.conversions = conversions;
if (this.applePay) {
this.applePay.destroy();
}
const costUSD = this.cost / 100_000_000 * conversions.USD;
const costUSD = this.cost / 100_000_000 * this.conversions.USD;
const paymentRequest = this.payments.paymentRequest({
countryCode: 'US',
currencyCode: 'USD',
@@ -585,8 +580,6 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
this.processing = false;
console.error(e);
}
}
);
}
/**
@@ -596,19 +589,14 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
if (this.processing) {
return;
}
if (this.conversionsSubscription) {
this.conversionsSubscription.unsubscribe();
}
this.processing = true;
this.conversionsSubscription = this.stateService.conversions$.subscribe(
async (conversions) => {
this.conversions = conversions;
if (this.googlePay) {
this.googlePay.destroy();
}
const costUSD = this.cost / 100_000_000 * conversions.USD;
const costUSD = this.cost / 100_000_000 * this.conversions.USD;
const paymentRequest = this.payments.paymentRequest({
countryCode: 'US',
currencyCode: 'USD',
@@ -710,8 +698,6 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
this.isCheckoutLocked--;
}
});
}
);
}
/**
@@ -721,16 +707,10 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
if (this.processing) {
return;
}
if (this.conversionsSubscription) {
this.conversionsSubscription.unsubscribe();
}
this.processing = true;
this.conversionsSubscription = this.stateService.conversions$.subscribe(
async (conversions) => {
this.conversions = conversions;
const costUSD = this.cost / 100_000_000 * conversions.USD;
const costUSD = this.cost / 100_000_000 * this.conversions.USD;
if (this.isCheckoutLocked > 0) {
return;
}
@@ -815,8 +795,6 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
this.isCheckoutLocked--;
this.isTokenizing--;
}
}
);
}
/**
@@ -826,20 +804,15 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
if (this.processing) {
return;
}
if (this.conversionsSubscription) {
this.conversionsSubscription.unsubscribe();
}
this.processing = true;
this.conversionsSubscription = this.stateService.conversions$.subscribe(
async (conversions) => {
this.conversions = conversions;
if (this.cashAppPay) {
this.cashAppPay.destroy();
}
const redirectHostname = document.location.hostname === 'localhost' ? `http://localhost:4200`: `https://${document.location.hostname}`;
const costUSD = this.cost / 100_000_000 * conversions.USD;
const costUSD = this.cost / 100_000_000 * this.conversions.USD;
const paymentRequest = this.payments.paymentRequest({
countryCode: 'US',
currencyCode: 'USD',
@@ -902,8 +875,6 @@ export class AccelerateCheckout implements OnInit, OnDestroy {
});
}
});
}
);
}
/**