order method
Implementation
Future<PayUOrderResponse> order(
PayUOrderRequest orderRequest, PayUAuthResponse auth) async {
Map<String, String> headers = {
HttpHeaders.contentTypeHeader: 'application/json',
HttpHeaders.authorizationHeader: 'Bearer ${auth.accessToken}',
};
http.Response res = await http.post(
Uri.parse('$baseUrl/api/v2_1/orders'),
headers: headers,
body: jsonEncode(orderRequest.toJson()),
);
Map<String, dynamic> json = jsonDecode(res.body);
print(json);
if (json['status']['statusCode'] != 'SUCCESS')
throw Exception('http.post error: statusCode= ${res.statusCode}');
return PayUOrderResponse.fromJson(json);
}