public RequestDocumentCreationTests()
        {
            _payment = FakePayment.CreatePayment(125m, PaymentType.CreditCard, Guid.NewGuid());
            _payment.Properties[DataCashPaymentGateway.DataCashReferencePropertyName]         = "DataCashReferencePropertyValue";
            _payment.Properties[DataCashPaymentGateway.DataCashAuthenticateCodePropertyName]  = "DataCashAuthenticateCodePropertyValue";
            _payment.Properties[DataCashPaymentGateway.DataCashMerchantReferencePropertyName] = "DataCashMerchantReferencePropertyValue";
            _payment.ProviderTransactionID = "ProviderTransactionIDValue";

            var orderForm = FakeOrderForm.CreateOrderForm();
            var shipment  = new FakeShipment();

            shipment.ShippingAddress = FakeOrderAddress.CreateOrderAddress();

            orderForm.Shipments.Add(shipment);
            orderForm.Payments.Add(_payment);

            _cart = new FakeOrderGroup();
            _cart.Forms.Add(orderForm);

            var _orderGroupCalculatorMock = new Mock <IOrderGroupCalculator>();

            _orderGroupCalculatorMock.Setup(x => x.GetTotal(It.IsAny <IOrderGroup>())).Returns(new Money(125m, Currency.USD));
            var _lineItemCalculatorMock = new Mock <ILineItemCalculator>();

            _lineItemCalculatorMock.Setup(x => x.GetExtendedPrice(It.IsAny <ILineItem>(), It.IsAny <Currency>())).Returns(new Money(115.33m, Currency.USD));

            _subject = new RequestDocumentCreation(_orderGroupCalculatorMock.Object, _lineItemCalculatorMock.Object, new FakeDataCashConfiguration());
        }
Пример #2
0
        public void Can_Create_Omnium_Payment()
        {
            var payment = FakePayment.CreatePayment();

            var omniumPayment = DefaultOmniumOrderFactorySubject.MapPayment(payment, new Money(payment.Amount, Currency));

            var result =
                payment.Status.Equals(omniumPayment.Status) &&
                payment.Amount.Equals(omniumPayment.Amount) &&
                payment.PaymentMethodId == omniumPayment.PaymentMethodId &&
                payment.TransactionType.Equals(omniumPayment.TransactionType) &&
                payment.ImplementationClass.Equals(omniumPayment.ImplementationClass) &&
                payment.AuthorizationCode.Equals(omniumPayment.AuthorizationCode) &&
                payment.TransactionID.Equals(omniumPayment.TransactionID) &&
                payment.ValidationCode.Equals(omniumPayment.ValidationCode);

            Assert.True(result);
        }
Пример #3
0
        public DIBSRequestHelperTests()
        {
            _payment = FakePayment.CreatePayment(125m, PaymentType.CreditCard, Guid.NewGuid());

            var orderForm = FakeOrderForm.CreateOrderForm();
            var shipment  = new FakeShipment();

            orderForm.Shipments.Add(shipment);
            orderForm.Payments.Add(_payment);

            _orderGroup = new FakeOrderGroup();
            _orderGroup.Forms.Add(orderForm);

            _dibsConfiguration = new DIBSConfigurationForTest();

            var orderNumberGeneratorMock = new Mock <IOrderNumberGenerator>();

            orderNumberGeneratorMock.Setup(x => x.GenerateOrderNumber(It.IsAny <IOrderGroup>())).Returns(_orderNumber);

            _subject = new DIBSRequestHelperForTest(orderNumberGeneratorMock.Object, new SiteContext(), _dibsConfiguration);
        }