updatePaymentConsent method
Future<Map>
updatePaymentConsent(
- String token,
- String paymentConsentId,
- Map<
String, dynamic> ? metadata, - Map<
String, dynamic> ? paymentMethod, - String requestId,
override
Implementation
@override
Future<Map> updatePaymentConsent(
String token,
String paymentConsentId,
Map<String, dynamic>? metadata,
Map<String, dynamic>? paymentMethod,
String requestId) async {
final baseUrl = await getBaseUrl;
var url = Uri.parse(
"$baseUrl/api/v1/pa/payment_consents/$paymentConsentId/update");
Map<String, dynamic> bodyData = {
"request_id": requestId,
};
if (metadata != null) {
bodyData.addAll({"metadata": metadata});
}
if (paymentMethod != null) {
bodyData.addAll({"payment_method": paymentMethod});
}
var jsonBody = jsonEncode(bodyData);
var response = await http.post(
url,
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer $token"
},
body: jsonBody,
);
var data = jsonDecode(response.body);
return data;
}