Frontend first draft
This commit is contained in:
18
frontend/pshared/lib/models/payment/methods/card.dart
Normal file
18
frontend/pshared/lib/models/payment/methods/card.dart
Normal file
@@ -0,0 +1,18 @@
|
||||
import 'package:pshared/models/payment/methods/data.dart';
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
|
||||
|
||||
class CardPaymentMethod extends PaymentMethodData {
|
||||
@override
|
||||
final PaymentType type = PaymentType.card;
|
||||
|
||||
final String pan;
|
||||
final String firstName;
|
||||
final String lastName;
|
||||
|
||||
CardPaymentMethod({
|
||||
required this.pan,
|
||||
required this.firstName,
|
||||
required this.lastName,
|
||||
});
|
||||
}
|
||||
6
frontend/pshared/lib/models/payment/methods/data.dart
Normal file
6
frontend/pshared/lib/models/payment/methods/data.dart
Normal file
@@ -0,0 +1,6 @@
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
|
||||
|
||||
abstract class PaymentMethodData {
|
||||
PaymentType get type;
|
||||
}
|
||||
20
frontend/pshared/lib/models/payment/methods/iban.dart
Normal file
20
frontend/pshared/lib/models/payment/methods/iban.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import 'package:pshared/models/payment/methods/data.dart';
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
|
||||
|
||||
class IbanPaymentMethod extends PaymentMethodData {
|
||||
@override
|
||||
final PaymentType type = PaymentType.iban;
|
||||
|
||||
final String iban; // e.g. DE89 3704 0044 0532 0130 00
|
||||
final String accountHolder; // Full name of the recipient
|
||||
final String? bic; // Optional: for cross-border transfers
|
||||
final String? bankName; // Optional: for UI clarity
|
||||
|
||||
IbanPaymentMethod({
|
||||
required this.iban,
|
||||
required this.accountHolder,
|
||||
this.bic,
|
||||
this.bankName,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import 'package:pshared/models/payment/methods/data.dart';
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
|
||||
|
||||
class RussianBankAccountPaymentMethod extends PaymentMethodData {
|
||||
@override
|
||||
final PaymentType type = PaymentType.bankAccount;
|
||||
|
||||
final String recipientName;
|
||||
final String inn;
|
||||
final String kpp;
|
||||
final String bankName;
|
||||
final String bik;
|
||||
final String accountNumber;
|
||||
final String correspondentAccount;
|
||||
|
||||
RussianBankAccountPaymentMethod({
|
||||
required this.recipientName,
|
||||
required this.inn,
|
||||
required this.kpp,
|
||||
required this.bankName,
|
||||
required this.bik,
|
||||
required this.accountNumber,
|
||||
required this.correspondentAccount,
|
||||
});
|
||||
}
|
||||
21
frontend/pshared/lib/models/payment/methods/type.dart
Normal file
21
frontend/pshared/lib/models/payment/methods/type.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
|
||||
|
||||
class PaymentMethod {
|
||||
PaymentMethod({
|
||||
required this.id,
|
||||
required this.label,
|
||||
required this.details,
|
||||
required this.type,
|
||||
this.isEnabled = true,
|
||||
this.isMain = false,
|
||||
});
|
||||
|
||||
final String id;
|
||||
final String label;
|
||||
final String details;
|
||||
final PaymentType type;
|
||||
|
||||
bool isEnabled;
|
||||
bool isMain;
|
||||
}
|
||||
12
frontend/pshared/lib/models/payment/methods/wallet.dart
Normal file
12
frontend/pshared/lib/models/payment/methods/wallet.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
import 'package:pshared/models/payment/methods/data.dart';
|
||||
import 'package:pshared/models/payment/type.dart';
|
||||
|
||||
|
||||
class WalletPaymentMethod extends PaymentMethodData {
|
||||
@override
|
||||
final PaymentType type = PaymentType.wallet;
|
||||
|
||||
final String walletId;
|
||||
|
||||
WalletPaymentMethod({required this.walletId});
|
||||
}
|
||||
30
frontend/pshared/lib/models/payment/operation.dart
Normal file
30
frontend/pshared/lib/models/payment/operation.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
import 'package:pshared/models/payment/status.dart';
|
||||
|
||||
|
||||
class OperationItem {
|
||||
final OperationStatus status;
|
||||
final String? fileName;
|
||||
final double amount;
|
||||
final String currency;
|
||||
final double toAmount;
|
||||
final String toCurrency;
|
||||
final String payId;
|
||||
final String? cardNumber;
|
||||
final String name;
|
||||
final DateTime date;
|
||||
final String comment;
|
||||
|
||||
OperationItem({
|
||||
required this.status,
|
||||
this.fileName,
|
||||
required this.amount,
|
||||
required this.currency,
|
||||
required this.toAmount,
|
||||
required this.toCurrency,
|
||||
required this.payId,
|
||||
this.cardNumber,
|
||||
required this.name,
|
||||
required this.date,
|
||||
required this.comment,
|
||||
});
|
||||
}
|
||||
25
frontend/pshared/lib/models/payment/status.dart
Normal file
25
frontend/pshared/lib/models/payment/status.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:pshared/generated/i18n/ps_localizations.dart';
|
||||
|
||||
enum OperationStatus {
|
||||
processing,
|
||||
success,
|
||||
error,
|
||||
}
|
||||
|
||||
|
||||
extension OperationStatusX on OperationStatus {
|
||||
/// Returns the localized string for this status,
|
||||
/// e.g. “Processing”, “Success”, “Error”.
|
||||
String localized(BuildContext context) {
|
||||
final loc = PSLocalizations.of(context)!;
|
||||
switch (this) {
|
||||
case OperationStatus.processing:
|
||||
return loc.operationStatusProcessing;
|
||||
case OperationStatus.success:
|
||||
return loc.operationStatusSuccess;
|
||||
case OperationStatus.error:
|
||||
return loc.operationStatusError;
|
||||
}
|
||||
}
|
||||
}
|
||||
6
frontend/pshared/lib/models/payment/type.dart
Normal file
6
frontend/pshared/lib/models/payment/type.dart
Normal file
@@ -0,0 +1,6 @@
|
||||
enum PaymentType {
|
||||
bankAccount,
|
||||
iban,
|
||||
wallet,
|
||||
card,
|
||||
}
|
||||
11
frontend/pshared/lib/models/payment/upload_history_item.dart
Normal file
11
frontend/pshared/lib/models/payment/upload_history_item.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
class UploadHistoryItem {
|
||||
final String name;
|
||||
final String status;
|
||||
final String time;
|
||||
|
||||
UploadHistoryItem({
|
||||
required this.name,
|
||||
required this.status,
|
||||
required this.time,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user