Skip to content

Instantly share code, notes, and snippets.

@ologunB
Created February 3, 2021 18:50
Show Gist options
  • Save ologunB/289e5241474a605e85cbfcfa19a88f10 to your computer and use it in GitHub Desktop.
Save ologunB/289e5241474a605e85cbfcfa19a88f10 to your computer and use it in GitHub Desktop.
processTransaction(context) async {
var initializer = RavePayInitializer(
amount: double.parse(amountController.text),
publicKey: ravePublicKey,
encryptionKey: raveEncryptKey)
..country = "NG"
..currency = "NGN"
..email = mEmail
..fName = mName
..lName = "lName"
..narration = "FABAT MANAGEMENT"
..txRef = "SCH${DateTime.now().millisecondsSinceEpoch}"
..acceptAccountPayments = false
..acceptCardPayments = true
..acceptAchPayments = false
..acceptGHMobileMoneyPayments = false
..acceptUgMobileMoneyPayments = false
..staging = false
..isPreAuth = true
..displayFee = true;
RavePayManager()
.prompt(context: context, initializer: initializer)
.then((result) {
Toast.show("err", context,
gravity: Toast.TOP, duration: Toast.LENGTH_LONG);
if (result.status == RaveStatus.success) {
doAfterSuccess(result.message);
} else if (result.status == RaveStatus.cancelled) {
if (mounted) {
scaffoldKey.currentState.showSnackBar(
SnackBar(
content: Text(
"Closed!",
style: TextStyle(color: Colors.white, fontSize: 18),
),
backgroundColor: primaryColor,
duration: Duration(seconds: 3),
),
);
}
} else if (result.status == RaveStatus.error) {
showDialog(
context: context,
builder: (_) {
return AlertDialog(
title: Text(
"Error",
textAlign: TextAlign.center,
style: TextStyle(color: Colors.red, fontSize: 20),
),
content: Text(
"An error has occured ",
textAlign: TextAlign.center,
style: TextStyle(fontSize: 18),
),
);
});
}
print(result);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment