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
15 changes: 8 additions & 7 deletions lib/models/requests/customer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@ import '../../utils.dart';

class Customer {
String email;
String? phoneNumber;
String? name;
String phoneNumber;
String name;

Customer({required this.email, this.name, this.phoneNumber});
Customer(
{required this.name, required this.phoneNumber, required this.email});

/// Converts instance of Customer to json
Map<String, dynamic> toJson() {
final customer = {
final customer = {
"email": this.email,
"phonenumber": this.phoneNumber ?? "",
"name": this.name ?? ""
"phone_number": this.phoneNumber,
"name": this.name
};
return Utils.removeKeysWithEmptyValues(customer);
}
}
}
26 changes: 14 additions & 12 deletions lib/models/requests/standard_request.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,19 @@ class StandardRequest {
List<SubAccount>? subAccounts;
Map<dynamic, dynamic>? meta;

StandardRequest({required this.txRef,
required this.amount,
required this.customer,
required this.paymentOptions,
required this.customization,
required this.isTestMode,
required this.publicKey,
required this.redirectUrl,
this.currency,
this.paymentPlanId,
this.subAccounts,
this.meta});
StandardRequest(
{required this.txRef,
required this.amount,
required this.customer,
required this.paymentOptions,
required this.customization,
required this.isTestMode,
required this.publicKey,
required this.redirectUrl,
this.currency,
this.paymentPlanId,
this.subAccounts,
this.meta});

String toString() => jsonEncode(this._toJson());

Expand All @@ -53,6 +54,7 @@ class StandardRequest {
"meta": this.meta,
"customizations": customization.toJson()
};
print(this.customer.toJson());
return Utils.removeKeysWithEmptyValues(request);
}

Expand Down