public void SetPaymentInfo(ElectronicPaymentManifest pm) { switch (pm.OrderPaymentMethod) { case OrderPaymentMethod.CreditCard: rbNewCard.Checked = true; CreditCard cc = pm as CreditCard; if (cc == null) { throw new ApplicationException("Payment method is credit card, but no card provided"); } tbCardNumber.Text = cc.CardNumber; tbCCV.Text = cc.CCVCode; tbNameOnCard.Text = cc.NameOnCard; myExpiration.Date = cc.CardExpirationDate; cbSaveCreditCard.Checked = cc.SavePaymentMethod; break; case OrderPaymentMethod.ElectronicCheck: rbNewChecking.Checked = true; ElectronicCheck ec = pm as ElectronicCheck; if (ec == null) { throw new ApplicationException("Payment method is electronic check, but no check provided"); } tbBankAccountNumber.Text = tbBankAccountNumberConfirm.Text = ec.BankAccountNumber; tbRoutingNumber.Text = ec.RoutingNumber; cbSaveCheckingAccount.Checked = ec.SavePaymentMethod; break; case OrderPaymentMethod.PayrollDeduction: rbPayrollDeduction.Checked = true; break; case OrderPaymentMethod.PurchaseOrder: rbBillMeLater.Checked = true; NonElectronicPayment nep = pm as NonElectronicPayment; if (nep == null) { throw new ApplicationException("Non electronic payment packet expected."); } tbReferenceNumber.Text = nep.ReferenceNumber; break; case OrderPaymentMethod.SavedPaymentMethod: SavedPaymentInfo spi = pm as SavedPaymentInfo; if (spi == null) { throw new ApplicationException("Payment method is saved info, but no info provided"); } currentSavedPaymentMethodID = spi.SavedPaymentMethodID; break; } }
protected void processPayment(ElectronicPaymentManifest payment) { decimal sumOfItems = targetPayment.LineItems.Sum(x => x.Total); decimal overpayment = targetPayment.Total - sumOfItems; // add the overpayment if (overpayment > 0) { // not allow throw new ConciergeClientException(MemberSuite.SDK.Concierge.ConciergeErrorCode.IllegalOperation, "The sum of the invoice payments is less than the total payment amount. Please make sure all of the money in your payment is applied to invoices. "); //targetPayment.LineItems.Add(new msPaymentLineItem // {Amount = overpayment, Type = PaymentLineItemType.OverPayment}); } string antiDupeKey = (string)Request["AntiDupeKey"]; using (var api = GetServiceAPIProxy()) { var merchantAccount = DetermineMerchantAccount(); targetPayment.CashAccount = merchantAccount; var r = api.ProcessPayment(targetPayment, payment, null); if (!r.Success) { throw new ConciergeClientException(MemberSuite.SDK.Concierge.ConciergeErrorCode.GeneralException, r.FirstErrorMessage); } PaymentProcessorResponse resp = r.ResultValue; if (!resp.Success) { // ok, we're throwing an exception throw new ConciergeClientException( MemberSuite.SDK.Concierge.ConciergeErrorCode.CreditCardAuthorizationFailed, "Unable to process payment: [{0}] - {1}", resp.GatewayResponseReasonCode, resp.GatewayResponseReasonText); } targetPayment = LoadObjectFromAPI <msPayment>(resp.PaymentID); // now, send a confirmation email api.SendTransactionalEmail(EmailTemplates.Financial.Payment, targetPayment.ID, ConciergeAPI.CurrentUser.EmailAddress); } }
private void bindExistingPaymentInfo(ElectronicPaymentManifest existingPaymentInfo) { throw new NotImplementedException(); }