mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-30 06:48:49 +01:00
* add payment method api * add payment method limits * Update lib/buy/moonpay/moonpay_provider.dart * fix MoonPay payment method handling * Handle custom MoonPay payment methods * fix limits when max is infinite [skip ci] --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
32 lines
1.0 KiB
Dart
32 lines
1.0 KiB
Dart
class MoonPayPaymentMethod {
|
|
MoonPayPaymentMethod({
|
|
required this.type,
|
|
required this.displayName,
|
|
required this.iconUrl,
|
|
required this.active,
|
|
this.limitAmount,
|
|
this.limitCurrencyCode,
|
|
});
|
|
|
|
factory MoonPayPaymentMethod.fromJson(Map<String, dynamic> json) {
|
|
final availability = json["availability"] as Map<String, dynamic>? ?? {};
|
|
final limits = json["limits"] as Map<String, dynamic>?;
|
|
final perTransaction = limits?["perTransaction"] as Map<String, dynamic>?;
|
|
|
|
return MoonPayPaymentMethod(
|
|
type: json["type"] as String? ?? "",
|
|
displayName: json["displayName"] as String? ?? "",
|
|
iconUrl: json["iconUrl"] as String? ?? "",
|
|
active: availability["active"] as bool? ?? false,
|
|
limitAmount: (perTransaction?["limit"] as num?)?.toDouble(),
|
|
limitCurrencyCode: perTransaction?["currencyCode"] as String?,
|
|
);
|
|
}
|
|
|
|
final String type;
|
|
final String displayName;
|
|
final String iconUrl;
|
|
final bool active;
|
|
final double? limitAmount;
|
|
final String? limitCurrencyCode;
|
|
} |