How do I get departure country through SP-API as a Seller? - amazonsellercentral

I would like to know if there is any way to know from which country is departed a FBA order.
Downloading a VAT Transaction report it is possible get this information but it is only possible from previous month not from current one.
Does any one know if it is possible use any SP-API functionality for this propose?

Related

NEAR Marketplace - Timed Auction Functionality

We're building a marketplace in NEAR. We have two smart contracts for token and marketplace. Same as NEAR example.
In our platform, we have successfully implemented below features:
Token mint (used contract method: nft_mint)
Token listing for sale at Fixed Price in marketplace (used contract methods: storage_deposit nft_approve)
Token purchase (used contract method: offer)
Apply creator royalty at mint time.
Apply service fee (Transaction fee of Marketplace) on each sale.
Everything is working fine.
Now, we would like to implement the Timed Auction Functionality
Creator can create NFT’s to be sold as an auction so that buyers can bid on them to get a higher price.
Method:- Sell to the highest bidder: where the highest bid wins at the end.
Making a bid on this kind of auction is like making an offer on a fixed-price listing. The seller can choose to accept it at any time, but the buyer will near of the amount of bid to create a bid.
Questions:
How we can implement the Timed Auction Functionality with Marketplace
Contract?
Do we have any documentation or example for the
Timed Auction Functionality?
Example of OpenSea's Timed Auction Functionality:
You can't do that directly from within a contract since the contract does not run all the time you will have to call function trough something like https://cron.cat/ or your own.
Contracts perceive time trough current execution so when a function is called env::block_timestamp_ms() within said fn would give us the current time of execution, you can subtract time from it to get some time in the past. We can do manual checks like is the time stamp past this than do that or the less accurate is the blockheight above certain threshold but all this will have to be executed within a function that needs to be called.
I will preface this post by saying that this is how I would go about solving this in a simple way. There are more complex solutions out there but I'll try and keep it relatively simple. (scroll to the bottom for a TLDR).
Here's a solution to the timed auction functionality. In the marketplace example that you posted, what you'll want to do is store two extra fields in the sale object indicating the desired length of the auction as well as the time when the sale was listed.
Whenever NFTs are put for sale (in the nft_on_approve function), you'll need to add the current block_timestamp (which will give you the number of nanoseconds since the Unix epoch). You'll also need to store the desired length of the auction which is up to you as to how you would like to implement that. It can be time in nanoseconds, milliseconds, seconds, days, either since the Unix epoch or the actual desired duration of the auction.
Once your sale object contains both these new fields, all you would need to do is whenever an offer is made, check if the current block timestamp is within the desired auction length. If it is, proceed, if it's not panic. Since the marketplace can't constantly be polling to see if the auction is finished, a common approach is to use the functionality I described above:
You either bid on the NFT before the timestamp or you didn't. If you did, your bid is accepted, if you don't, it panics.
At this point, there is no way for the marketplace to automatically transfer the NFT to the highest bidder the second the auction closes (due to the marketplace's inability to poll). My suggestion here would be to have a claim function that the highest bidder must call if they want the NFT transferred to them. You can get spicy with this and have timeouts whereby if it isn't claimed within 5 days, the original owner can claim it back but for the sake of simplicity, let's not get into that.
As for the bidding mechanic, there's many different ways you can do this. I'll go over one of the more simple approaches. Currently, when a sale is listed with sale conditions, the NFT can only be purchased for more than or equal to the price as shown here. What you'll want to do is store active bids in the sale object.
You'll need to store both the current highest bidder as well as their bid amount. This will be initialized to empty when the NFT is listed and then once an offer is made for less than the desired list price, it's considered a bid. Bids will only be added if they are less than the desired price and greater than the highest current bid. If the offer is more than the list price, the NFT is automatically sold and the purchase is processed.
Combining everything I've outlined so far in a TLDR:
What you would need to add as a minimum PoC to the sales object:
Store desired length of auction (in whatever format you want)
Store date of listing
Store current highest bidder
Store current highest bid
Listing mechanics:
When a sale is listed, set the date of listing and the desired length of the auction.
Offer mechanics:
make sure the attached deposit is greater than the current highest bid (if none, make sure it's >= 0).
If the attached deposit is greater than the list price, process the purchase. If it's not, add it as the current highest bid.
Make sure that the any offers are made within the desired length of the auction. If they aren't panic, if they are, you're good to go.
If somebody is outbid, make sure you refund them for their deposit!
Claim mechanics:
Claims can only be made if the auction time has passed. Only the highest bidder can claim the NFT. Once claimed, the purchase is processed.

Can we validate date in Amazon Lex?

I have created a Hotel Management lex bot that makes a reservation for hotel rooms. I am using slots (Check-in Date and Check-out Date). I am using built-in slot that is Amazon.Date.
Problem
I want to restrict customers at this stage so that customers can only enter date that matches with the current date or after the current date. Currently, these slots are accepting all dates including previous dates.
How I can validate these slots? (Can we solve our problem with RegEx while using Amazon.Alphanumeric type)
What are the possible solutions?
Should we handle this in Lambda? (If yes, kindly describe how I can get the Elicitation value of a slot in Lambda (Python)).
What would you prefer me to resolve or achieve this?
Any help would be greatly appreciated and thanks in advance.

Retrieving Card details from Square Customer

I'm trying to create a recurring payment on Square, ala Stripe subscriptions. However, I am having trouble retrieving a customer's card information (specifically customer_card_id) to pass into Charge.
Our flow is such:
A customer visits to our store and subscribes to a membership, which we process via the point of sale app.
We continuously poll Square to retrieve payment information, and create membership records appropriately.
When the user's membership period expires, charge them for the next month's membership.
When researching RetrieveCustomer, I find that there is a cards property under Customer, but iterating through all the Customers under our account, they all have cards = None despite us having taken card payments via the point of sale app.
Also, looking at ListTransactions, there doesn't seem to be anything that might be customer_card_id. The IDs I see there are tender ID, location ID, and transaction ID. The card_fingerprint also looks promising but that doesn't seem right either, since a card can have both an ID and a fingerprint.
Am I missing something? Where might I find customer_card_id?
EDIT
Looks like I was dumb and my local instance of our application was just out of date with transactions from Square. After updating my data with customers we've processed since the last time I updated, customers with a non-None card property now show up. tristansokol's answer below is still valid however.
How do you process the first charge? You need to explicitly add the card on file, it won't be added by default from processing a transaction from a customer. See: https://squareup.com/help/us/en/article/5770-use-card-on-file-with-the-square-point-of-sale-app

tableau use either Country or State (only if country = usa) field as filter

I am trying to display travel expenses by location in a Tableau map. If the country = USA, then I want to filter by State, else filter by Country. I can do either or but not both on the same map. Where would I put this criteria?
I am new to both Tableau and to this website. I have tried to upload an image but was told my reputation needed to be a 9. Is there any other way to share information? Possibly dropbox?
Here is a link to my workbook:
https://public.tableau.com/profile/publish/Travel_country/Sheet1#!/publish-confirm
Well, it's pretty simple then. You can use both [Country] and [State] as filters. If you try to filter by state on a country different from US, nothing will happen.
If you have Tableau 9.0, you can even make the Country filter influence the State filter, meaning, you will only see the State options if you select US in the Country filter.
If you need anything different, please clarify

Saving to a model related to another instance of this model in CakePHP 1.3

I'm relatively new to cake, and once again I'm having to work around how it does things to get what I want. I'd really love to find out the "correct" way of doing what I need.
I'm building a "performance" system, that's used each month to review how someone did against their goals from last month.
This month's review sets new goals, and also records the result against last month.
I have a Review model, which hasMany Goals.
In the edit view for this months Review I display some data from last month's Review & some fields from the Goals related to last month's Review.
I need to save the result for each of last months Goals, as well as to be able to set this months Goals too - so I'm saving data to Goals related to the current Review, as well as another one.
When I try to save the "unrelated" Goals, CakePHP forces the review_id to be the id of the current one - I even tried looping in the Review::afterSave callback and checking each review_id - although I can send the right review_id value to Goal->save, the database still gets updated with the current Review id, rather than the one I set.
Can anyone tell me the "cake" way to save to models related to another instance of the current model? Is this even possible?
Ok, this may not be the most efficient way of doing it - but I'm on a deadline.
So, instead of retrieving last month's Review, I created another "hasMany" relationship, using a finderQuery that has a subselect to find the ID of the last months query, and use that to select the Goals with that review_id. It uses {$__cakeID__$} to find the ID of the current Review as explained here:
http://book.cakephp.org/view/1039/Associations-Linking-Models-Together#hasMany-1043
Because everything's related to each other in a way that Cake understands, things just update automatically on saveAll.
It means I have a ridiculous subselect query relating the last months Goals to this months Review, but it works.
One day I'll figure out how to optimise it so it doesn't make my database cry....

Resources