Example #1
0
        static void Main(string[] args)
        {
            PaymentTypeFactory pf = null;

            while (true)
            {
                Console.WriteLine("Select payment method: \n1_ credit \n2_ debit \nother_ exit");
                string pmethod = Console.ReadLine();

                switch (pmethod)
                {
                case "1":
                    pf = new CreditCardCreator();
                    break;

                case "2":
                    pf = new DebitCardCreator();
                    break;

                default:
                    Console.WriteLine("No payment selected.");
                    return;
                }

                IPaymentType pt = pf.GetPaymentType();

                Console.WriteLine(pt.Charge(1000));
            }
        }
Example #2
0
 public Payment(IPaymentType paymentType, decimal amount, bool isProcessed, object additionalData)
 {
     PaymentType    = paymentType;
     Amount         = amount;
     AdditionalData = additionalData;
     IsProcessed    = isProcessed;
 }
Example #3
0
        public IPaymentType Get(PaymentScheme paymentScheme)
        {
            IPaymentType paymentType = this._paymentTypes.FirstOrDefault(p => p.Type == paymentScheme);

            Guard.AgainstNull(paymentType, $"PaymentType for Scheme {paymentScheme.ToString()} is not registered.");

            return(paymentType);
        }
Example #4
0
 public PaymentService(IOperationService operationService, ICredentials credentials)
 {
     this.operationService = operationService;
     this.credentials      = credentials;
     cashPaymentType       = operationService
                             .GetPaymentTypes()
                             .Single(x => x.Kind == PaymentTypeKind.Cash);
 }
Example #5
0
        public AddEditPaymentForm(Common.MFType mfType, IPaymentType paymentType)
        {
            InitializeComponent();

            this.Text = Common.TextAdd;

            grpPayment.Text = string.Format(grpPayment.Text, Common.MFTypes[(int)mfType]);
            lstPaymentTypes.DataSource = paymentType.GetTypes();
        }
Example #6
0
 public PaimentController(IStudent _stu, IClass _cls,
                          IPayment Pmt, IPaymentType Pmtype, IPaymentFor PmFor)
 {
     stu         = _stu;
     cls         = _cls;
     this.Pmt    = Pmt;
     this.Pmtype = Pmtype;
     this.PmFor  = PmFor;
 }
Example #7
0
        public PaymentTypeForm(Common.MFType mfType, IPaymentCategory paymentCategory, IPaymentType paymentType)
        {
            InitializeComponent();

            _paymentCategory = paymentCategory;
            _paymentType = paymentType;

            this.Text = string.Format(this.Text, Common.MFTypes[(int)mfType]);
        }
Example #8
0
        public AddEditPaymentForm(Common.MFType mfType, IPaymentType paymentType, IPayment payment)
            : this(mfType, paymentType)
        {
            this.Text = Common.TextEdit;

            lstPaymentTypes.Text = payment.TypeName;
            dtpPaymentDate.Value = payment.PaymentDate;
            txtAmount.Text = payment.Amount.ToString(Common.FormatMoney);
            txtComment.Text = payment.Comment;
        }
Example #9
0
        public Showcases(IOperationService operationService, ILog logger, string pin, IPaymentType cardPayment, IPaymentType bonusPayment)
        {
            this.operationService = operationService;
            this.logger           = logger;
            var credentials = operationService.AuthenticateByPin(pin);

            paymentService = new PaymentService(operationService, credentials);

            cardPaymentType  = cardPayment;
            bonusPaymentType = bonusPayment;
        }
Example #10
0
        public PaymentCode(PaymentMethod paymentMethod, IPaymentType paymentType)
        {
            if (paymentMethod == null)
            {
                throw new ArgumentNullException("paymentMethod", "moneybookers.exception.nullmethod");
            }

            if (paymentType == null)
            {
                throw new ArgumentNullException("paymentType", "moneybookers.exception.nulltype");
            }

            PaymentMethod = paymentMethod;
            PaymentType   = paymentType;
        }
