diff --git a/lib/models/requests/customer.dart b/lib/models/requests/customer.dart index 151f809..fb31bdd 100644 --- a/lib/models/requests/customer.dart +++ b/lib/models/requests/customer.dart @@ -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 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); } -} \ No newline at end of file +} diff --git a/lib/models/requests/standard_request.dart b/lib/models/requests/standard_request.dart index 10634bb..1904690 100644 --- a/lib/models/requests/standard_request.dart +++ b/lib/models/requests/standard_request.dart @@ -23,18 +23,19 @@ class StandardRequest { List? subAccounts; Map? 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()); @@ -53,6 +54,7 @@ class StandardRequest { "meta": this.meta, "customizations": customization.toJson() }; + print(this.customer.toJson()); return Utils.removeKeysWithEmptyValues(request); }