Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improvising us bank account code #1547

Merged
Merged
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
67 changes: 37 additions & 30 deletions example/lib/screens/regional_payment_methods/us_bank_account.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,12 @@ class _UsBankAccountScreenState extends State<UsBankAccountScreen> {

void handleNexAction(NextAction? action, String clientSecret) {
action?.maybeWhen(
verifyWithMicroDeposits: (_, __, ___) {
verifyWithMicroDeposits: (arrivalDate, redirectUrl, microdepositType) {
showDialog(
context: context,
builder: (context) {
return _VerifyMicroDepositsDialog(
microdepositType: microdepositType,
clientSecret: clientSecret,
);
});
Expand Down Expand Up @@ -153,9 +154,11 @@ class _UsBankAccountScreenState extends State<UsBankAccountScreen> {
class _VerifyMicroDepositsDialog extends StatefulWidget {
const _VerifyMicroDepositsDialog({
required this.clientSecret,
required this.microdepositType,
Key? key,
}) : super(key: key);
final String clientSecret;
final String microdepositType;

@override
State<_VerifyMicroDepositsDialog> createState() =>
Expand Down Expand Up @@ -190,13 +193,11 @@ class _VerifyMicroDepositsDialogState
isPaymentIntent: true,
clientSecret: widget.clientSecret,
params: VerifyMicroDepositsParams(
descriptorCode: _descriptorController.text.isNotEmpty
? _descriptorController.text
descriptorCode: widget.microdepositType == "descriptorCode"
? _descriptorController.text
: null,
amounts: _descriptorController.text.isEmpty &&
_amount1Controller.text.isNotEmpty &&
_amount2Controller.text.isNotEmpty
? [
amounts: widget.microdepositType != "descriptorCode"
? [
int.parse(_amount1Controller.text),
int.parse(_amount2Controller.text),
]
Expand All @@ -221,33 +222,39 @@ class _VerifyMicroDepositsDialogState
children: [
Text('Enter the details of the micro deposits verification'),
SizedBox(height: 10),
TextField(
Visibility(
visible: widget.microdepositType =="descriptorCode",
child: TextField(
controller: _descriptorController,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: 'Descriptor',
),
),
SizedBox(height: 10),
Text('As alternative enter the microdeposits'),
SizedBox(height: 10),
TextField(
keyboardType: TextInputType.number,
controller: _amount1Controller,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: 'Microdeposit 1 value',
),
),
SizedBox(height: 10),
TextField(
controller: _amount2Controller,
keyboardType: TextInputType.number,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: 'Microdeposit 1 value',
),
),
),),
Visibility(
visible: widget.microdepositType !="descriptorCode",
child: Column(
children: [
SizedBox(height: 10),
TextField(
keyboardType: TextInputType.number,
controller: _amount1Controller,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: 'Microdeposit 1 value',
),
),
SizedBox(height: 10),
TextField(
controller: _amount2Controller,
keyboardType: TextInputType.number,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: 'Microdeposit 2 value',
),
),
],
)),
SizedBox(height: 10),
LoadingButton(
onPressed: () async {
Expand All @@ -261,4 +268,4 @@ class _VerifyMicroDepositsDialogState
),
);
}
}
}
Loading