Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -123,14 +124,21 @@ public void onError(String s) {

void getAppsWhichSupportUpi(Result result) {
this.pendingResult = result;
final List<HashMap<Object, Object>> arrayList = new ArrayList<>();

Razorpay.getAppsWhichSupportUpi(activity, new RzpUpiSupportedAppsCallback() {
@Override
public void onReceiveUpiSupportedApps(List<ApplicationDetails> list) {
HashMap<Object, Object> hMap = new HashMap<>();
for (int i=0;i<list.size();i++) {
hMap.put(list.get(i).getPackageName(),list.get(i).getAppName());
HashMap<Object, Object> hMap = new HashMap<>();
ApplicationDetails details = list.get(i);
hMap.put("appName",details.getAppName());
hMap.put("appLogo",details.getAppLogoUrl());
hMap.put("appIconBase64",details.getIconBase64());
hMap.put("appPackageName",details.getPackageName());
arrayList.add(hMap);
}
pendingResult.success(hMap);
pendingResult.success(arrayList);
}
});
}
Expand Down
17 changes: 13 additions & 4 deletions example/lib/payment_slection_page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:collection';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:razorpay_flutter_customui/razorpay_flutter_customui.dart';
Expand All @@ -15,7 +17,7 @@ class _PaymentSelectionPageState extends State<PaymentSelectionPage> {
PaymentMethods selectedMethod = PaymentMethods.card;
CardInfoModel? cardInfoModel;
String key = "rzp_test_1DP5mmOlF5G5ag";
String? availableUpiApps;
String availableUpiApps ="";
bool showUpiApps = false;

//rzp_test_1DP5mmOlF5G5ag ---> Debug Key
Expand Down Expand Up @@ -388,12 +390,19 @@ class _PaymentSelectionPageState extends State<PaymentSelectionPage> {
),
ElevatedButton(
onPressed: () async {
final upiApps = await _razorpay.getAppsWhichSupportUpi();
availableUpiApps = upiApps.toString();
final upiApps = await _razorpay.getAppsWhichSupportUpi() as List<dynamic>;
// availableUpiApps = upiApps.toString();
availableUpiApps = "";
setState(() {
showUpiApps = true;
});
print(upiApps);
var correctedList = <dynamic>[];
for (var i=0; i<upiApps.length; i++){
var map = upiApps[i] as Map<dynamic, dynamic>;
map.remove("appIconBase64");
correctedList.add(map);
}
availableUpiApps = correctedList.toString();
},
child: Text('Get All UPI Supported Apps'),
),
Expand Down