public void MapsCorrectly_GatewayRequest_To_ProcessorRequest()
        {
            var gatewayRequest = GetTestGatewayRequest();
            var result         = PaymentProcessorMapper.MapRequest(gatewayRequest);

            Check.That(result).IsNotNull();
            Check.That(result.LongCardNumber).Equals(gatewayRequest.LongNumber);
            Check.That(result.CCV).Equals(gatewayRequest.CVV);
            Check.That(result.NameOnCard).Equals(gatewayRequest.NameOnCard);
            Check.That(result.PaymentAmount).Equals(gatewayRequest.PaymentAmount);
            Check.That(result.PaymentCurrency).Equals(gatewayRequest.PaymentCurrency);
        }
Beispiel #2
0
        public async Task <GatewayResponse> HandlePaymentRequest(GatewayPaymentRequest request)
        {
            var encyptedRequest = CardEncryptor.EncryptCardData(request);
            var gatewayId       = await repository.RegisterPaymentRequest(encyptedRequest);

            var paymentRequest = PaymentProcessorMapper.MapRequest(request);
            var result         = await paymentProcessor.HandlePaymentRequest(paymentRequest);

            var response = PaymentProcessorMapper.MapResponse(result, encyptedRequest);

            await repository.RegisterResponse(response);

            return(response);
        }