protected void LoadPaymentMethods() { _PaymentMethods = new List <PaymentMethod>(); IList <PaymentMethod> allPaymentMethods = PaymentMethodDataSource.LoadAll("Name"); foreach (PaymentMethod method in allPaymentMethods) { if (IsMethodVisible(method)) { _PaymentMethods.Add(method); } } PaymentMethodList.DataSource = _PaymentMethods; PaymentMethodList.DataBind(); trPaymentMethods.Visible = (_PaymentMethods.Count > 0); }
public ListOrdersResponse InvokeListOrders() { // Create a request. ListOrdersRequest request = new ListOrdersRequest(); string sellerId = "example"; request.SellerId = sellerId; DateTime createdAfter = new DateTime(); request.CreatedAfter = createdAfter; DateTime createdBefore = new DateTime(); request.CreatedBefore = createdBefore; DateTime lastUpdatedAfter = new DateTime(); request.LastUpdatedAfter = lastUpdatedAfter; DateTime lastUpdatedBefore = new DateTime(); request.LastUpdatedBefore = lastUpdatedBefore; OrderStatusList orderStatus = new OrderStatusList(); request.OrderStatus = orderStatus; MarketplaceIdList marketplaceId = new MarketplaceIdList(); request.MarketplaceId = marketplaceId; FulfillmentChannelList fulfillmentChannel = new FulfillmentChannelList(); request.FulfillmentChannel = fulfillmentChannel; PaymentMethodList paymentMethod = new PaymentMethodList(); request.PaymentMethod = paymentMethod; string buyerEmail = "example"; request.BuyerEmail = buyerEmail; string sellerOrderId = "example"; request.SellerOrderId = sellerOrderId; decimal maxResultsPerPage = 1; request.MaxResultsPerPage = maxResultsPerPage; TFMShipmentStatusList tfmShipmentStatus = new TFMShipmentStatusList(); request.TFMShipmentStatus = tfmShipmentStatus; return(this.client.ListOrders(request)); }
private void BindPaymentMethodForms() { //CHECK ORDER TOTAL decimal orderTotal = _Basket.Items.TotalPrice(); CreditCardPaymentForm.Visible = false; GiftCertificatePaymentForm.Visible = false; CheckPaymentForm.Visible = false; PurchaseOrderPaymentForm.Visible = false; PayPalPaymentForm.Visible = false; MailPaymentForm.Visible = false; PhoneCallPaymentForm.Visible = false; ZeroValuePaymentForm.Visible = false; DeferPaymentForm.Visible = false; if (orderTotal > 0) { List <DictionaryEntry> paymentMethods = new List <DictionaryEntry>(); //ADD PAYMENT FORMS bool creditCardAdded = false; IList <PaymentMethod> availablePaymentMethods = AbleCommerce.Code.StoreDataHelper.GetPaymentMethods(_UserId); foreach (PaymentMethod method in availablePaymentMethods) { switch (method.PaymentInstrumentType) { case PaymentInstrumentType.AmericanExpress: case PaymentInstrumentType.Discover: case PaymentInstrumentType.JCB: case PaymentInstrumentType.MasterCard: case PaymentInstrumentType.Visa: case PaymentInstrumentType.DinersClub: case PaymentInstrumentType.Maestro: case PaymentInstrumentType.SwitchSolo: case PaymentInstrumentType.VisaDebit: if (!creditCardAdded) { paymentMethods.Insert(0, new DictionaryEntry(0, "Credit/Debit Card")); creditCardAdded = true; } break; case PaymentInstrumentType.Check: case PaymentInstrumentType.PurchaseOrder: case PaymentInstrumentType.PayPal: case PaymentInstrumentType.Mail: case PaymentInstrumentType.PhoneCall: paymentMethods.Add(new DictionaryEntry(method.Id, method.Name)); break; default: //types not supported break; } } if (AbleCommerce.Code.StoreDataHelper.HasGiftCertificates()) { paymentMethods.Add(new DictionaryEntry(-1, "Gift Certificate")); } paymentMethods.Add(new DictionaryEntry(-2, "Defer Payment")); //BIND THE RADIO LIST FOR PAYMENT METHOD SELECTION PaymentMethodList.DataSource = paymentMethods; PaymentMethodList.DataBind(); //CONTINUE IF PAYMENT METHODS ARE AVAILABLE if (paymentMethods.Count > 0) { //MAKE SURE THE CORRECT PAYMENT METHOD IS SELECTED int paymentMethodId = AlwaysConvert.ToInt(Request.Form[PaymentMethodList.UniqueID]); ListItem selectedListItem = PaymentMethodList.Items.FindByValue(paymentMethodId.ToString()); if (selectedListItem != null) { PaymentMethodList.SelectedIndex = PaymentMethodList.Items.IndexOf(selectedListItem); } else { PaymentMethodList.SelectedIndex = 0; } //GET THE CURRENTLY SELECTED METHOD paymentMethodId = AlwaysConvert.ToInt(PaymentMethodList.SelectedValue); if (paymentMethodId == 0) { CreditCardPaymentForm.CheckingOut += new CheckingOutEventHandler(CheckingOut); CreditCardPaymentForm.CheckedOut += new CheckedOutEventHandler(CheckedOut); CreditCardPaymentForm.Visible = true; } else if (paymentMethodId == -1) { GiftCertificatePaymentForm.CheckingOut += new CheckingOutEventHandler(CheckingOut); GiftCertificatePaymentForm.CheckedOut += new CheckedOutEventHandler(CheckedOut); GiftCertificatePaymentForm.Visible = true; } else if (paymentMethodId == -2) { DeferPaymentForm.CheckingOut += new CheckingOutEventHandler(CheckingOut); DeferPaymentForm.CheckedOut += new CheckedOutEventHandler(CheckedOut); DeferPaymentForm.Visible = true; } else { //DISPLAY FORM FOR SPECIFIC METHOD PaymentMethod selectedMethod = availablePaymentMethods[availablePaymentMethods.IndexOf(paymentMethodId)]; switch (selectedMethod.PaymentInstrumentType) { case PaymentInstrumentType.Check: CheckPaymentForm.PaymentMethodId = selectedMethod.Id; CheckPaymentForm.CheckingOut += new CheckingOutEventHandler(CheckingOut); CheckPaymentForm.CheckedOut += new CheckedOutEventHandler(CheckedOut); CheckPaymentForm.Visible = true; break; case PaymentInstrumentType.PurchaseOrder: PurchaseOrderPaymentForm.PaymentMethodId = selectedMethod.Id; PurchaseOrderPaymentForm.CheckingOut += new CheckingOutEventHandler(CheckingOut); PurchaseOrderPaymentForm.CheckedOut += new CheckedOutEventHandler(CheckedOut); PurchaseOrderPaymentForm.Visible = true; break; case PaymentInstrumentType.PayPal: PayPalPaymentForm.PaymentMethodId = selectedMethod.Id; PayPalPaymentForm.CheckingOut += new CheckingOutEventHandler(CheckingOut); PayPalPaymentForm.CheckedOut += new CheckedOutEventHandler(CheckedOut); PayPalPaymentForm.Visible = true; break; case PaymentInstrumentType.Mail: MailPaymentForm.PaymentMethodId = selectedMethod.Id; MailPaymentForm.CheckingOut += new CheckingOutEventHandler(CheckingOut); MailPaymentForm.CheckedOut += new CheckedOutEventHandler(CheckedOut); MailPaymentForm.Visible = true; break; case PaymentInstrumentType.PhoneCall: PhoneCallPaymentForm.PaymentMethodId = selectedMethod.Id; PhoneCallPaymentForm.CheckingOut += new CheckingOutEventHandler(CheckingOut); PhoneCallPaymentForm.CheckedOut += new CheckedOutEventHandler(CheckedOut); PhoneCallPaymentForm.Visible = true; break; default: //types not supported break; } } } } else { ZeroValuePaymentForm.CheckingOut += new CheckingOutEventHandler(CheckingOut); ZeroValuePaymentForm.CheckedOut += new CheckedOutEventHandler(CheckedOut); ZeroValuePaymentForm.Visible = true; } //WE DO NOT NEED THE PAYMENT SELECTION LIST IF THERE IS NOT MORE THAN ONE //AVAILABLE TYPE OF PAYMENT tdPaymentMethodList.Visible = (PaymentMethodList.Items.Count > 1) && (orderTotal > 0); }
/// <summary> /// Binds the form. /// </summary> /// <param name="reset">if set to <c>true</c> [reset].</param> private void BindForm(bool reset) { if (String.IsNullOrEmpty(SelectedPaymentStatusField.Value)) { SelectedPaymentStatusField.Value = PaymentStatus.SelectedValue; } // Bind Meta classes if (!IsPostBack || reset) { MetaClass paymentMetaClass = MetaClass.Load(OrderContext.MetaDataContext, "OrderFormPayment"); PaymentType.Items.Clear(); if (paymentMetaClass != null) { MetaClassCollection metaClasses = paymentMetaClass.ChildClasses; foreach (MetaClass metaClass in metaClasses) { PaymentType.Items.Add(new ListItem(metaClass.FriendlyName, metaClass.Id.ToString())); } //PaymentType.DataBind(); PaymentType.Items[0].Selected = true; } } PaymentMethodList.DataSource = PaymentManager.GetPaymentMethods(CommonSettingsManager.GetDefaultLanguage()); PaymentMethodList.DataBind(); if (SelectedPayment != null) { if (reset) { Amount.Text = SelectedPayment.Amount.ToString("#0.00"); Name.Text = SelectedPayment.PaymentMethodName; //SelectedPaymentStatusField.Value = selectedPayment.Status; } ManagementHelper.SelectListItem(PaymentStatus, SelectedPayment.Status); ManagementHelper.SelectListItem(PaymentType, SelectedPayment.MetaClass.Id); ManagementHelper.SelectListItem(PaymentMethodList, SelectedPayment.PaymentMethodId); MetaDataTab.ObjectId = SelectedPayment.PaymentId; } else if (reset) { Amount.Text = 0.ToString("#0.00"); Name.Text = ""; //SelectedPaymentStatusField.Value = PaymentStatus.SelectedValue; } if (String.IsNullOrEmpty(SelectedPaymentTypeField.Value)) { SelectedPaymentTypeField.Value = PaymentType.SelectedValue; } if (String.IsNullOrEmpty(SelectedPaymentMethodField.Value)) { SelectedPaymentMethodField.Value = PaymentMethodList.SelectedValue; } // Bind Meta Form BindMetaForm(); }
public ActionResult Settings(bool storeEnabled, string motd, string storeName, string facebookCoupon) { MASTERdomain.organisation.motd = motd; MASTERdomain.storeName = storeName; // website verificaiton bool verifySite = false; Webmaster webmaster = null; SitesEntry site = null; // store if (storeEnabled) { // check that payment methods have been configured var paymentmethods = new PaymentMethodList(); paymentmethods.Initialise(MASTERdomain, false); if (paymentmethods.count == 0) { return(Json("You need to specify your paypal id and/or a payment method before you can enable your store. <a href='/dashboard/account#account_payment'>Setup payment methods</a>".ToJsonFail())); } // don't allow store to be enabled if (MASTERdomain.trialExpired) { return(Json("Store cannot be made public. Your trial period has expired.".ToJsonFail())); } // only register the following with google if store not already enabled if (!IsStoreEnabled) { MASTERdomain.flags |= (int)SubdomainFlags.STORE_ENABLED; #if !DEBUG // update info to google webmaster webmaster = new Webmaster(); var url = accountHostname.ToDomainUrl("", true); site = webmaster.AddSite(url); if (site != null) { var metaTag = site.VerificationMethod.Value; MASTERdomain.metaTagVerification = metaTag; verifySite = true; } #endif } } else { MASTERdomain.flags &= ~(int)SubdomainFlags.STORE_ENABLED; } // handle facebook coupon if (!string.IsNullOrEmpty(facebookCoupon)) { var coupon = repository.GetCoupons(subdomainid.Value).SingleOrDefault(x => x.code == facebookCoupon && !x.expired); if (coupon != null) { MASTERdomain.facebookCoupon = coupon.id; } } else { MASTERdomain.facebookCoupon = null; } repository.Save(); // SUBMIT // need to be done here so that metatag is saved and then can be shown at store page if (verifySite) { var url = accountHostname.ToDomainUrl("", true); // verify site webmaster.VerifySite(url, site); // add sitemap new Thread(() => { var sitemap = string.Concat(url, "google/sitemap"); webmaster.AddSitemap(url, sitemap); }).Start(); } CacheHelper.Instance.invalidate_dependency(DependencyType.organisation, subdomainid.Value.ToString()); return(Json(OPERATION_SUCCESSFUL.ToJsonOKData())); }
private void BindPaymentOptions() { // GENERATE LIST OF PAYMENT TYPES AVAIL List <DictionaryEntry> paymentMethods = new List <DictionaryEntry>(); _AvailablePaymentMethods = AbleCommerce.Code.StoreDataHelper.GetPaymentMethods(AbleContext.Current.UserId); bool hasSubscriptions = HasRecurringSubscriptions(); foreach (PaymentMethod method in _AvailablePaymentMethods) { if (!IsPaymentMethodAllowed(method, hasSubscriptions)) { // basket / order contains recurring subscriptions. This payment method is not allowed // for subscription payments continue; } switch (method.PaymentInstrumentType) { case PaymentInstrumentType.AmericanExpress: case PaymentInstrumentType.Discover: case PaymentInstrumentType.JCB: case PaymentInstrumentType.MasterCard: case PaymentInstrumentType.DinersClub: case PaymentInstrumentType.Visa: case PaymentInstrumentType.Maestro: case PaymentInstrumentType.SwitchSolo: case PaymentInstrumentType.VisaDebit: if (paymentMethods.Count == 0 || (int)paymentMethods[0].Key != -1) { paymentMethods.Insert(0, new DictionaryEntry(-1, "Credit/Debit Card")); } break; case PaymentInstrumentType.Check: case PaymentInstrumentType.PurchaseOrder: case PaymentInstrumentType.PayPal: case PaymentInstrumentType.Mail: case PaymentInstrumentType.PhoneCall: paymentMethods.Add(new DictionaryEntry(method.Id, method.Name)); break; case PaymentInstrumentType.Amazon: // Amazon do not support post order payments if (this.Basket != null) { paymentMethods.Add(new DictionaryEntry(method.Id, method.Name)); } break; default: // types not supported break; } } // INCLUDE GIFT CERTIFICATES IF ANY EXIST IN THE STORE if (AbleCommerce.Code.StoreDataHelper.HasGiftCertificates()) { if (!hasSubscriptions || !AbleContext.Current.Store.Settings.ROCreateNewOrdersEnabled) { paymentMethods.Add(new DictionaryEntry(-2, "Gift Certificate")); } } // ONLY CONTINUE IF PAYMENT METHODS ARE AVAILABLE if (paymentMethods.Count > 0) { paymentMethods.Sort(ComparerPaymentMethod); // BIND THE RADIO LIST FOR PAYMENT METHOD SELECTION PaymentMethodList.DataSource = paymentMethods; PaymentMethodList.DataBind(); // MAKE SURE THE CORRECT PAYMENT METHOD IS SELECTED int paymentMethodId = AlwaysConvert.ToInt(Request.Form[PaymentMethodList.UniqueID]); ListItem selectedListItem = PaymentMethodList.Items.FindByValue(paymentMethodId.ToString()); if (selectedListItem != null) { PaymentMethodList.SelectedIndex = PaymentMethodList.Items.IndexOf(selectedListItem); } else { PaymentMethodList.SelectedIndex = 0; } // SHOW THE CORRECT FORM FOR THE SELECTED METHOD paymentMethodId = AlwaysConvert.ToInt(PaymentMethodList.SelectedValue); if (paymentMethodId == -1) { CreditCardPaymentForm.Visible = true; // show amount entry for post-checkout payments CreditCardPaymentForm.AllowAmountEntry = this.Order != null; } else if (paymentMethodId == -2) { GiftCertificatePaymentForm.Visible = true; } else { PaymentMethod selectedMethod = _AvailablePaymentMethods[_AvailablePaymentMethods.IndexOf(paymentMethodId)]; switch (selectedMethod.PaymentInstrumentType) { case PaymentInstrumentType.Check: CheckPaymentForm.PaymentMethodId = selectedMethod.Id; CheckPaymentForm.Visible = true; break; case PaymentInstrumentType.PurchaseOrder: PurchaseOrderPaymentForm.PaymentMethodId = selectedMethod.Id; PurchaseOrderPaymentForm.Visible = true; break; case PaymentInstrumentType.PayPal: PayPalPaymentForm.PaymentMethodId = selectedMethod.Id; PayPalPaymentForm.Visible = true; break; case PaymentInstrumentType.Mail: MailPaymentForm.PaymentMethodId = selectedMethod.Id; MailPaymentForm.Visible = true; break; case PaymentInstrumentType.PhoneCall: PhoneCallPaymentForm.PaymentMethodId = selectedMethod.Id; PhoneCallPaymentForm.Visible = true; break; case PaymentInstrumentType.Amazon: AmazonPaymentForm.PaymentMethodId = selectedMethod.Id; AmazonPaymentForm.Visible = true; break; default: // types not supported break; } } // SHOW PAYMENT SELECTION IF THERE IS MORE THAN ONE TYPE PaymentMethodListPanel.Visible = PaymentMethodList.Items.Count > 1; } else { // must show an error message NoPaymentMethodsPanel.Visible = true; PaymentMethodListPanel.Visible = false; } }
/** * Convert ListOrdersRequest to name value pairs */ private IDictionary <String, String> ConvertListOrders(ListOrdersRequest request) { IDictionary <String, String> parameters = new Dictionary <String, String>(); parameters.Add("Action", "ListOrders"); if (request.IsSetSellerId()) { parameters.Add("SellerId", request.SellerId); } if (request.IsSetCreatedAfter()) { parameters.Add("CreatedAfter", GetFormattedTimestamp(request.CreatedAfter)); } if (request.IsSetCreatedBefore()) { parameters.Add("CreatedBefore", GetFormattedTimestamp(request.CreatedBefore)); } if (request.IsSetLastUpdatedAfter()) { parameters.Add("LastUpdatedAfter", GetFormattedTimestamp(request.LastUpdatedAfter)); } if (request.IsSetLastUpdatedBefore()) { parameters.Add("LastUpdatedBefore", GetFormattedTimestamp(request.LastUpdatedBefore)); } if (request.IsSetOrderStatus()) { OrderStatusList listOrdersRequestOrderStatus = request.OrderStatus; List <OrderStatusEnum> orderStatusStatusList = listOrdersRequestOrderStatus.Status; int orderStatusStatusListIndex = 1; foreach (OrderStatusEnum orderStatusStatus in orderStatusStatusList) { parameters.Add("OrderStatus" + "." + "Status" + "." + orderStatusStatusListIndex, orderStatusStatus + ""); orderStatusStatusListIndex++; } } if (request.IsSetMarketplaceId()) { MarketplaceIdList listOrdersRequestMarketplaceId = request.MarketplaceId; List <String> marketplaceIdIdList = listOrdersRequestMarketplaceId.Id; int marketplaceIdIdListIndex = 1; foreach (String marketplaceIdId in marketplaceIdIdList) { parameters.Add("MarketplaceId" + "." + "Id" + "." + marketplaceIdIdListIndex, marketplaceIdId); marketplaceIdIdListIndex++; } } if (request.IsSetFulfillmentChannel()) { FulfillmentChannelList listOrdersRequestFulfillmentChannel = request.FulfillmentChannel; List <FulfillmentChannelEnum> fulfillmentChannelChannelList = listOrdersRequestFulfillmentChannel.Channel; int fulfillmentChannelChannelListIndex = 1; foreach (FulfillmentChannelEnum fulfillmentChannelChannel in fulfillmentChannelChannelList) { parameters.Add("FulfillmentChannel" + "." + "Channel" + "." + fulfillmentChannelChannelListIndex, fulfillmentChannelChannel + ""); fulfillmentChannelChannelListIndex++; } } if (request.IsSetPaymentMethod()) { PaymentMethodList listOrdersRequestPaymentMethod = request.PaymentMethod; List <PaymentMethodEnum> paymentMethodMethodList = listOrdersRequestPaymentMethod.Method; int paymentMethodMethodListIndex = 1; foreach (PaymentMethodEnum paymentMethodMethod in paymentMethodMethodList) { parameters.Add("PaymentMethod" + "." + "Method" + "." + paymentMethodMethodListIndex, paymentMethodMethod + ""); paymentMethodMethodListIndex++; } } if (request.IsSetBuyerEmail()) { parameters.Add("BuyerEmail", request.BuyerEmail); } if (request.IsSetSellerOrderId()) { parameters.Add("SellerOrderId", request.SellerOrderId); } if (request.IsSetMaxResultsPerPage()) { parameters.Add("MaxResultsPerPage", request.MaxResultsPerPage + ""); } if (request.IsSetTFMShipmentStatus()) { TFMShipmentStatusList listOrdersRequestTFMShipmentStatus = request.TFMShipmentStatus; List <String> TFMShipmentStatusStatusList = listOrdersRequestTFMShipmentStatus.Status; int TFMShipmentStatusStatusListIndex = 1; foreach (String TFMShipmentStatusStatus in TFMShipmentStatusStatusList) { parameters.Add("TFMShipmentStatus" + "." + "Status" + "." + TFMShipmentStatusStatusListIndex, TFMShipmentStatusStatus); TFMShipmentStatusStatusListIndex++; } } return(parameters); }
public PaymentViewModel() { paymentMethods = new PaymentMethodList(); }