address book complete
This commit is contained in:
@@ -72,13 +72,16 @@ class _AdressBookRecipientFormState extends State<AdressBookRecipientForm> {
|
||||
|
||||
Future<Recipient?> _doSave() async {
|
||||
final recipients = context.read<RecipientsProvider>();
|
||||
final methods = context.read<PaymentMethodsProvider>();
|
||||
final methods = PaymentMethodsProvider();
|
||||
final recipient = widget.recipient == null
|
||||
? await recipients.create(
|
||||
name: _nameCtrl.text,
|
||||
email: _emailCtrl.text,
|
||||
)
|
||||
: widget.recipient!;
|
||||
recipients.setCurrentObject(recipient.id);
|
||||
//TODO : redesign work with recipients / payment methods
|
||||
await methods.loadMethods(context.read<OrganizationsProvider>(), recipient.id);
|
||||
for (final type in _methods.keys) {
|
||||
final data = _methods[type]!;
|
||||
final exising = methods.methods.firstWhereOrNull((m) => m.type == type);
|
||||
@@ -91,11 +94,6 @@ class _AdressBookRecipientFormState extends State<AdressBookRecipientForm> {
|
||||
data: data,
|
||||
);
|
||||
}
|
||||
await methods.create(
|
||||
reacipientRef: recipient.id,
|
||||
name: getPaymentTypeLabel(context, data.type),
|
||||
data: data,
|
||||
);
|
||||
}
|
||||
return recipient;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user