Example #11
0
        public SearchPaymentForm(Common.MFType mfType, IPayment payment, IPaymentCategory paymentCategory, IPaymentType paymentType)
        {
            List<IPaymentCategory> paymentCategories;

            InitializeComponent();

            _MFType = mfType;
            _payment = payment;
            _paymentType = paymentType;

            if (mfType == Common.MFType.Expense)
            {
                this.Text = string.Format(this.Text, "Expenses");
            }
            else
            {
                this.Text = string.Format(this.Text, Common.MFTypes[(int)mfType]);
            }

            paymentCategories = paymentCategory.GetCategories();
            paymentCategories.Insert(0, paymentCategory.CreateCategory(_ListItemAll));

            cboCategories.DataSource = paymentCategories;
        }
Example #12
0
 public PaymentTypesController(IPaymentType paymentTypes)
 {
     _paymentTypes = paymentTypes;
 }
Example #13
0
 public AddEditPaymentForm(Common.MFType mfType, IPaymentType paymentType, DateTime paymentDate)
     : this(mfType, paymentType)
 {
     dtpPaymentDate.Value = paymentDate;
 }
Example #14
0
        private void ShowEditPaymentForm(IPayment payment, ItemControl ucPayments, Common.MFType mfType, IPaymentType paymentType)
        {
            AddEditPaymentForm paymentForm;
            IPayment selectedPayment;

            selectedPayment = (IPayment)ucPayments.SelectedRow;

            paymentForm = new AddEditPaymentForm(mfType, paymentType, selectedPayment);

            if (paymentForm.ShowDialog() == DialogResult.OK)
            {
                payment.Edit(selectedPayment.Id, paymentForm.TypeId, paymentForm.PaymentDate, paymentForm.Amount, paymentForm.Comment);
                ucPayments.PopulateList(new SortableBindingList<IPayment>(payment.GetPayments(_year, _week)));

                _modified = true;
            }

            paymentForm.Dispose();
        }
Example #15
0
        private void ShowAddPaymentForm(IPayment payment, Common.MFType mfType, IPaymentType paymentType, ItemControl grdPayments)
        {
            AddEditPaymentForm paymentForm;

            paymentForm = new AddEditPaymentForm(mfType, paymentType, _startDate);

            if (paymentForm.ShowDialog() == DialogResult.OK)
            {
                payment.Add(paymentForm.TypeId, paymentForm.PaymentDate, paymentForm.Amount, paymentForm.Comment);
                grdPayments.PopulateList(new SortableBindingList<IPayment>(payment.GetPayments(_year, _week)));

                _modified = true;
            }

            paymentForm.Dispose();
        }
 public PaymentTypeController(IPaymentType repository)
 {
     _repository = repository;
 }
Example #17
0
File: Test.cs Project: ibavli/SOLID
 public Test(IPaymentType paymentType)
 {
     paymentSystem = new PaymentSystem(paymentType);
 }
