public void SetReceiptState(ResponseReceiptStates state, AccountSession accountSession, double?value = null) { // push a new receipt onto the list this.Receipts.Add(new ResponseReceipt() { State = state, On = DateTimeHelper.Now, By = accountSession.MemberId, Value = QuoteHelper.NormalizeValue(value) }); // set the current state this.State = state; if (state == ResponseReceiptStates.Pending) { // initialize the quote details based on the value submitted by the provider this.Quote = QuoteHelper.NormalizeValue(value); this.DepositDue = QuoteHelper.ComputeDepositeDue(value); this.DepositPaid = 0; this.BalanceDue = QuoteHelper.ComputeBalanceDue(value); this.BalancePaid = 0; } if (state == ResponseReceiptStates.Accepted) { // update the deposit paid based on the value paid by the consumer this.DepositDue = 0; this.DepositPaid = QuoteHelper.NormalizeValue(value); this.BalanceDue = QuoteHelper.ComputeBalanceDue(this.Quote, value); this.BalancePaid = 0; } }
public Payment CreatePaymentTransaction(Braintree.Transaction transaction) { var payment = new Payment() { CardholderName = transaction.CreditCard.CardholderName, CardLastFour = transaction.CreditCard.LastFour, CardType = Convert.ToString(transaction.CreditCard.CardType), ExpirationMonth = transaction.CreditCard.ExpirationMonth, ExpirationYear = transaction.CreditCard.ExpirationYear, PostalCode = transaction.CreditCard.BillingAddress.PostalCode, Amount = Convert.ToDouble(QuoteHelper.NormalizeValue(transaction.Amount)), TransactionId = transaction.Id, MerchantAccountId = transaction.MerchantAccountId, ProcessorAuthorizationCode = transaction.ProcessorAuthorizationCode }; return(payment); }