CW-1153-Enable Revolut Pay for Moonpay (#2759)
* update quote sorting logic for sell action * аix payment method selection * fix duplicates payment methods Updated the logic to consider payment methods as duplicates based only on paymentMethodType, ignoring customTitle. This simplifies duplicate detection and may address issues with adding similar payment methods. * add revolut support for moonpay * refactor best rate recommendation logic
Serhii committed
Dec 30, 2025 at 17:06 UTC
00e5ea4ea8d420dd100e529ad181e314d6ca44a8
5 files changed
+29
-4
assets/images/revolut_dark.svg
new
+5
@@ -0,0 +1,5 @@
1
+<svg width="200" height="200" viewBox="0 0 1200 1200" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+<path d="M282.04 0H917.96C1073.73 0 1200 126.274 1200 282.04V917.96C1200 1073.73 1073.73 1200 917.96 1200H282.04C126.274 1200 0 1073.73 0 917.96V282.04C0 126.274 126.274 0 282.04 0Z" fill="white"/>
3
+<path d="M465.747 393.15H313.576V1008.46H465.747V393.15Z" fill="black"/>
4
+<path d="M717.943 664.889C842.616 658.631 942.949 553.88 942.949 428.336C942.949 297.768 836.625 191.54 705.927 191.54H313.576V322.947H687.271C746.418 322.947 795.414 369.414 796.495 426.527C797.037 455.123 786.304 482.112 766.276 502.518C746.241 522.933 719.469 534.183 690.898 534.183H545.325C540.156 534.183 535.948 538.383 535.948 543.551V660.341C535.948 662.327 536.562 664.226 537.717 665.825L784.704 1008.46H965.505L717.943 664.889Z" fill="black"/>
5
+</svg>
assets/images/revolut_light.svg
new
+5
@@ -0,0 +1,5 @@
1
+<svg width="200" height="200" viewBox="0 0 1200 1200" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+<path d="M282.04 0H917.96C1073.73 0 1200 126.274 1200 282.04V917.96C1200 1073.73 1073.73 1200 917.96 1200H282.04C126.274 1200 0 1073.73 0 917.96V282.04C0 126.274 126.274 0 282.04 0Z" fill="black"/>
3
+<path d="M465.747 393.15H313.576V1008.46H465.747V393.15Z" fill="white"/>
4
+<path d="M717.943 664.889C842.616 658.631 942.949 553.88 942.949 428.336C942.949 297.768 836.625 191.54 705.927 191.54H313.576V322.947H687.271C746.418 322.947 795.414 369.414 796.495 426.527C797.037 455.123 786.304 482.112 766.276 502.518C746.241 522.933 719.469 534.183 690.898 534.183H545.325C540.156 534.183 535.948 538.383 535.948 543.551V660.341C535.948 662.327 536.562 664.226 537.717 665.825L784.704 1008.46H965.505L717.943 664.889Z" fill="white"/>
5
+</svg>
lib/buy/moonpay/moonpay_provider.dart
+4
@@ -383,6 +383,8 @@ class MoonPayProvider extends BuyProvider {
383
return 'yellow_card_bank_transfer';
384
case PaymentType.fiatBalance:
385
return 'fiat_balance';
386
+ case PaymentType.revolutPay:
387
+ return 'revolut_pay';
388
default:
389
return null;
390
}
@@ -416,6 +418,8 @@ class MoonPayProvider extends BuyProvider {
418
return PaymentType.sepaOpenBankingPayment;
419
case 'yellow_card_bank_transfer':
420
return PaymentType.yellowCardBankTransfer;
421
+ case 'revolut_pay':
422
+ return PaymentType.revolutPay;
423
default:
424
return PaymentType.unknown;
425
}
lib/buy/payment_method.dart
+4
@@ -124,6 +124,8 @@ extension PaymentTypeTitle on PaymentType {
124
return 'assets/images/skrill.svg';
125
case PaymentType.applePay:
126
return 'assets/images/apple_pay_round_light.svg';
127
+ case PaymentType.revolutPay:
128
+ return 'assets/images/revolut_light.svg';
129
default:
130
return null;
131
}
@@ -143,6 +145,8 @@ extension PaymentTypeTitle on PaymentType {
145
return 'assets/images/skrill.svg';
146
case PaymentType.applePay:
147
return 'assets/images/apple_pay_round_dark.svg';
148
+ case PaymentType.revolutPay:
149
+ return 'assets/images/revolut_dark.svg';
150
default:
151
return null;
152
}
lib/view_model/buy/buy_sell_view_model.dart
+11
-4
@@ -367,8 +367,7 @@ abstract class BuySellViewModelBase extends WalletChangeListenerViewModel with S
367
for (var methods in result) {
368
for (var method in methods) {
369
final alreadyExists = tempPaymentMethods.any((m) {
370
- return m.paymentMethodType == method.paymentMethodType &&
371
- m.customTitle == method.customTitle;
370
+ return m.paymentMethodType == method.paymentMethodType;
371
});
372
373
if (!alreadyExists) {
@@ -468,8 +467,7 @@ abstract class BuySellViewModelBase extends WalletChangeListenerViewModel with S
467
468
if (sortedRecommendedQuotes.isNotEmpty) {
469
sortedRecommendedQuotes.first
471
- ..setIsBestRate = true
472
- ..recommendations.insert(0, ProviderRecommendation.bestRate);
470
+ ..setIsBestRate = true;
471
bestRateQuote = sortedRecommendedQuotes.first;
472
473
sortedRecommendedQuotes.sort((a, b) {
@@ -478,6 +476,15 @@ abstract class BuySellViewModelBase extends WalletChangeListenerViewModel with S
476
return 0;
477
});
478
479
+ final Quote effectiveBestRateQuote =
480
+ sortedRecommendedQuotes.reduce((a, b) {
481
+ return isBuyAction ? a.rate < b.rate ? a : b : a.rate > b.rate ? a : b;
482
+ });
483
+
484
+
485
+ effectiveBestRateQuote.recommendations
486
+ .add(ProviderRecommendation.bestRate);
487
+
488
selectedQuote = sortedRecommendedQuotes.first;
489
sortedRecommendedQuotes.first.setIsSelected = true;
490
}