How to get all items and transactions made by the seller on eBay for all time. I can successfully receive all transaction details for the past 10 days using the following code:
// Getting sold items
var durationSpecifiedeBaySellingCall = new GetMyeBaySellingCall(apiContext)
{
SoldList = new ItemListCustomizationType
{
DurationInDays = 10,
DurationInDaysSpecified = true,
Include = true
},
DetailLevelList = new DetailLevelCodeTypeCollection
{
DetailLevelCodeType.ReturnAll
}
};
durationSpecifiedeBaySellingCall.Execute();
but I'm not able to receive all transactions for the past 10 years, for example, when replace the value of DurationInDays with 3650 instead of 10. durationSpecifiedeBaySellingCall.SoldListReturn is null. How can I properly get the list of all user transactions?
It looks like you are using the GetMyeBaySelling API call, the documentation states that you can only pull a Max of 60 Days.
eBay Documentation GetMyeBaySelling
Related
We have one product with 4 different prices(basic, middle etc). Let's say user bought basic package (payment session is created after payment completion subscription created),but after a while, user decided to change his package and upgrade to advanced package. In that case should i use update subscription ?
This actually updates from X$ to the Y$ package
var service = new SubscriptionService();
Subscription subscription = service.Get("sub_49ty4767H20z6a");
var items = new List<SubscriptionItemOptions> {
new SubscriptionItemOptions {
Id = subscription.Items.Data[0].Id,
Price = "price_CBb6IXqvTLXp3f",
},
};
var options = new SubscriptionUpdateOptions {
CancelAtPeriodEnd = false,
ProrationBehavior = "create_prorations",
Items = items,
};
subscription = service.Update("sub_49ty4767H20z6a", options);
or just cancel current subscription and create new one ? Why am i asking this, because i chatted with support guys from Stripe, and got two different answers. One of them told me that i need to use update_subscripton, the another one told that i need to attach new subscription. I am confused.
The way that you've described this here, the update to upgrade the subscription makes more sense to me. Pay careful attention to the intended proration behaviour (do you want to credit the time left on the current plan) and whether you want to shift the billing period.
I'd also point out that you should consider switching to separate Products. A Product is a single good/service that you sell, while Prices represent different billing intervals and currencies. If you imagine some service with Silver, Gold and Platinum access levels, each of those is a different product -- they get more features! The Product is what gets shown on the invoice, too. So unless you use separate Products, the invoices would be indistinguishable aside from the rate paid.
Most of the time doing what you've done doesn't present any specific obsdtacles, but the Customer Portal enforces one price per product per interval. If you had two annual prices for the "same product" but different amount, why would anybody pay the higher price? It's because they're paying for something different, a different product.
Quick Answer
Upgrade (From Basic to Pro)
Remove Basic
Add Pro
Prorate (Do not change billing cycle)
// subscriptionId -> your subscription id
// additionalStripePriceIds -> stripe price id you are going to add
// removalStripePriceIds -> stripe price id you are going to remove
var getService = new SubscriptionService();
var getServiceResult = await getService.GetAsync(subscriptionId);
var items = new List<SubscriptionItemOptions>();
if (removalStripePriceIds != null && removalStripePriceIds.Any())
{
foreach (var removalStripePriceId in removalStripePriceIds)
{
var item = getServiceResult.Items.Data.FirstOrDefault(i => i.Price.Id == removalStripePriceId);
if (item != null)
{
var subscriptionItemOption = new SubscriptionItemOptions
{
Id = item.Id,
Deleted = true,
};
items.Add(subscriptionItemOption);
}
}
}
foreach (var additionalStripePriceId in additionalStripePriceIds)
{
var subscriptionItemOption = new SubscriptionItemOptions
{
Price = additionalStripePriceId,
};
items.Add(subscriptionItemOption);
}
var updateService = new SubscriptionService();
var updateOptions = new SubscriptionUpdateOptions
{
CancelAtPeriodEnd = false,
ProrationBehavior = "create_prorations",
Items = items,
};
await updateService.UpdateAsync(subscriptionId, updateOptions);
I'm developing an SMS communication test app in WPF C# with Twilio. Almost everything works like a charm but I cannot retrieve the SMS history between 2 given dates.
The strange thing is that I can retrieve the total SMS costs between 2 dates which is almost the same...
Now here is my code to retrieve the costs for 2 given dates (which works) :
public void SmsBilling()
{
var records = RecordResource.Read(
category: RecordResource.CategoryEnum.SmsOutbound,
startDate: DateTime.Parse(bills.StartDate),
endDate: DateTime.Parse(bills.EndDate));
foreach (var record in records)
{
bills.NbSms = record.Count;
bills.SmsCost = record.Price;
}
}
This is the code to retrieve the history between 2 dates
(which crashes with the following exception : System.ArgumentNullException: 'The string reference is not set to an instance of a string.
Parameter name: s')
private void GetSms()
{
smsList.Sms = new List<Sms>();
var messages = MessageResource.Read(
limit: 20,
dateSentAfter: DateTime.Parse(bills.StartDate),
dateSentBefore: DateTime.Parse(bills.EndDate));
foreach (var record in messages)
{
smsList.Sms.Add(new Sms { DateHour = record.DateSent, Recipient = record.To, Source = record.From.ToString() });
}
smslist.ItemsSource = smsList.Sms;
}
What am I missing?
You can't pass a null reference to DateTime.Parse.
You may want to replace null values with DateTime.MinValue and DateTime.MaxValue:
dateSentAfter: DateTime.Parse(bills.StartDate ?? DateTime.MinValue),
dateSentBefore: DateTime.Parse(bills.EndDate ?? DateTime.MaxValue));
I have more than 1000 customer(s) and invoice(s) and I am trying to fetch all those customers and invoice(s) into a drop-down list.
Documentation on the QBO site suggests that we should need to use pagination if I want to load all the customers in a grid, but what I want is to load all the customer(s) and invoice(s) in a drop-down list.
I am getting the following exception when I try to fetch more than 1000 customer(s) and invoice(s):
Validation Exception was thrown.
Details: QueryValidationError: value 100000 is too large. Max allowed value is 1000.
I am trying to fetch all the customers using the following code
public static List<Customer> GetAllQBOCustomers(ServiceContext context)
{
return Helper.FindAll<Customer>(context, new Customer(),1,100000);
}
I wrote the below code and solved my issue.
1. First I get the count of all the customers
2. Then I get all the customers in chunks and the chunk size is 1000
3. Create a List for customers.
4. Define 3 integer type variables for counting.
5. After that use do-while loop
6. Add all the customers are added to the main customer list
string strQuery = "Select Count(*) From Customer";
string custCount = qboAccess.GetCutomerCount(qboInz.QboServiceContext, strQuery);
List<qboData.Customer> customers = new List<Customer>();
int maxSize = 0;
int position = 1;
int count = Convert.ToInt32(custCount);
do
{
var custList = qboAccess.GetAllQBOEntityRecords(qboInz.QboServiceContext, new Customer(), position, 1000);
customers.AddRange(custList);
maxSize += custList.Count();
position += 1000;
} while (count > maxSize);
The straightforward answer is to loop enough times to get the records you need:
public static List<Customer> GetAllQBOCustomers(ServiceContext context)
{
var list = new List<Customer>();
for (int i=0; i<=10000; i+= 1000)
{
var results = Helper.FindAll<Customer>(context, new Customer(),i, 1000);
list.AddRange(results);
}
return list;
}
Or if you want to try to do it in parallel (and the API allows concurrent connections):
public static List<Customer> GetAllQBOCustomers(ServiceContext context)
{
var bag = new ConcurrentBag<Customer>();
Parallel.ForEach( Enumerable.Range(0, 10), i =>
{
var results = Helper.FindAll<Customer>(context, new Customer(),i * 1000, 1000);
bag.AddRange(results);
});
return bag.ToList();
}
Since the series of calls is likely to be expensive, I suggest you cache the results.
You can't download those records all at once. That is what the error is telling you - very clearly. There's no magic way to avoid the server's rules.
However, I really think you should not download them all at once anyway. A drop-down list is not a good way to display that amount of data to users. Consider the user experience - would you want to scroll through a list of thousands of customers to try and find the one you want? Or would it be easier to start typing part of the name and have it pop up a short list of possible matches to choose from?
A more user-friendly way to implement this would be use an auto-complete box instead of a drop-down list, and after the user has typed a few characters, it can use AJAX to search the API for customers whose names or IDs contain those characters. Then you'll only need to return a small number of records each time, and the user will not be stuck having to scroll for 10 minutes just to find a customer at the bottom of a list of 10,000 records.
I'm using Intuit's .NET SDK for QBO, and am attempting to get a list of purchases from my qbo account. Here's my C# code...
var qboCashPurchaseQuery = new Intuit.Ipp.Data.Qbo.CashPurchaseQuery();
qboCashPurchaseQuery.PageNumber = 1;
qboCashPurchaseQuery.ResultsPerPage = 100;
var results = qboCashPurchaseQuery.ExecuteQuery<Intuit.Ipp.Data.Qbo.CashPurchase(context).ToList();
grdQuickBooksCustomers.DataSource = results;
I get a table with the number of records matching the number of purchases I expect, but the actual data returned is not what I need.
This is the columns and the first row of data I get back: (sorry for the formatting)
SyncToken Synchronized IdsType
0 Intuit.Ipp.Data.Qbo
This bit of code returns the same kind of weird data for some other functions such as InvoiceQuery. What am I doing wrong here to get this data? How might I actually return the detailed purchase data I need?
string q = "Select * from Purchase Where PaymentType='Cash' STARTPOSITION 1 MAXRESULTS 100";
dynamic Purchaselist = purchaseQueryService.ExecuteIdsQuery(q);
CashPurchase cashpurchase = new CashPurchase();
foreach (CashPurchase oCash in Purchaselist) {
//do something
}
var purchase = new Purchase();
var purchases = ds.FindAll(purchase, 0, 500);
That's how we query our datasets. You have to repeat the query if you've got more than 500 items.
Hi i'm using magento soap api v2 with c#. Do far I have been calling
var groupedProducts = magentoService.catalogProductLinkList(sessionId, "grouped", id, "productId");
that does return grouped Products, but instead I would like to retrieve simple products such as green large t-shirt which is associated with configurable t-shirt.
How can this be achieved?
Unfortunatelly that's not possible with the magento SOAP api. You are not able to retrieve child products of a parent product via the api. Believe me, I have tackled this myself some time ago. I can suggest 2 fixes and 1 workaround.
Workaround - Try to retrieve child products by sku or name. This can work provided that all your child products use the parent's name or sku as the prefix. That's how I resolved it in the beginning and it worked well as long as the client did not introduce child product names that did not match the parent name. Here's some sample code:
//fetch configurable products
filters filter = new filters();
filter.filter = new associativeEntity[1];
filter.filter[0] = new associativeEntity();
filter.filter[0].key = "type_id";
filter.filter[0].value = "configurable";
//get all configurable products
var configurableProducts = service.catalogProductList(sessionID, filter, storeView);
foreach (var parent in configurableProducts)
{
filters filter = new filters();
filter.filter = new associativeEntity[1];
filter.filter[0] = new associativeEntity();
filter.filter[0].key = "type_id";
filter.filter[0].value = "configurable";
filter.complex_filter = new complexFilter[1];
filter.complex_filter[0] = new complexFilter();
filter.complex_filter[0].key = "sku";
filter.complex_filter[0].value = new associativeEntity() { key="LIKE", value=parent.sku + "%" };
var simpleProducts = service.catalogProductList(sessionID, filter, storeView);
//do whatever you need with the simple products
}
Fix #1 - Free - Write your own api extension. To retrieve child products you could use:
$childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null, $product);
You then send the results to the api caller and all should be well. I have not tried that myself, though, so I'm not sure if there are any other problems on the way.
Fix #2 - Paid - Get the (excellent, but pricey) CoreAPI extension from netzkollektiv. That's what I did when the workaround stopped working out for me and never regretted this decision.
I dont think what you are trying to do is possible with default magento SOAP api.
What you could do is create a custom api
eg.
How to setup custom api for Magento with SOAP V2?
http://www.magentocommerce.com/api/soap/create_your_own_api.html
Then create the logic to retrieve all the simple products associated with that configurable product.
$_product = Mage::getModel('catalog/product')->load($id);
// check if it's a configurable product
if($_product->isConfigurable()){
//load simple product ids
$ids = $_product->getTypeInstance()->getUsedProductIds();
OR
$ids = Mage::getResourceModel('catalog/product_type_configurable')->load($_product);
}
Please be aware that it should be
... new associativeEntity() { key="like", ...
and not
... new associativeEntity() { key="LIKE", ....
Upper case LIKE does not work.
I found a Magento Extension on Github, which includes this functionallity.
Get configurable's subproducts informations in the same response.
https://github.com/Yameveo/Yameveo_ProductInfo