Exemplo n.º 1
0
        protected override async Task <IBankResponse> CallBank(PayingAttempt payingAttempt, CancellationToken cancellationToken)
        {
            var neverChangingBankPaymentId = Guid.Parse("d6589823-2bfa-4e1a-9f3f-699cb9a0a0a2");
            var response = new BankResponse(bankPaymentId: neverChangingBankPaymentId, gatewayPaymentId: payingAttempt.GatewayPaymentId, paymentStatus: BankPaymentStatus.Accepted);

            _paymentIdsMapper.RememberMapping(new AcquiringBankPaymentId(neverChangingBankPaymentId), new GatewayPaymentId(response.GatewayPaymentId));

            return(await Task.FromResult(response));
        }
Exemplo n.º 2
0
        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));
        }