initTransactionSession method
Implementation
Future<ResponseDto<TransactionSessionResponseDto>> initTransactionSession(
int customerId, String successUrl, String failureUrl,
double paidAmount, String transactionReference, String authToken) async {
final InitTransactionSessionRequestDto sessionDto = InitTransactionSessionRequestDto(
customerId: customerId,
successUrl: successUrl,
failureUrl: failureUrl,
paidAmount: paidAmount,
transactionReference: transactionReference);
final RequestDto<InitTransactionSessionRequestDto> requestDto = RequestDto<
InitTransactionSessionRequestDto>(body: sessionDto);
final String requestJson = json.encode(requestDto.toJson());
final String requestHash = HttpUtils.computeHash(
requestJson, _requestHashKey);
final Map<String, dynamic> response = await ApiGatewayClient(_stage)
.postAndParseJson(
_initTransactionSessionInfoPath, requestJson, _apiKey,
authToken: authToken,
requestHash: requestHash);
final ResponseDto<TransactionSessionResponseDto> responseDto = ResponseDto<
TransactionSessionResponseDto>
.fromJson(response, TransactionSessionResponseDto.fromJson);
responseDto.throwApiExceptionIfError();
return responseDto;
}