internal static Purchase FindOrAddPurchase(ServiceContext context, PaymentTypeEnum paymentType) { Purchase typeOfPurchase = null; List <Purchase> listOfPurchase = FindAll <Purchase>(context, new Purchase(), 1, 10).Where(p => p.status != EntityStatusEnum.SyncError).ToList(); if (listOfPurchase.Count > 0) { if (context.ServiceType == IntuitServicesType.QBO) { foreach (Purchase payment in listOfPurchase) { if (payment.PaymentType == paymentType) { typeOfPurchase = payment; break; } } if (typeOfPurchase == null) { //create a new purchase account DataService service = new DataService(context); Purchase purchase; purchase = QBOHelper.CreatePurchase(context, PaymentTypeEnum.Cash); Purchase createdPurchase = service.Add <Purchase>(purchase); typeOfPurchase = createdPurchase; } } } return(typeOfPurchase); }
public void TakePayment(PaymentTypeEnum paymentType, double amountDue, List <KeyValuePair <Product, int> > shoppingCart) //Take payment from user { if (paymentType == PaymentTypeEnum.Cash) { var amountRemainingToPay = TakePaymentCash(amountDue, GetTotalSalesTax(GetSubtotal(shoppingCart)), first); first = false; while (amountRemainingToPay < 0.00) { paymentType = Menu.AskForPaymentMethodMenu(); //ask user for how they would like to pay amountRemainingToPay = Math.Round(Math.Abs(amountRemainingToPay), 2, MidpointRounding.AwayFromZero); //return formatted absolute value of amount remaining to pay TakePayment(paymentType, amountRemainingToPay, shoppingCart); } //add call to receipt display method here } else if (paymentType == PaymentTypeEnum.Check) { TakePaymentCheck(amountDue, GetTotalSalesTax(GetSubtotal(shoppingCart))); //Menu.DisplayOrderSummary(shoppingCart, register); //confirmation } else if (paymentType == PaymentTypeEnum.Credit_Card) { TakePaymentCreditCard(amountDue, GetTotalSalesTax(GetSubtotal(shoppingCart))); //confirmation } else { } }
public static IPayment GetPayment(PaymentTypeEnum paymentType) { IPayment payment = null; switch (paymentType) { case PaymentTypeEnum.Physical: payment = new Physical(); break; case PaymentTypeEnum.Book: payment = new Book(); break; case PaymentTypeEnum.Membership: payment = new Membership(); break; case PaymentTypeEnum.Upgrade: payment = new Upgrade(); break; case PaymentTypeEnum.LearningToSki: payment = new LearningToSki(); break; } return(payment); }
private PaymentTypeFactory GenerateType(PaymentTypeEnum typeofPayment) { PaymentTypeFactory paymentFactory; switch (typeofPayment) { case PaymentTypeEnum.PhysicalProduct: paymentFactory = new PaymentTypePhysicalProductFactory(); break; case PaymentTypeEnum.Book: paymentFactory = new PaymentTypeBookFactory(); break; case PaymentTypeEnum.MemberShip: paymentFactory = new PaymentTypeMemberShipFactory(); break; case PaymentTypeEnum.Upgrade: paymentFactory = new PaymentTypeUpgradeFactory(); break; case PaymentTypeEnum.LearningToSki: paymentFactory = new PaymentTypeLearningToSkiFactory(); break; default: return(null); } return(paymentFactory); }
public PaymentOption(int id, int customerId, PaymentTypeEnum paymentType, string paypalEmail, PaymentOptionStatusEnum status) { Id = id; CustomerId = customerId; PaymentType = paymentType; PaypalEmail = paypalEmail; Status = status; }
/// <summary> /// Initializes a new instance of the <see cref="Payment" /> class. /// </summary> /// <param name="paymentType">Defines the type of the payment. (required).</param> /// <param name="method">method (required).</param> /// <param name="pinPresent">Indicates if the cards Personal Identification Number was supplied. (required).</param> /// <param name="entryMethod">The method in which the card information entered the system. (required).</param> /// <param name="issuerResponse">issuerResponse.</param> /// <param name="issuerApprovedAmount">The actual approved amount. This field should be filled in when the message has already passed through the issuer (e.g. post-authorization). For transaction/authorization this amount refers to the amount that was locked on the card-holders account..</param> /// <param name="issuerCardBalance">The payment methods account balance if available. This field should be filled in when the message has already passed through the issuer (e.g. post-authorization)..</param> /// <param name="verificationAvs">verificationAvs.</param> /// <param name="verification3ds">verification3ds.</param> /// <param name="verificationCvv">verificationCvv.</param> /// <param name="userDefined">A JSON object that carries any additional information that might be helpful for fraud detection..</param> public Payment(PaymentTypeEnum paymentType = default(PaymentTypeEnum), Method method = default(Method), bool pinPresent = default(bool), EntryMethodEnum entryMethod = default(EntryMethodEnum), IssuerResponse issuerResponse = default(IssuerResponse), string issuerApprovedAmount = default(string), string issuerCardBalance = default(string), VerificationAvs verificationAvs = default(VerificationAvs), Verification3ds verification3ds = default(Verification3ds), VerificationCvv verificationCvv = default(VerificationCvv), Object userDefined = default(Object)) { this.PaymentType = paymentType; // to ensure "method" is required (not null) this.Method = method ?? throw new ArgumentNullException("method is a required property for Payment and cannot be null"); this.PinPresent = pinPresent; this.EntryMethod = entryMethod; this.IssuerResponse = issuerResponse; this.IssuerApprovedAmount = issuerApprovedAmount; this.IssuerCardBalance = issuerCardBalance; this.VerificationAvs = verificationAvs; this.Verification3ds = verification3ds; this.VerificationCvv = verificationCvv; this.UserDefined = userDefined; }
public Expense(string expensesXFilePath, string expensesZFilePath, string expensesHistoryFilePath, int id, string user, string vendor, string description, decimal amount, CurrencyTypeEnum currencyType, PaymentTypeEnum paymentType, string expenseCategory = "General") : base(expensesXFilePath) { Id = id; ExpensesXFilePath = expensesXFilePath; ExpensesZFilePath = expensesZFilePath; ExpensesHistoryFilePath = expensesHistoryFilePath; User = user; Vendor = vendor; Description = description; Amount = amount; CurrencyType = currencyType; PaymentType = paymentType; ExpenseCategory = expenseCategory; }
public AmountResumeDTO GetAmountResumeByContract(int idContract, PaymentTypeEnum type) { var payments = UnitOfWork.GetRepository <Payment>().GetAll().Where(s => s.IdContract == idContract && s.Type == type).ToList(); var contract = UnitOfWork.GetRepository <Contracts>().GetAll().FirstOrDefault(s => s.Id == idContract); var amountResume = new AmountResumeDTO(0, 0); foreach (Payment payment in payments) { amountResume.TotalPayment += payment.Amount; } amountResume.TotalRestremaining = contract.Amount - amountResume.TotalPayment; return(amountResume); }
/// <summary> /// Converts a PaymentTypeEnum value to a corresponding string value /// </summary> /// <param name="enumValue">The PaymentTypeEnum value to convert</param> /// <returns>The representative string value</returns> public static string ToValue(PaymentTypeEnum enumValue) { switch (enumValue) { //only valid enum elements can be used //this is necessary to avoid errors case PaymentTypeEnum.DIRECT_DEBIT: case PaymentTypeEnum.STANDING_ORDER: case PaymentTypeEnum.INTERNAL_TRANSFER: return(StringValues[(int)enumValue]); //an invalid enum value was requested default: return(null); } }
public PayOrderBag CreatePayOrder(string payerId, string receiverId, double chargeNum, PayOrderTypeEnum payOrderType, PaymentTypeEnum paymentType) { var payer = FindAccount(payerId); var receiver = FindAccount(receiverId); if (payer == null) { throw new Exception("付款方不存在!payerId=>" + payerId); } if (receiver == null) { throw new Exception("收款方不存在!receiverId=>" + receiverId); } return(CreatePayOrder(payer, receiver, chargeNum, payOrderType, paymentType)); }
public async Task <OrderEntity> AddPayment(string chatId, PaymentTypeEnum paymentType, string amount, int planId) { var order = new OrderEntity { ChatId = chatId, Status = PayemtnStatusEnum.NotStarted, Amount = amount, Type = paymentType, PlanId = planId, }; _context.Orders.Add(order); await _context.SaveChangesAsync(); return(order); }
public ActionResult GetAmountResumeByContract(int idContract, PaymentTypeEnum type) { try { var result = IPaymentService.GetAmountResumeByContract(idContract, type); string microsoftJson = JsonConvert.SerializeObject(result, Formatting.None, new JsonSerializerSettings() { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }); return(new ContentResult { Content = microsoftJson, ContentType = "application/json" }); } catch (Exception) { return(Json(false, JsonRequestBehavior.AllowGet)); } }
private static double CalculateCore(this double currentMoney, PaymentTypeEnum type, double value) { switch (type) { case PaymentTypeEnum.Advance: case PaymentTypeEnum.Forfeit: currentMoney -= value; break; case PaymentTypeEnum.Beneficiary: case PaymentTypeEnum.Gift: case PaymentTypeEnum.FixedSalary: currentMoney += value; break; } return(currentMoney); }
public PayOrderBag(pay_order payOrder, AccountBag payer, AccountBag receiver, PayOrderTypeEnum payOrderType, PaymentTypeEnum paymentType, int payNum) { Payer = payer; Receiver = receiver; PayOrder = payOrder; //payer.Expense(payNum); //receiver.Charge(payNum); //PayOrder = new pay_order //{ // PO_ID = PO_ID, // PayerAccID = payer.Account.AccountID, // ReceiverAccID = receiver.Account.AccountID, // CreateTime = DateTime.Now, // PayNum = payNum, // PayOrderTypeID = payOrderType.ToString(), // PaymentTypeID = paymentType.ToString(), // PayStateID = PayStateEnum.Created.ToString() //}; }
/// <summary> /// Converts a PaymentTypeEnum value to a corresponding string value /// </summary> /// <param name="enumValue">The PaymentTypeEnum value to convert</param> /// <returns>The representative string value</returns> public static string ToValue(PaymentTypeEnum enumValue) { switch (enumValue) { //only valid enum elements can be used //this is necessary to avoid errors case PaymentTypeEnum.CREDIT_CARD: case PaymentTypeEnum.DEBIT_CARD: case PaymentTypeEnum.BANK_TRANSFER: case PaymentTypeEnum.CASH: case PaymentTypeEnum.DIGITAL_WALLET: case PaymentTypeEnum.MOBILE_PAYMENT: case PaymentTypeEnum.GIFT_CARD: case PaymentTypeEnum.MILE_PAYMENT: case PaymentTypeEnum.OTHER: return(stringValues[(int)enumValue]); //an invalid enum value was requested default: return(null); } }
internal static Purchase FindOrAddPurchase(ServiceContext context, PaymentTypeEnum paymentType) { Purchase typeOfPurchase = null; List <Purchase> listOfPurchase = FindAll <Purchase>(context, new Purchase(), 1, 10).Where(p => p.status != EntityStatusEnum.SyncError).ToList(); if (listOfPurchase.Count > 0) { if (context.ServiceType == IntuitServicesType.QBO) { foreach (Purchase payment in listOfPurchase) { if (payment.PaymentType == paymentType) { typeOfPurchase = payment; break; } } } } return(typeOfPurchase); }
public PayOrderBag(AccountBag payer, AccountBag receiver, PayOrderTypeEnum payOrderType, PaymentTypeEnum paymentType, double payNum) { //取2位有效数字 var money = (int)(payNum * 100); Payer = payer; Receiver = receiver; //payer.Expense(payNum); //receiver.Charge(payNum); PayOrder = new pay_order { PO_ID = //DateTime.Now.FormatTime(false)+"-"+ DateTime.Now.Random(), PayerAccID = payer.Account.AccountID, ReceiverAccID = receiver.Account.AccountID, CreateTime = DateTime.Now, PayNum = money, PayOrderTypeID = payOrderType.ToString(), PaymentTypeID = paymentType.ToString(), PayStateID = PayStateEnum.Created.ToString() }; }
public PayOrderBag CreatePayOrder(AccountBag payer, AccountBag receiver, double payNum, PayOrderTypeEnum payOrderType, PaymentTypeEnum paymentType) { return(new PayOrderBag(payer, receiver, payOrderType, paymentType, payNum)); }
/// <summary> /// Initializes a new instance of the <see cref="InlineResponse20068Card" /> class. /// </summary> /// <param name="bin">bin (required).</param> /// <param name="cannotDisableReason">cannotDisableReason (required).</param> /// <param name="credit">credit (required).</param> /// <param name="disablePermitted">disablePermitted (required).</param> /// <param name="expiry">expiry (required).</param> /// <param name="issuer">issuer (required).</param> /// <param name="lastFour">lastFour (required).</param> /// <param name="lastUsed">lastUsed (required).</param> /// <param name="maxWithdrawal">maxWithdrawal (required).</param> /// <param name="methodId">methodId (required).</param> /// <param name="minWithdrawal">minWithdrawal (required).</param> /// <param name="paymentType">paymentType (required).</param> /// <param name="withdrawalBalance">withdrawalBalance (required).</param> public InlineResponse20068Card(string bin = default(string), CannotDisableReasonEnum cannotDisableReason = default(CannotDisableReasonEnum), bool?credit = default(bool?), bool?disablePermitted = default(bool?), DateTime?expiry = default(DateTime?), string issuer = default(string), string lastFour = default(string), bool?lastUsed = default(bool?), OneOfinlineResponse20068CardMaxWithdrawal maxWithdrawal = default(OneOfinlineResponse20068CardMaxWithdrawal), string methodId = default(string), OneOfinlineResponse20068CardMinWithdrawal minWithdrawal = default(OneOfinlineResponse20068CardMinWithdrawal), PaymentTypeEnum paymentType = default(PaymentTypeEnum), string withdrawalBalance = default(string)) { // to ensure "bin" is required (not null) if (bin == null) { throw new InvalidDataException("bin is a required property for InlineResponse20068Card and cannot be null"); } else { this.Bin = bin; } // to ensure "cannotDisableReason" is required (not null) if (cannotDisableReason == null) { throw new InvalidDataException("cannotDisableReason is a required property for InlineResponse20068Card and cannot be null"); } else { this.CannotDisableReason = cannotDisableReason; } // to ensure "credit" is required (not null) if (credit == null) { throw new InvalidDataException("credit is a required property for InlineResponse20068Card and cannot be null"); } else { this.Credit = credit; } // to ensure "disablePermitted" is required (not null) if (disablePermitted == null) { throw new InvalidDataException("disablePermitted is a required property for InlineResponse20068Card and cannot be null"); } else { this.DisablePermitted = disablePermitted; } // to ensure "expiry" is required (not null) if (expiry == null) { throw new InvalidDataException("expiry is a required property for InlineResponse20068Card and cannot be null"); } else { this.Expiry = expiry; } // to ensure "issuer" is required (not null) if (issuer == null) { throw new InvalidDataException("issuer is a required property for InlineResponse20068Card and cannot be null"); } else { this.Issuer = issuer; } // to ensure "lastFour" is required (not null) if (lastFour == null) { throw new InvalidDataException("lastFour is a required property for InlineResponse20068Card and cannot be null"); } else { this.LastFour = lastFour; } // to ensure "lastUsed" is required (not null) if (lastUsed == null) { throw new InvalidDataException("lastUsed is a required property for InlineResponse20068Card and cannot be null"); } else { this.LastUsed = lastUsed; } // to ensure "maxWithdrawal" is required (not null) if (maxWithdrawal == null) { throw new InvalidDataException("maxWithdrawal is a required property for InlineResponse20068Card and cannot be null"); } else { this.MaxWithdrawal = maxWithdrawal; } // to ensure "methodId" is required (not null) if (methodId == null) { throw new InvalidDataException("methodId is a required property for InlineResponse20068Card and cannot be null"); } else { this.MethodId = methodId; } // to ensure "minWithdrawal" is required (not null) if (minWithdrawal == null) { throw new InvalidDataException("minWithdrawal is a required property for InlineResponse20068Card and cannot be null"); } else { this.MinWithdrawal = minWithdrawal; } // to ensure "paymentType" is required (not null) if (paymentType == null) { throw new InvalidDataException("paymentType is a required property for InlineResponse20068Card and cannot be null"); } else { this.PaymentType = paymentType; } // to ensure "withdrawalBalance" is required (not null) if (withdrawalBalance == null) { throw new InvalidDataException("withdrawalBalance is a required property for InlineResponse20068Card and cannot be null"); } else { this.WithdrawalBalance = withdrawalBalance; } }
public ServiceResult SendPayment(decimal amount, string nonce, bool isTaxExempt, PaymentTypeEnum paymentType, string deviceData, string transactionDescription = "", string customerNotes = "", string firstName = "", string lastName = "", string addressStreet1 = "", string addressStreet2 = "", string addressCity = "", string addressStateId = "", string addressPostalCode = "", string countryCode = "US", string phoneNumber = "", string email = "", string company = "", string website = "", bool isShipping = false) { var serviceResult = new ServiceResult(); try { Gateway = GetGateway(); var braintreeRequest = new TransactionRequest { Amount = amount, PaymentMethodNonce = nonce, TaxExempt = isTaxExempt, Type = TransactionType.SALE, DeviceData = deviceData, Options = new TransactionOptionsRequest { StoreInVaultOnSuccess = true, StoreShippingAddressInVault = isShipping, SubmitForSettlement = true }, Customer = new CustomerRequest { FirstName = firstName, LastName = lastName, Email = !string.IsNullOrEmpty(email) ? email : string.Empty, Website = !string.IsNullOrEmpty(website) ? website : string.Empty, Phone = !string.IsNullOrEmpty(phoneNumber) ? phoneNumber : string.Empty, Company = !string.IsNullOrEmpty(company) ? company : string.Empty, } }; if (!string.IsNullOrEmpty(transactionDescription)) { braintreeRequest.CustomFields.Add("transaction_desc", transactionDescription); } if (!string.IsNullOrEmpty(customerNotes)) { braintreeRequest.CustomFields.Add("customer_comments", customerNotes.Length > 255 ? customerNotes.Substring(0, 254) : customerNotes); } if (paymentType == PaymentTypeEnum.CreditCard) { braintreeRequest.Options.AddBillingAddressToPaymentMethod = true; braintreeRequest.BillingAddress = new AddressRequest { Company = !string.IsNullOrEmpty(company) ? company : string.Empty, CountryCodeAlpha2 = countryCode, FirstName = firstName, LastName = lastName, PostalCode = addressPostalCode, StreetAddress = addressStreet1, ExtendedAddress = addressStreet2, Locality = addressCity, Region = addressStateId }; } if (paymentType == PaymentTypeEnum.Paypal) { braintreeRequest.Options.PayPal = new TransactionOptionsPayPalRequest { //CustomField = "PayPal custom field", Description = string.IsNullOrEmpty(transactionDescription) ? "TXHR Payment" : transactionDescription }; } var result = Gateway.Transaction.Sale(braintreeRequest); // check if success if (result.IsSuccess()) { serviceResult.IsSuccess = true; serviceResult.NewKey = result.Target.Id; var transTarget = result.Target; if (transTarget.PaymentInstrumentType == PaymentInstrumentType.CREDIT_CARD) {//// } if (transTarget.PaymentInstrumentType == PaymentInstrumentType.PAYPAL_ACCOUNT) { } } else { serviceResult.IsSuccess = false; serviceResult.Messages = new List <string>(1) { result.Message }; if (result.Transaction != null) { if (result.Transaction.Status == TransactionStatus.SETTLEMENT_DECLINED) { } if (result.Transaction.Status == TransactionStatus.FAILED) { } if (result.Transaction.Status == TransactionStatus.GATEWAY_REJECTED) { } if (result.Transaction.Status == TransactionStatus.PROCESSOR_DECLINED) { // https://developers.braintreepayments.com/javascript+dotnet/reference/general/processor-responses/authorization-responses // 1000 >= code < 2000 Success // 2000 >= code < 3000 Decline // 3000 >= code Failure } if (result.Transaction.Status == TransactionStatus.UNRECOGNIZED) { } if (result.Errors.DeepCount > 0) { _logger.LogInformation("Braintree validation errors: {Message} -- {@BraintreeValidationErrors}", result.Message, result.Errors.DeepAll()); } else { _logger.LogInformation("Braintree transaction failure: {@BraintreeResult}", result); } } } } catch (AuthenticationException authenticationException) { // API keys are incorrect // TODO send email to admin _logger.LogError(new EventId(3), authenticationException, "Braintree authentication error"); throw; } catch (AuthorizationException authorizationException) { // not authorized to perform the attempted action according to the roles assigned to the user who owns the API key // TODO send email to admin // _logger.Error(authorizationException, "Braintree authorization error"); throw; } catch (ServerException serverException) { // something went wrong on the braintree server // user should try again _logger.LogError(new EventId(3), serverException, "Braintree server error"); throw; } catch (UpgradeRequiredException upgradeRequiredException) { // TODO send email to admin _logger.LogError(new EventId(3), upgradeRequiredException, "Braintree upgrade required error"); throw; } catch (BraintreeException braintreeException) { // user should try again _logger.LogError(new EventId(3), braintreeException, "Braintree general error"); throw; } return(serviceResult); }
public PaymentTypeEf(PaymentTypeEnum @enum) { Id = (int)@enum; Name = @enum.GetDescription(); }
/// <summary> /// Initializes a new instance of the <see cref="Refund" /> class. /// </summary> /// <param name="Id">The unique, Afterpay-generated event ID.</param> /// <param name="Created">A UTC timestamp of the event creation time, in ISO 8601 format.</param> /// <param name="Expires">A UTC timestamp of the event expire time, in ISO 8601 format.</param> /// <param name="Type">The event type.</param> /// <param name="Amount">The amount associated with the event.</param> /// <param name="PaymentEventMerchantReference">A unique reference for an individual payment capture event. If provided on Capture Payment, the value will appear in the daily settlement file as "Payment Event ID".</param> public PaymentEvent(string Id = default(string), string Created = default(string), string Expires = default(string), PaymentTypeEnum Type = default(PaymentTypeEnum), Money Amount = default(Money), string PaymentEventMerchantReference = default(string)) { this.Id = Id; this.Created = Created; this.Expires = Expires; this.Amount = Amount; this.PaymentEventMerchantReference = PaymentEventMerchantReference; }
/// <summary> /// Get settlement ActionCode from PaymentTypeEnum /// </summary> /// <param name="paymentTypeEnum">PaymentTypeEnum</param> /// <returns>Settlement ActionCode </returns> private string GetSettlementActionCode(PaymentTypeEnum paymentTypeEnum) { switch (paymentTypeEnum) { case PaymentTypeEnum.Payment: return SETTLEMENT_ACTION_CODE_PAYMENT; case PaymentTypeEnum.Refund: return SETTLEMENT_ACTION_CODE_REFUND; default: return string.Empty; } }
public async Task <Transaction> MakePayment(Transaction transaction, PaymentTypeEnum paymentType, IEnumerable <Cart> cartItems) { // Always sets the payment success to false to make sure there are no false approvals PaymentStatus = PaymentStatusEnum.None; BeginCounter(); transaction.CartItems = cartItems; if (paymentType == PaymentTypeEnum.Park) { PaymentStatus = PaymentStatusEnum.Success; return(await SaveTransaction(transaction, PaymentStatus)); } if (paymentType == PaymentTypeEnum.AR) { transaction.Customer.ARBalance -= transaction.Total; _context.Customers.Update(transaction.Customer); await _context.SaveChangesAsync(); return(await SaveTransaction(transaction, PaymentStatus)); } if (transaction.AmountPaid > transaction.Total) { switch (paymentType) { case PaymentTypeEnum.Cash: transaction.AmountOwed = Math.Abs(transaction.AmountPaid - transaction.Total); PaymentStatus = PaymentStatusEnum.Success; return(await SaveTransaction(transaction, PaymentStatus)); case PaymentTypeEnum.Credit: PaymentStatus = await ProcessDebitCredit(); return(await SaveTransaction(transaction, PaymentStatus)); case PaymentTypeEnum.Debit: PaymentStatus = await ProcessDebitCredit(); return(await SaveTransaction(transaction, PaymentStatus)); case PaymentTypeEnum.Cheque: return(transaction); default: // If we hit here there was an error, time out payment return(transaction); } } else if (transaction.AmountPaid == transaction.Total) { switch (paymentType) { case PaymentTypeEnum.Cash: PaymentStatus = PaymentStatusEnum.Success; return(await SaveTransaction(transaction, PaymentStatus)); case PaymentTypeEnum.Credit: PaymentStatus = await ProcessDebitCredit(); return(await SaveTransaction(transaction, PaymentStatus)); case PaymentTypeEnum.Debit: PaymentStatus = await ProcessDebitCredit(); return(await SaveTransaction(transaction, PaymentStatus)); case PaymentTypeEnum.Cheque: return(transaction); default: // If we hit here there was an error, time out payment return(transaction); } } else if (transaction.AmountPaid < transaction.Total) { switch (paymentType) { case PaymentTypeEnum.Cash: return(transaction); case PaymentTypeEnum.Credit: PaymentStatus = await ProcessDebitCredit(); return(await SaveTransaction(transaction, PaymentStatus)); case PaymentTypeEnum.Debit: PaymentStatus = await ProcessDebitCredit(); return(await SaveTransaction(transaction, PaymentStatus)); case PaymentTypeEnum.Cheque: return(transaction); default: // If we hit here there was an error, time out payment return(transaction); } } else { return(transaction); } }
public List <Payment> GetAllPaymentContract(int idContract, PaymentTypeEnum type) { var paymentList = UnitOfWork.GetRepository <Payment>().GetAll().Where(s => s.Type == type && s.IdContract == idContract && s.isDelete == false).ToList(); return(paymentList); }
/// <summary> /// This method contains the base service logic needed to make a payment /// </summary> /// <param name="paymentDto">Payment Dto</param> /// <param name="paymentStatus">Payment Status</param> /// <param name="paymentType">Payment Type</param> private Payment CreatePayment(PaymentDto paymentDto, PaymentStatusEnum paymentStatus, PaymentTypeEnum paymentType, long businessId) { Payment payment; //make sure payment object is valid if (paymentDto == null) { throw new ValidationException(ErrorFactory.CreateAndLogError(Errors.SRVEX30072, "PropertyManagementSystemService.CreatePayment")); } // Convert to Model try { payment = Mapper.Map<Payment>(paymentDto); } catch (InvalidEnumArgumentException ex) { throw new ValidationException(ErrorFactory.CreateAndLogError(Errors.SRVEX30083, "PropertyManagementSystemService.CreatePayment", additionalDescriptionParameters: (new object[] { ex.Message }))); } payment.PaymentStatusEnum = paymentStatus; payment.PaymentTypeEnum = paymentType; //Create the payment paymentManager.CreatePaymentForOrder(payment, businessId); return paymentManager.GetPaymentByKey(payment.Id); }
/// <summary> /// Initializes a new instance of the <see cref="CodiCodeRequestDTO" /> class. /// </summary> /// <param name="amount">Monto del pago CODI®.</param> /// <param name="beneficiary2">beneficiary2.</param> /// <param name="concept">Descripción del pago CODI® (required).</param> /// <param name="dueDate">Fecha de operación pago CODI®, formato: yyyy-MM-dd'T'HH:mm:ss (required).</param> /// <param name="metadata">Campo de metada CODI®, longitud máxima determinada por configuracion de la empresa, por defecto 100 caracteres.</param> /// <param name="orderId">Referencia de la transferencia asignada por el cliente (required).</param> /// <param name="paymentType">El tipo de pago ya sea en una ocasión (ONE_OCCASION) o recurrente (RECURRENT) (required).</param> /// <param name="phoneNumber">Número de teléfono móvil en caso de ser un pago CODI® usando 'PUSH_NOTIFICATION' estecampo sería obligatorio.</param> /// <param name="reference">Referencia numérica del pago CODI®. Debe ser de 7 dígitos (required).</param> /// <param name="type">El tipo de solicitud QR o PUSH para pago con CODI® (required).</param> public CodiCodeRequestDTO(decimal?amount = default(decimal?), BeneficiaryDTO beneficiary2 = default(BeneficiaryDTO), string concept = default(string), DateTime?dueDate = default(DateTime?), string metadata = default(string), string orderId = default(string), PaymentTypeEnum paymentType = default(PaymentTypeEnum), string phoneNumber = default(string), int?reference = default(int?), TypeEnum type = default(TypeEnum)) { // to ensure "concept" is required (not null) if (concept == null) { throw new InvalidDataException("concept is a required property for CodiCodeRequestDTO and cannot be null"); } else { this.Concept = concept; } // to ensure "dueDate" is required (not null) if (dueDate == null) { throw new InvalidDataException("dueDate is a required property for CodiCodeRequestDTO and cannot be null"); } else { this.DueDate = dueDate; } // to ensure "orderId" is required (not null) if (orderId == null) { throw new InvalidDataException("orderId is a required property for CodiCodeRequestDTO and cannot be null"); } else { this.OrderId = orderId; } // to ensure "paymentType" is required (not null) if (paymentType == null) { throw new InvalidDataException("paymentType is a required property for CodiCodeRequestDTO and cannot be null"); } else { this.PaymentType = paymentType; } // to ensure "reference" is required (not null) if (reference == null) { throw new InvalidDataException("reference is a required property for CodiCodeRequestDTO and cannot be null"); } else { this.Reference = reference; } // to ensure "type" is required (not null) if (type == null) { throw new InvalidDataException("type is a required property for CodiCodeRequestDTO and cannot be null"); } else { this.Type = type; } this.Amount = amount; this.Beneficiary2 = beneficiary2; this.Metadata = metadata; this.PhoneNumber = phoneNumber; }
/// <summary> /// Get booking payment by PaymentType and payment source /// </summary> /// <param name="payments">Collection of Payment</param> /// <param name="paymentType">PaymentTypeEnum</param> /// <param name="paymentSource">payment source type</param> /// <returns>Payment</returns> public virtual Payment GetPaymentByTypeAndSource(IEnumerable<Payment> payments, PaymentTypeEnum paymentType, PaymentSourceEnum paymentSource) { Helper.ArgumentNotNull(payments, "payments"); var payment = payments.ToList().Find(p => p.PaymentTypeEnum == paymentType && p.PaymentSourceEnum == paymentSource); return payment ?? new Payment(); }