distriqt inappbilling - getProducts - distriqt

So I guess you could say I feel like I find myself in a void. Here's the way I understand the order for distriqt inappbilling - android setup
Init the billing
getProducts(send_in_array_of_products)
Now that it's done I can send requests for consume, purchase etc.
The first time I ran the program it returned the products. I made a test purchase but the purchase failed - it made it to the android login and verify credit card - then the purchase failed event was triggered (I have no idea why it failed at this time). I closed the game at this point and did some updates to track more of what was going on.
When I went to run the game the second time it failed getting the products list - turns out it gave me the following error: 1003 - Error refreshing inventory (querying owned items). Okay - now what??
I can't load the getProducts() because of this error. I have tried sending a consume for each product and that fails. It seems like I'm stuck in a spot where I can't do anything with the store because I can't load the product list.
Android says you are suppose to call to the store to get a list of products that that the person owns but I don't see that type of function in the distriqt package.
Can anyone explain what I have to do to get the store working again. How do I request a product list by leaving out the products that they own if I don't know what products they own? Also, if I do know what they own - shouldn't Consume(product) remove it from being a purchased product?
Does anyone know if you can run consume(product) without doing a getProducts() command first?
Thanks for any help you can provide.

This answer really applies to Distriqt InAppBilling ANE but it might help with other people having the same problem using different programming methods. After about a week of messing around I finally figured it out.
You have to make sure the call the
InAppBilling.service.finishPurchase(purchase-information)
command.
Otherwise the play store will see this as an open transaction and when you try to get the product list - it fails with the error code 1003 - Error refreshing inventory (querying owned items).
To fix this I made the finishPurchase call to all of my products. Once that was done everything started working correctly again. Just be sure to call the finishPurchase command on all returned purchase events. I missed that call in the fail event and that was the one that caused my headache. You would think if the purchase failed that google would just close the transaction but no - you still have to tell them that it's finished. Hope this helps someone!

Related

Why is PrestaShop redirrecting to a random product when selecting variations from front-end?

I have an online shop in development, all went well until I decided to do SEO on the shop. After this, if I chose a product variation from front-end it just redirects me to a random product.
This picture describes the first state. The default product load.
This picture describes what is happening after you select a variation. As you can see the product name stays the same, but the link indicates that a totally different product is displayed.
If I have the debug mode enabled when selecting a variation it throws "An error occurred while processing your request" and in the request file I can see that besides some errors (Deprecated: array_key_exists(): Using array_key_exists()) it shows the request for a different product.
I can't understand why this is happening, so I am in dying need of your help.
That's the way Prestashop 1.7 works :
First time a customer lands in a multi-variation page, the default attribute will be loaded,
URL will show only the ID product.
Once you choose an attribute , an AJAX call will refresh the page
with the current attribute and URL will change with id_product-id_product_attribute value.
Not sure what you mean by "random product" as in both of your examples I see an attribute
being selected.
Anyway there are several (paid) modules to change this behaviour in a better SEO perspective,
this is definitely one of the most famous :
https://addons.prestashop.com/en/url-redirects/16633-pretty-urls-seo-friendly-url-remove-ids-numbers.html
EDIT: Just noticed that the ID product is different in the two screenshot, this could be related to some DB issues with attribute too, you should check if you have some not coherent values between id_product and id_product_attribute(s)
I found a fix for this. Apparently or appeared because I was using the duplicate function for uploading products. I don't know why but on some products it makes this behavior.
I've spent over 12 hours to find a explanation for this and I was unable to find one. The PrestaShop forum straight up banned me for posting this topic.
My advice is to NOT USE PRESTASHOP it's and old sistem and full of bugs, the support is expensive and I get the impression that even they don't understand their system.
If you find yourself in this situation, know this. Don't duplicate and upload products using "add new" function.
And I can't state this enough, do yourself a favour and don't use Presta, with all the expenses the time to invest and what the product looks like at the end of the road, is just a waste of time. Even after you finish is guaranteed to break in 1-2 years, any updates will break your store and you will need to invest even more more to fix it. It's an old, slow and buggy CMS. It's days are numbered.
Thanks a lot for help.
Best regards, Daniel.

How do I make woocommerce error messages block the user from continuing?

Approx 2 years ago, I wrote a custom plugin that checks order items in the cart for specific requirements. If the requirements are not met, it displays an error and does not allow the customer to check out. This code has been working well for approx 2 years. Recently the code broke. It must have been due to the recent WooCommerce upgrades, as we hadn't touched the code in ages. I spent a while debugging it and this is what I found:
wc_add_notice doesn't do anything anymore. When I changed it to wc_print_notice, it displays the error notice.
In the past, when I used wc_add_notice on the cart or checkout page, it would display the error message and not allow the user to continue to checkout. Now that I am using wc_print_notice, it only displays the error message, but it does allow the user to continue. I spent a long time working on this today and I can't figure out how to stop the user from continuing to check out.
Any suggestions..?
And, does anyone know where I can read documentation of the WooCommerce upgrade changes related to my issue?
Thanks!
PS: If you want to see code samples, here are 2 articles which I found today, that display sample code doing exactly what my code does:
https://www.sitepoint.com/minimum-checkout-requirements-in-woocommerce/
https://gist.github.com/kloon/4545677

Purchase simulation dialog does not show up (CurrentAppSimulator.RequestProductPurchaseAsync)