Example #18
0
        public PaymentRequest <CreditCardPaymentMethod> BuildCreditCardPaymentRequest(
            IPaymentType paymentType,
            int orderNumber,
            string orderReferenceId,
            int orderCustomerId,
            string orderCustomerEmail,
            string orderCustomerFirstName,
            string orderCustomerLastName,
            string orderCustomerAddress,
            string orderCustomerCity,
            string orderCustomerState,
            string orderCustomerZip,
            string orderCustomerCountry,
            string orderCustomerIp,
            decimal orderTotal,
            string orderCreditCardType,
            string orderCreditCardNumber,
            string orderCreditCardExpirationMonth,
            string orderCreditCardExpirationYear,
            string orderCreditCardIssueNumber,
            string orderCreditCardCvv)
        {
            UniqueIdentifier instanceId      = LoadAppConfigString("Moneybookers.SenderID", s => new UniqueIdentifier(s));
            TransactionMode  transactionMode = TransactionMode;
            ResponseMode     responseMode    = ResponseMode.Sync;
            UniqueIdentifier channelId       = LoadAppConfigString("Moneybookers.ChannelID", s => new UniqueIdentifier(s));
            UniqueIdentifier userLogin       = LoadAppConfigString("Moneybookers.UserLogin", s => new UniqueIdentifier(s));
            UserPassword     userPassword    = LoadAppConfigString("Moneybookers.UserPassword", s => new UserPassword(s));
            LimitedString    transactionId   = null;
            LimitedString    invoiceId       = new LimitedString(orderNumber.ToString());
            LimitedString    shopperId       = new LimitedString(orderCustomerEmail.TrimToMax(LimitedString.MaxLength));

            UniqueIdentifier referenceId = null;

            if (orderReferenceId != null)
            {
                referenceId = new UniqueIdentifier(orderReferenceId);
            }

            Amount        paymentAmount      = new Amount(orderTotal);
            Currency      paymentCurrency    = LoadAppConfigString("Localization.StoreCurrency", s => new Currency(s));
            LimitedString paymentUsage       = new LimitedString(String.Format("Order number {0}", orderNumber));
            Prefix        customerSalutation = null;
            Prefix        customerTitle      = null;
            Name          customerGivenName  = new Name(orderCustomerFirstName.TrimToMax(Name.MaxLength));
            Name          customerFamilyName = new Name(orderCustomerLastName.TrimToMax(Name.MaxLength));
            Sex           customerSex        = null;
            Date          customerBirthdate  = null;
            Name          customerCompany    = null;
            Street        customerStreet     = new Street(orderCustomerAddress.TrimToMax(Street.MaxLength));
            Zip           customerZip        = new Zip(orderCustomerZip.TrimToMax(Zip.MaxLength));
            City          customerCity       = new City(orderCustomerCity.TrimToMax(City.MaxLength));

            State customerState = null;

            if (orderCustomerState != null)
            {
                customerState = new State(orderCustomerState.TrimToMax(State.MaxLength));
            }

            string      orderCustomerCountryCode = AppLogic.GetCountryTwoLetterISOCode(orderCustomerCountry);
            CountryCode customerCountry          = new CountryCode(orderCustomerCountryCode.TrimToMax(CountryCode.MaxLength));

            PhoneNumber       customerPhone       = null;
            MobilePhoneNumber customerMobilePhone = null;

            EmailAddress customerEmail;

            if (String.IsNullOrEmpty(orderCustomerEmail))
            {
                customerEmail = new EmailAddress("*****@*****.**".TrimToMax(EmailAddress.MaxLength));
            }
            else
            {
                customerEmail = new EmailAddress(orderCustomerEmail.TrimToMax(EmailAddress.MaxLength));
            }

            var       formattedOrderCustomerIp = String.Join(".", orderCustomerIp.Split('.').Select(s => s.PadLeft(3, '0')).ToArray());
            IpAddress customerIp = new IpAddress(formattedOrderCustomerIp);

            AccountHolder      accountHolder      = new AccountHolder(String.Format("{0} {1}", orderCustomerFirstName, orderCustomerLastName).TrimToMax(AccountHolder.MaxLength));
            AccountNumber      accountNumber      = new AccountNumber(orderCreditCardNumber);
            AccountBrand       accountBrand       = new AccountBrand(orderCreditCardType);
            AccountExpiryMonth accountExpiryMonth = new AccountExpiryMonth(orderCreditCardExpirationMonth);
            AccountExpiryYear  accountExpiryYear  = new AccountExpiryYear(orderCreditCardExpirationYear);

            AccountCardIssueNumber accountCardIssueNumber = null;

            if (orderCreditCardIssueNumber != null)
            {
                accountCardIssueNumber = new AccountCardIssueNumber(orderCreditCardIssueNumber);
            }

            AccountVerification accountVerification = new AccountVerification(orderCreditCardCvv);

            LimitedString sessionId = new LimitedString(orderCustomerId.ToString());

            CreditCardPaymentMethod paymentMethod = new CreditCardPaymentMethod(
                accountHolder,
                accountNumber,
                accountBrand,
                accountExpiryMonth,
                accountExpiryYear,
                accountCardIssueNumber,
                accountVerification);

            PaymentCode paymentCode = new PaymentCode(paymentMethod, paymentType);

            PaymentRequest <CreditCardPaymentMethod> paymentRequest = new PaymentRequest <CreditCardPaymentMethod>(
                instanceId,
                transactionMode,
                responseMode,
                channelId,
                userLogin,
                userPassword,
                transactionId,
                invoiceId,
                shopperId,
                referenceId,
                paymentCode,
                paymentAmount,
                paymentCurrency,
                paymentUsage,
                customerSalutation,
                customerTitle,
                customerGivenName,
                customerFamilyName,
                customerSex,
                customerBirthdate,
                customerCompany,
                customerStreet,
                customerZip,
                customerCity,
                customerState,
                customerCountry,
                customerPhone,
                customerMobilePhone,
                customerEmail,
                customerIp,
                new LimitedString(AppLogic.GetStoreHTTPLocation(true) + "moneybookers3DSecureCallback.aspx"),
                sessionId);

            return(paymentRequest);
        }
