Ejemplo n.º 1
0
        private Payment(Guid id, Guid orderId, decimal amount)
        {
            var @event = PaymentRequested.Create(id, orderId, amount);

            Enqueue(@event);
            Apply(@event);
        }
Ejemplo n.º 2
0
 internal void Apply(PaymentRequested @event)
 {
     Id         = @event.Id;
     Amount     = @event.Amount;
     CreditCard = @event.CreditCard;
     Status     = PaymentStatus.Pending;
 }
Ejemplo n.º 3
0
        private void Apply(PaymentRequested @event)
        {
            Version++;

            Id      = @event.PaymentId;
            OrderId = @event.OrderId;
            Amount  = @event.Amount;
        }
 private static void CheckPaymentRequestedFact(PaymentRequested paymentRequested, PaymentRequest request, Guid expectedGuid)
 {
     paymentRequested.ShouldNotBeNull();
     paymentRequested.Guid.ShouldBe(expectedGuid);
     paymentRequested.CustomerName.ShouldBe(request.CustomerName);
     paymentRequested.MerchantName.ShouldBe(request.MerchantName);
     paymentRequested.Amount.ShouldBe(request.Amount);
 }
Ejemplo n.º 5
0
        private void Apply(PaymentRequested evt)
        {
            GatewayPaymentId = evt.GatewayPaymentId;
            MerchantId       = evt.MerchantId;
            RequestId        = evt.RequestId;
            Status           = PaymentStatus.Pending;
            Card             = evt.Card;
            Amount           = evt.Amount;

            Version = evt.Version;
        }
        public override void Process(ServicePipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Assert.ArgumentNotNull(args.Request, "args.Request");
            Assert.ArgumentNotNull(args.Result, "args.Result");
            Assert.IsTrue(args.Request is RequestPaymentRequest, "args.Request is UpdatePaymentStatusRequest");
            Assert.IsTrue(args.Result is RequestPaymentResult, "args.Result is UpdatePaymentStatusResult");

            var request = (RequestPaymentRequest)args.Request;
            var result  = (RequestPaymentResult)args.Result;

            var command = Proxy.DoCommand <CommerceCommand>(GetContainer(request.GetShopName(), request.CustomerId, "", "", "", new DateTime?())
                                                            .RequestPayment(request.OrderId));

            PaymentRequested model = command.Models.OfType <PaymentRequested>().SingleOrDefault();

            if (model == null)
            {
                // Todo: Error handling
                return;
            }

            result.RedirectUrl = model.RedirectUrl;
        }
 private async Task Handle(PaymentRequested requested)
 {
     await _paymentDetailsRepository.Create(new GatewayPaymentId(requested.GatewayPaymentId), requested.Card);
 }