I was developing an app for Windows 8. After a while I updated the project to Windows 8.1 and I got a warning, that the method CurrentAppSimulator.RequestProductPurchaseAsync(String, Boolean) from the CurrentAppSimulator class is deprecated. So I started using CurrentAppSimulator.RequestProductPurchaseAsync(String) version of it, and for some reason the purchase simulation dialog does not show up at all. Here is a dialog I was getting using deprecated version of the method.
I never needed the WindowsStoreProxy.xml before, but just in case I checked it and set the IsTrial property to false - however, the dialog does not show up, and the answer of the new method CurrentAppSimulator.RequestProductPurchaseAsync(String) always returns ProductPurchaseStatus::NotPurchased.
Maybe someone knows where is the problem?
The NotPurchased is returned, because the file WindowsStoreProxy.xml that is used by CurrentAppSimulator does not contain the requested product. You need to fill WindowsStoreProxy.xml with all the products you are providing to the app user. Here are some examples, written by Microsoft.
WindowsStoreProxy.xml is created on the first launch of the app in this location:
C:\Users\<username>\AppData\Local\Packages\<app package folder>\LocalState\Microsoft\Windows Store\ApiData\WindowsStoreProxy.xml
Also, after every CurrentAppSimulator.RequestProductPurchaseAsync(String) call, when result is ProductPurchaseStatus.Succeeded you need to do two things:
Grant user the product (e.g. purchased item)
Inform Store, that the product fulfillment is completed successfuly - using method CurrentApp.ReportConsumableFulfillmentAsync(String, Guid). Make sure, that the FulfillmentResult that is returned afterwards is FulfillmentResult::Succeeded
After these steps your item should be successfully purchased and fulfilled.
Check out detailed explanation: Enable consumable in-app product purchases.
And if you need more clarification of what each FulfillmentResult means for the purchase, you can look up a really good explanation in the book "Universal Windows Apps with XAML and C# Unleashed" by Adam Nathan, that I found while googling these things.

eBay LMS Trading API AddFixedPriceItemRequest returns 'SKU already in use' error

I've been working on an automatized eBay-upload-item module for a while now and every time I think it could work, eBay comes up with a new non-sense error. Currently the error is:
SKU already in use
I have 0 items in my listing, (active, ended, unsold etc), literally, 0 items anywhere. And when i try to make a BULK upload via the Trading API using individual AddFixedPriceItemRequest per item (including variations), I get the above error, which makes no sense.
All my SKUs are uniquely generated and then checked for against a database that stores them so as to avoid duplication. There is no documentation anywhere, and just basing my debugging on eBay's error reporting can drive anyone into insanity.
Any help will be much appreciated. Thanks
First of all, make sure that the item you're trying to upload is not a Multi-SKU item. This error can appear for multiple problems related to any part of your listing.
It would be also great if you can post API request and response here.

VirtoCommerce - Creation of a new payment gateway

I have a big problem dealing with new payment gateway creation. I followed a tutorial but I think I did something wrong because it doesn't work well.
I would like to create a "devis" (sorry I don't know the word in english... It looks like that.
When the customer buys something, he could choose this kind of payment which does nothing but provide the "devis". It would be perfect if the status of the order could be "on hold" directly in order to unhold it when the "real payment" is done.
I hope you have understand what I try to do but if you have not be free to ask me questions.
Here is what I've done:
I created a new class in the VirtoCommerce.PaymentGateways namespace called DevisPaymentGateway which inherits from the PaymentGatewayBase class.
In this class there is just one method: ProcessPayment where I do:
payment.status = PaymentStatus.Completed.ToString();
in the SqlOrderDatabaseInitializer.cs
I created a private SetupDevisGateway method:
private void SetupPaypalGateway(List<PaymentGateway> gateways)
which is called in the CreatePaymentGateways method just after the paypal gateway.
I deployed the database thanks to your powershell script, the gateway
is created as expected.
I enabled the gateway payment via
VirtoCommerce Manager Then I bought something on the website and I
chose the new Payment which is available so it seems to work.
When I click on proceed to checkout I have a new order line which is created
with the "Pending" status so it's perfect...
When I bought something with paypal for example, there was the same reaction BUUUT when the new order line was created there was the onBeforeUpdate method which detected that new line and some work was done asynchronously. With the new gateway it seems that the onBeforeUpdate method doesn't work anymore...
I think that I've forgot something which is done with Paypal and not with my gateway but what and where?
I already know that it's not a good idea to write something in the SqlOrderDatabaseInitializer.cs but I don't think that it's the problem... Does anybody have a solution?
Thanks
Edit: Explanation on what I try to achieve:
Products which are sold are in fact a couple: "images treatments" + "images"
Each customer can manage album and put photos into it, and when he clicks on a product (which is a treatment) he can choose an album.
So it's why I need this event, when the payment is done and the status change from pending to in progress, I send relevant information (about the treatment, the album...) to a queue and I have worker roles (one for each treatment) which read these messages and do some work.
I hope you understand the idea but if you don't, do not hesitate to ask me questions
can you explain why do you need that event? What will you do when that event is raised?
Some explanation below on how status is changed for the order below:
The order status is actually changed by the job "ProcessOrderStatusWork class" that simply runs in the background and changes the status order status from "Pending" to "InProgress" after order has been in pending state for a certain period of time. I would suggesting for you to create a copy of "ProcessOrderStatusWork" class and create a new job (name it MyProcessOrderStatusWork class), that in addition to changing status also adds custom work for your payment. You can then register that Job and disable the one included with VC, so it is not duplicated (by adding it in the database,similar to how you did payment gateway).
It might work for PayPal, because it uses slightly different logic, as order created on call back from PayPal, thus executing in the same web process and event is raised.