2022-03-31 17:54:45 +00:00
|
|
|
class PaymentRequest {
|
2022-11-08 12:44:58 +00:00
|
|
|
PaymentRequest(this.address, this.amount, this.note, {this.scheme});
|
2022-03-31 17:54:45 +00:00
|
|
|
|
|
|
|
factory PaymentRequest.fromUri(Uri uri) {
|
|
|
|
var address = "";
|
|
|
|
var amount = "";
|
2022-08-11 14:40:38 +00:00
|
|
|
var note = "";
|
2022-08-09 15:06:21 +00:00
|
|
|
var scheme = "";
|
2022-03-31 17:54:45 +00:00
|
|
|
|
|
|
|
if (uri != null) {
|
|
|
|
address = uri.path;
|
|
|
|
amount = uri.queryParameters['tx_amount'] ?? uri.queryParameters['amount'] ?? "";
|
2022-08-11 14:40:38 +00:00
|
|
|
note = uri.queryParameters['tx_description']
|
|
|
|
?? uri.queryParameters['message'] ?? "";
|
2022-08-09 15:06:21 +00:00
|
|
|
scheme = uri.scheme;
|
2022-03-31 17:54:45 +00:00
|
|
|
}
|
|
|
|
|
2022-11-08 12:44:58 +00:00
|
|
|
return PaymentRequest(address, amount, note, scheme: scheme);
|
2022-03-31 17:54:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
final String address;
|
|
|
|
final String amount;
|
2022-08-11 14:40:38 +00:00
|
|
|
final String note;
|
2022-08-09 15:06:21 +00:00
|
|
|
final String scheme;
|
2022-03-31 17:54:45 +00:00
|
|
|
}
|