/// <summary> /// Initializes the target object for the page /// </summary> /// <remarks>Many pages have "target" objects that the page operates on. For instance, when viewing /// an event, the target object is an event. When looking up a directory, that's the target /// object. This method is intended to be overriden to initialize the target object for /// each page that needs it.</remarks> protected override void InitializeTargetObject() { base.InitializeTargetObject(); targetPayment = MultiStepWizards.MakePayment.Payment; hfOrderBillToId.Value = ConciergeAPI.CurrentEntity.ID; dvPriorityData.InnerHtml = GetPriorityPaymentsConfig(hfOrderBillToId.Value); if (!IsPostBack) { using (var api = GetServiceAPIProxy()) BillingInfoWidget.AllowableMethods = api.DetermineAllowableInvoicePaymentMethods(targetPayment).ResultValue; BillingInfoWidget.SetBillingAddress(new Address()); } }
/// <summary> /// Initializes the target object for the page /// </summary> /// <remarks>Many pages have "target" objects that the page operates on. For instance, when viewing /// an event, the target object is an event. When looking up a directory, that's the target /// object. This method is intended to be overriden to initialize the target object for /// each page that needs it.</remarks> protected override void InitializeTargetObject() { base.InitializeTargetObject(); targetEntity = string.IsNullOrWhiteSpace(ContextID) ? CurrentEntity : LoadObjectFromAPI <msEntity>(ContextID); if (targetEntity == null) { GoToMissingRecordPage(); return; } targetPayment = CreateNewObject <msPayment>(); targetPayment.Owner = targetEntity.ID; targetPayment.Date = DateTime.UtcNow; // We can't trust defult cash account set by describer. targetPayment.CashAccount = string.Empty; }
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); } }