Example #19
0
 public void Accept(IPaymentType paymentType)
 {
     paymentType.VisitLaundryService(this);
 }
Example #20
0
        private void ShowPaymentForm(IPayment payment, Common.MFType mfType, IPaymentType paymentType)
        {
            AddEditPaymentForm paymentForm;

            paymentForm = new AddEditPaymentForm(mfType, paymentType);

            if (paymentForm.ShowDialog() == DialogResult.OK)
            {
                payment.Add(paymentForm.TypeId, paymentForm.PaymentDate, paymentForm.Amount, paymentForm.Comment);

                _selectedYear = paymentForm.PaymentDate.Year;

                RefreshData();
            }

            paymentForm.Dispose();
        }
Example #21
0
 public PaymentSystem(IPaymentType paymentType)
 {
     this._paymentType = paymentType;
 }
Example #22
0
        /// <summary>
        /// Determines whether [is payment type conditions] [the specified payment type].
        /// </summary>
        /// <param name="paymentType">Type of the payment.</param>
        /// <param name="claim">The claim.</param>
        /// <returns></returns>
        public bool IsPaymentTypeConditions(IPaymentType paymentType, IEvaluateableClaim claim)
        {
            if (paymentType != null)
            {
                paymentType.ValidLineIds = new List <int>();
                //Fill LHS into Contract's Condition objects
                foreach (ICondition condition in paymentType.Conditions)
                {
                    _conditionLogic.Condition = condition;
                    condition.LeftOperands    =
                        _conditionLogic.GetPropertyValues(claim, _conditionLogic.Condition.PropertyColumnName);
                }

                if (claim != null)
                {
                    //Match claim charge line codes with Payment Type Conditions
                    foreach (ClaimCharge claimCharge in claim.ClaimCharges)
                    {
                        //If condition is not there than its valid. That's why we are initialization by default as true.
                        //For Ex - Payment type don't have any rev code or cpt code than all the lines are valid in this case isMatch should be true
                        bool isMatch      = true;
                        bool isClaimLevel = true;
                        //Based on condition Operand Identifier fill LHS operand with charge line codes
                        foreach (ICondition condition in paymentType.Conditions)
                        {
                            if (condition.OperandIdentifier != null)
                            {
                                switch ((Enums.OperandIdentifier)condition.OperandIdentifier)
                                {
                                case Enums.OperandIdentifier.RevCode:
                                    condition.LeftOperands = new List <string> {
                                        claimCharge.RevCode
                                    };
                                    isClaimLevel = false;
                                    break;

                                case Enums.OperandIdentifier.HcpcsCode:
                                    condition.LeftOperands = new List <string> {
                                        claimCharge.HcpcsCodeWithModifier
                                    };
                                    isClaimLevel = false;
                                    break;

                                case Enums.OperandIdentifier.PlaceOfService:
                                    condition.LeftOperands = new List <string> {
                                        claimCharge.PlaceOfService
                                    };
                                    isClaimLevel = false;
                                    break;
                                }
                            }
                            _conditionLogic.Condition = condition;
                            isMatch = _conditionLogic.IsMatch();

                            if (!isMatch)
                            {
                                break;
                            }
                        }
                        paymentType.PayAtClaimLevel = isClaimLevel;
                        //If Claim charge line codes matches with Payment Type Conditions then build valid charge line list
                        if (isMatch)
                        {
                            paymentType.ValidLineIds.Add(claimCharge.Line);
                        }
                    }
                }

                return(paymentType.ValidLineIds.Any());
            }
            return(false);
        }
