intent reference generation + propagation
This commit is contained in:
@@ -188,6 +188,7 @@ class MultiplePayoutsProvider extends ChangeNotifier {
|
||||
try {
|
||||
_setState(MultiplePayoutsState.sending);
|
||||
_error = null;
|
||||
final intentRefs = _quotedIntentRefs();
|
||||
|
||||
final result = await payment.pay(
|
||||
metadata: <String, String>{
|
||||
@@ -197,6 +198,7 @@ class MultiplePayoutsProvider extends ChangeNotifier {
|
||||
'upload_rows': _rows.length.toString(),
|
||||
...?_uploadAmountMetadata(),
|
||||
},
|
||||
intentRefs: intentRefs.isEmpty ? null : intentRefs,
|
||||
);
|
||||
|
||||
_sentCount = result.length;
|
||||
@@ -272,6 +274,20 @@ class MultiplePayoutsProvider extends ChangeNotifier {
|
||||
List<PaymentQuote> _quoteItems() =>
|
||||
_quotation?.quotation?.items ?? const <PaymentQuote>[];
|
||||
|
||||
List<String> _quotedIntentRefs() {
|
||||
final seen = <String>{};
|
||||
final intentRefs = <String>[];
|
||||
for (final quote in _quoteItems()) {
|
||||
final intentRef = (quote.intentRef ?? '').trim();
|
||||
if (intentRef.isEmpty || seen.contains(intentRef)) {
|
||||
continue;
|
||||
}
|
||||
seen.add(intentRef);
|
||||
intentRefs.add(intentRef);
|
||||
}
|
||||
return intentRefs;
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_quotation?.removeListener(_onQuotationChanged);
|
||||
|
||||
Reference in New Issue
Block a user