updated document upload according to fresh api
This commit is contained in:
@@ -26,9 +26,20 @@ class PaymentDetailsController extends ChangeNotifier {
|
||||
bool get canDownload {
|
||||
final current = _payment;
|
||||
if (current == null) return false;
|
||||
final status = statusFromPayment(current);
|
||||
final paymentRef = current.paymentRef ?? '';
|
||||
return status == OperationStatus.success && paymentRef.trim().isNotEmpty;
|
||||
if (statusFromPayment(current) != OperationStatus.success) return false;
|
||||
return primaryOperationDocumentRequest != null;
|
||||
}
|
||||
|
||||
OperationDocumentRequestModel? get primaryOperationDocumentRequest {
|
||||
final current = _payment;
|
||||
if (current == null) return null;
|
||||
for (final operation in current.operations) {
|
||||
final request = operationDocumentRequest(operation);
|
||||
if (request != null) {
|
||||
return request;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
OperationDocumentRequestModel? operationDocumentRequest(
|
||||
@@ -37,18 +48,17 @@ class PaymentDetailsController extends ChangeNotifier {
|
||||
final current = _payment;
|
||||
if (current == null) return null;
|
||||
|
||||
final paymentRef = current.paymentRef?.trim() ?? '';
|
||||
if (paymentRef.isEmpty) return null;
|
||||
|
||||
final operationRef = operation.operationRef;
|
||||
if (operationRef == null || operationRef.isEmpty) return null;
|
||||
final gatewayService = operation.gateway;
|
||||
if (gatewayService == null || gatewayService.isEmpty) return null;
|
||||
|
||||
final pair = parseOperationCodePair(operation.code);
|
||||
if (pair == null) return null;
|
||||
if (pair.operation != 'card_payout' || pair.action != 'send') return null;
|
||||
|
||||
return OperationDocumentRequestModel(
|
||||
paymentRef: paymentRef,
|
||||
gatewayService: gatewayService,
|
||||
operationRef: operationRef,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user