Example #23
0
        public string pay(string type)
        {
            IPaymentType paymentType = SimpleFactory.CreatePaymentType(type);

            return(paymentType.pay());
        }
Example #24
0
 public void Accept(IPaymentType paymentType)
 {
     paymentType.VisitFoodService(this);
 }
 public PaymentTypeController()
 {
     _repository = new PaymentTypeRepository(new ripoffnigeria.Repository.Entities.RipOffContext());
 }
Example #26
0
 public static PaymentJsonModel ToJson(this IPaymentType payment)
 => payment.Accept(new PaymentTypeToJsonVisitor());
Example #27
0
        public PaymentRequest <TPaymentMethod> BuildReferencedPaymentRequest <TPaymentMethod>(
            IPaymentType paymentType,
            int orderNumber,
            string orderReferenceId,
            decimal orderTotal)
            where TPaymentMethod : PaymentMethod
        {
            UniqueIdentifier instanceId      = LoadAppConfigString("Moneybookers.SenderID", s => new UniqueIdentifier(s));
            TransactionMode  transactionMode = TransactionMode;
            ResponseMode     responseMode    = ResponseMode.Sync;
            UniqueIdentifier channelId       = LoadAppConfigString("Moneybookers.ChannelID", s => new UniqueIdentifier(s));
            UniqueIdentifier userLogin       = LoadAppConfigString("Moneybookers.UserLogin", s => new UniqueIdentifier(s));
            UserPassword     userPassword    = LoadAppConfigString("Moneybookers.UserPassword", s => new UserPassword(s));
            LimitedString    invoiceId       = new LimitedString(orderNumber.ToString());

            UniqueIdentifier referenceId = null;

            if (orderReferenceId != null)
            {
                referenceId = new UniqueIdentifier(orderReferenceId);
            }

            Amount        paymentAmount   = new Amount(orderTotal);
            Currency      paymentCurrency = LoadAppConfigString("Localization.StoreCurrency", s => new Currency(s));
            LimitedString paymentUsage    = new LimitedString(String.Format("Order number {0}", orderNumber));

            PaymentMethod referencedPaymentMethod = PaymentMethod.GetReferencedPaymentMethod <TPaymentMethod>();
            PaymentCode   paymentCode             = new PaymentCode(referencedPaymentMethod, paymentType);

            PaymentRequest <TPaymentMethod> paymentRequest = new PaymentRequest <TPaymentMethod>(
                instanceId,
                transactionMode,
                responseMode,
                channelId,
                userLogin,
                userPassword,
                null,
                invoiceId,
                null,
                referenceId,
                paymentCode,
                paymentAmount,
                paymentCurrency,
                paymentUsage,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                new LimitedString(AppLogic.GetStoreHTTPLocation(true) + "moneybookers3DSecureCallback.aspx"),
                null);

            return(paymentRequest);
        }