protected override async Task <IBankResponse> CallBank(PayingAttempt payingAttempt, CancellationToken cancellationToken) { // Simulate bank response delay var delay = DelayProvider.Delays(); await Task.Delay(delay, cancellationToken); // Call bank's service var request = new BNPPaymentRequest(payingAttempt.GatewayPaymentId, payingAttempt.Amount, payingAttempt.Currency, payingAttempt.CardCvv, payingAttempt.CardExpiry, payingAttempt.CardNumber); BNPResponse response = await _bnp.RespondToPayment(request); _paymentIdsMapper.RememberMapping(new AcquiringBankPaymentId(response.BankPaymentId), new GatewayPaymentId(response.GatewayPaymentId)); return(AdaptToBankResponse(response)); }
private IBankResponse AdaptToBankResponse(BNPResponse response) { return(new BankResponse(response.BankPaymentId, response.GatewayPaymentId, response.PaymentStatus)); }