getInstalledUpiApplications static method

Future<List<ApplicationMeta>> getInstalledUpiApplications({
  1. UpiApplicationDiscoveryAppPaymentType paymentType = UpiApplicationDiscoveryAppPaymentType.nonMerchant,
  2. UpiApplicationDiscoveryAppStatusType statusType = UpiApplicationDiscoveryAppStatusType.working,
})

Finds installed UPI payment applications.

Default behaviour is to present all applications verified to be working properly.

statusType can be used to change the default behaviour. Setting it to UpiApplicationDiscoveryAppStatusType.workingWithWarnings will fetch all apps that work but produce a "unverified source" or relevant error caused due to lack of using the merchant's signature parameter in this package (See mc and sign in UPI Linking Specification). Currently this package does not implement merchant payments as per the specification, and rather helps with individual-to-individual payments that do not require merchant details. It's an upcoming feature. Setting statusType to UpiApplicationDiscoveryAppStatusType.all will fetch all the apps. UPI researchers can use this value to experiment with the UPI apps this package can detect.

paymentType must be UpiApplicationDiscoveryAppPaymentType.nonMerchant for now. Setting it to any other value will lead to UnsupportedError.

Implementation

static Future<List<ApplicationMeta>> getInstalledUpiApplications({
  UpiApplicationDiscoveryAppPaymentType paymentType:
      UpiApplicationDiscoveryAppPaymentType.nonMerchant,
  UpiApplicationDiscoveryAppStatusType statusType:
      UpiApplicationDiscoveryAppStatusType.working,
}) async {
  if (paymentType != UpiApplicationDiscoveryAppPaymentType.nonMerchant) {
    throw UnsupportedError('The parameter `paymentType` must be '
        '`UpiApplicationDiscoveryAppPaymentType.nonMerchant`');
  }
  if (_upiApplicationStatuses.isEmpty) {
    return [];
  }
  return await _discovery.discover(
    upiMethodChannel: _channel,
    applicationStatusMap: _upiApplicationStatuses,
    paymentType: paymentType,
    statusType: statusType,
  );
}