Flutter: Using the iOS Promotional Offers - ios

I am having some hard time trying to use iOS subscriptions promotional offers.
I was able to retrieve the discounts list from the productDetails after casting it to AppStoreProductDetails.
if (Platform.isIOS) {
List<SKProductDiscountWrapper> discounts = (productDetails as AppStoreProductDetails).skProduct.discounts;
}
However I have two problems
1 - discount object has no identifier, which makes it complicated to get a specific discount especially if a subscription has more than one offer
2 - How to apply the the discount when making the purchase?
_inAppPurchase.buyNonConsumable(purchaseParam: purchaseParam);
PurchaseParam (also AppStorePurchaseParam) doesn't take discounts as params, where should we then use those discount objects?
any help or hint would be welcome. Thanks.

Related

How to change the order of list of in-app purchases in appstore app information section?

I have more than 20 in-app purchase subscription plans inside my app. I want to show few selected plans inside the Appstore information section and also I need to reorder that based on my subscription plans. Right now it's showing randomly from the in-app purchase list.
Is there any way I can customize this and show the plans based on my requirement?
Thanks,
I guess the only way is to sort it alphabetically or by price amount.
here is an example with react native while its not swift you cane create similar results
products.sort((item,item2)=> item.price > item2.price ) // will sort the
products ascending based on price.
where products is a jason that contains an array of JavaScript objects
Object {
"description": "best service for one great price",
"price": "$24.82",
"priceAmountMicros": 24820000,
"priceCurrencyCode": "USD",
"productId": "one_session",
"subscriptionPeriod": "P0D",
"title": "one session",
"type": 0,
}

What Google Sheet function can i use to Calculate Cash on Hand?

I have a google sheet which is like a register where I keep all purchases for a business. I have purchases made with different types of methods. I would like to specifically be able to track the amount of cash on hand at all times. I have a sheet I have created that already calculates other stuff by formulas. Here is a Public link to a demo version:
https://docs.google.com/spreadsheets/d/1mArgTCpxYajmk2bOkE3aIaDTevajYxvsQW5P2cJbb8k/edit?usp=sharing
What I need exactly is a formula that will subtract cash purchases from the on hand balance calculated by adding the Replenishment column then subtracting from the Costs field but only if its a cash purchased item.
=IF(D4:D="Cash"),=Sum(L4:L) - Sum(F4:F)
Cash on hand to reflect actual amount and deduct cost amount of cash purchases.
Why anyone would want the result escapes me but, where the row contains Cash in ColumnD:
=sumif(D:D,"Cash",L:L)-sumif(D:D,"Cash",F:F)
will add the ColumnL values and subtract the ColumnF ones.
=sum(L:L)-sumif(D:D,"Cash",F:F)
would seem to make a little more sense.

Google Place API Fetch List of Restaurants with food type

I am developing an iPhone application in which i want to fetch the list of Restaurants with user choice food types. For Example Indian, Iranian and Chinese and many more.
As per documentation Food is depreciated. How can i accomplish this task?
Well, based on the documentation, you still have almost 4 months left to use the type food in your request. Because it is noted here that the types finance, food, general_contractor, grocery_or_supermarket, health, place_of_worship will still continue to be supported until February 16, 2017.
I think the alternative way that you can use with this after the deprecation is use the type=restaurant and use the optional parameter keyword.
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&type=restaurant&keyword=chinese&key=YOUR_API_KEY

Currency of in-app billing transaction

I see that the response I get from Google Play after the user had purchased one of my in-app products contains the following information:
Description, ItemType, Json, Price, Sku, Title and Type
Price is a string that contains the currency and price. eg: "€1.17".
I would like to get the same price information in a more structured way and separately. Something like a three digit ISO code of the currency and the price in numeric format, without having to parse the string, which would have been ugly and unsafe.
Do you think that there is a way to do this?
Check price_amount_micros field.
Price in micro-units, where 1,000,000 micro-units equal one unit of
the currency. For example, if price is "€7.99", price_amount_micros is
"7990000".
More here: In-app Billing Reference

How to sum up different currencies in Rails app?

I am currently building a Ruby on Rails invoicing application that is multilingual and supports a range of currencies. In the dashboard view all invoices a user has produced are totalled.
Now it would be nice if a user could choose the currency for each invoice.
But how can those invoices be totalled if different currencies are used?
E.g. if these three invoices were created today:
Invoice No. 1: $1000.00
Invoice No. 2: $2000.00
Invoice No. 3: €1000.00
Total: $4333.60
----------------------
The dollar-euro exchange rate would have to be based on each invoice's date of course.
How can this be achieved in Rails and does it even make sense?
Thanks for any pointers.
The sum of of multiple invoices using different currencies is not a single number, it's a collection of numbers. If you have a 20 USD invoice, a 15 EUR invoice, and a 20 EUR invoice, the sum is "20 USD + 35 EUR".
At the time when a payment is made from a single account using a single base currency, then a conversion will be performed to determine how much will have to be paid in that currency to cover the total converted costs. Presumably, there will also be currency conversion fees added at that time.
It would be convenient if you change the currency to a single one, either euro or dollar right when the user makes an invoice. That is, you save the 'converted' value in your database. In this way you won't have to lookup for past day rates.
Eu_central_bank provides exchange rates.

Resources