Example #1
0
        public override Payment GetPaymentInfo()
        {
            var payment = new WirePayment_V01();

            payment.PaymentCode     = ddlGateways.SelectedValue;
            payment.TransactionType = ddlGateways.SelectedItem.Text;
            payment.Currency        = HLConfigManager.Configurations.CheckoutConfiguration.Currency.Trim();
            payment.Address         = new Address_V01();

            Session.Remove(PaymentGatewayInvoker.PaymentInformation);
            Session.Add(PaymentGatewayInvoker.PaymentInformation, payment);

            return(payment);
        }
        private Payment CreateDummyPayment(Address_V01 address)
        {
            Payment payment = null;
            var     cc      = new CreditCard();

            cc.IssuerAssociation = CreditCard.GetCardType("VI");
            cc.AccountNumber     = PaymentInfoProvider.VisaCardNumber;
            cc.CVV        = "123";
            cc.Expiration = new DateTime(2012, 2, 1);
            cc.NameOnCard = "Test Card";

            switch (GetCurrentPaymentOption())
            {
            case PaymentOptionChoice.CreditCard:
            {
                var cp      = new CreditPayment_V01();
                var options = new PaymentOptions_V01();
                options.NumberOfInstallments = 1;
                cp.PaymentOptions            = options;
                cp.AuthorizationMethod       = AuthorizationMethodType.Online;
                cp.AuthorizationCode         = "123456";
                cp.Card = cc;
                payment = cp;
                break;
            }

            case PaymentOptionChoice.PaymentGateway:
            {
                var cp      = new CreditPayment_V01();
                var options = new PaymentOptions_V01();
                options.NumberOfInstallments = 1;
                string payCode = HLConfigManager.Configurations.PaymentsConfiguration.PaymentGatewayPayCode;
                if (!string.IsNullOrEmpty(payCode))
                {
                    cc.IssuerAssociation = CreditCard.GetCardType(payCode);
                }
                cp.Card                = cc;
                cp.PaymentOptions      = options;
                cp.AuthorizationMethod = AuthorizationMethodType.PaymentGateway;
                cp.TransactionType     = HLConfigManager.Configurations.PaymentsConfiguration.PaymentGatewayAlias;
                cp.AuthorizationCode   = "654321";
                //cp.TransactionID = (null != _paymentGatewayResponse) ? _paymentGatewayResponse.TransactionCode : Guid.NewGuid().ToString();
                cp.Card = cc;
                payment = cp;
                break;
            }

            case PaymentOptionChoice.WireTransfer:
            {
                var wp = new WirePayment_V01();
                wp.TransactionType = ddlWire.SelectedItem.Text;
                wp.PaymentCode     = ddlWire.SelectedValue;
                wp.ReferenceID     = DistributorOrderingProfile.ReferenceNumber;
                wp.TransactionType = GetLocalResourceObject("ListItemResource3.Text") as string +
                                     ddlWire.SelectedItem.Text;
                payment = wp;
                break;
            }

            case PaymentOptionChoice.DirectDeposit:
            {
                var wp = new DirectDepositPayment_V01();
                wp.PaymentCode     = ddlDirectDeposit.SelectedValue;
                wp.ReferenceID     = DistributorOrderingProfile.ReferenceNumber;
                wp.TransactionType = string.Format("{0}{1}",
                                                   GetLocalResourceObject("ListItemResource4.Text") as string,
                                                   ddlDirectDeposit.Items.Count > 1
                                                               ? string.Format("/{0}",
                                                                               ddlDirectDeposit.SelectedItem.Text)
                                                               : string.Empty);
                payment = wp;
                break;
            }
            }
            if (null == address)
            {
                address = new Address_V01();
                //address = new Address_V01();
                //address.City = "Torrance";
                //address.Country = _countryCode;
                //address.CountyDistrict = "Los Angeles";
                //address.Line1 = "950W 190th Street";
                //address.PostalCode = "90502";
                //address.StateProvinceTerritory = "CA";
            }
            if (null == payment.Address)
            {
                payment.Address = address;
            }
            payment.Address  = address;
            payment.Amount   = GetTotals().AmountDue;
            payment.Currency = HLConfigManager.Configurations.CheckoutConfiguration.Currency;

            return(payment);
        }