Skip to content

Commit 969b6c6

Browse files
committed
basic comment added and added some modifications
1 parent 56f85df commit 969b6c6

File tree

3 files changed

+25
-12
lines changed

3 files changed

+25
-12
lines changed

example/android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if (localPropertiesFile.exists()) {
88

99
def flutterRoot = localProperties.getProperty('flutter.sdk')
1010
if (flutterRoot == null) {
11-
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
11+
throw GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
1212
}
1313

1414
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
2626
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2727

2828
android {
29-
compileSdkVersion flutter.compileSdkVersion
29+
compileSdkVersion 33
3030
ndkVersion flutter.ndkVersion
3131

3232
compileOptions {

example/lib/main.dart

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,23 @@ class HomePageState extends State<HomePage> {
175175
setState(() {
176176
isLoading = true;
177177
});
178-
final flutterBkash = FlutterBkash();
178+
final flutterBkash = FlutterBkash(
179+
bkashCredentials: const BkashCredentials(
180+
appKey: "",
181+
appSecret: "",
182+
password: "",
183+
username: "",
184+
isSandbox: false));
179185

180186
if (_paymentType == PaymentType.createAgreement) {
181187
try {
182188
// remove focus from TextField to hide keyboard
183189
FocusManager.instance.primaryFocus?.unfocus();
184190
final result = await flutterBkash
185191
.createAgreement(context: context);
186-
dev.log(result.toString());
192+
dev.log(
193+
name: "createAgreement -> ",
194+
result.toString());
187195
} on BkashFailure catch (e, st) {
188196
dev.log(e.message, error: e, stackTrace: st);
189197
} catch (e) {
@@ -216,11 +224,13 @@ class HomePageState extends State<HomePage> {
216224
try {
217225
final res = await flutterBkash.pay(
218226
context: context,
219-
amount: double.parse(amount),
220-
marchentInvoiceNumber: "tranId",
227+
amount: double.parse(amount), // need it double type
228+
merchantInvoiceNumber: "tranId",
221229
);
222230

223-
dev.log(res.toString());
231+
dev.log(
232+
name: "withoutAgreement -> ",
233+
res.toString());
224234
} on BkashFailure catch (e, st) {
225235
dev.log(e.message, error: e, stackTrace: st);
226236
} catch (e) {
@@ -266,12 +276,12 @@ class HomePageState extends State<HomePage> {
266276
// Goto BkashPayment page & pass the params
267277
try {
268278
final result =
269-
await flutterBkash.paywithAgreement(
279+
await flutterBkash.payWithAgreement(
270280
context: context,
271281
amount: double.parse(amount),
272282
agreementId: agreementId,
273283
marchentInvoiceNumber:
274-
"marchentInvoiceNumber",
284+
"merchantInvoiceNumber",
275285
);
276286

277287
dev.log(result.toString());

lib/src/flutter_bkash.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,11 @@ class FlutterBkash {
7272
}
7373
}
7474

75+
// pay without agreement
7576
Future<BkashPaymentResponse> pay({
7677
required BuildContext context,
7778
required double amount,
78-
required String marchentInvoiceNumber,
79+
required String merchantInvoiceNumber,
7980
}) async {
8081
await _validateToken();
8182

@@ -85,7 +86,7 @@ class FlutterBkash {
8586
final apiResponse = await _bkashApi.payWithoutAgreement(
8687
idToken: tokenRes.idToken,
8788
amount: amount.toString(),
88-
marchentInvoiceNumber: marchentInvoiceNumber,
89+
marchentInvoiceNumber: merchantInvoiceNumber,
8990
);
9091

9192
return await apiResponse.fold<Future<BkashPaymentResponse>>(
@@ -147,7 +148,8 @@ class FlutterBkash {
147148
return paymentResponse;
148149
}
149150

150-
Future<BkashPaymentResponse> paywithAgreement({
151+
// after agreement - pay with agreement
152+
Future<BkashPaymentResponse> payWithAgreement({
151153
required BuildContext context,
152154
required double amount,
153155
required String agreementId,
@@ -224,6 +226,7 @@ class FlutterBkash {
224226
return paymentResponse;
225227
}
226228

229+
// create agreement when first time create to agreement
227230
Future<BkashAgreementResponse> createAgreement({
228231
required BuildContext context,
229232
}) async {

0 commit comments

Comments
 (0)