Can we validate date in Amazon Lex? - aws-lambda

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.

Related

Is there a Timetable Calendar with Holidays which i can download or generate?

I am searching for a complete Timetable Dimension.
What should be included?
Days
Month
Week
Holidays(for several countries)
I searched a long time, and I think the difficult thing are the holidays.
What is my goal?
I want to use it for Stock Price Prediction.
If anybdody knows where to download a Timetable/Calendar or someone can show me a Code (Code language not relevant, because i use KNIME as universal tool) it would save me a lot of work.
Thank you!
As a base, you may want to use a KNIME node to generate a calendar table: https://hub.knime.com/knime/extensions/org.knime.features.base/latest/org.knime.time.node.create.createdatetime.CreateDateTimeNodeFactory
For the CW number, there is also KNIME workflow available related to this node.
Finally, Python might be your best friend for the holidays: https://github.com/dr-prodigy/python-holidays

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

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?

Square API - Changing Charge Dates to CaptureTransaction Dates

We're using the Square v2 API.
We're setting the delay_capture field to true in our charge API calls. When we then call the CaptureTransaction for that charge, the date of the transaction is the date the original charge call was sent.
Is there a way to set the date of the transaction to the date the CaptureTransaction call was sent rather than the original charge date?
I don't see any support for this in the documentation but I figured I would ask.
Thank you.
No, you cannot change the recorded dates. I'd recommend using another database to store this additional data and just key on the transaction id.

design of car booking application using elasticsearch

I need some help in designing car booking application.
There is a document with information about car (title, model, brand, info, etc.)
Problems I'm stuck with are:
How to store available booking days? (I suppose I could use nested
free date range objects in array)
How to store price per day (it's possible to have individual price
per day)?
Booking days and prices could change often. So the third question is: "how to update them cleverly (partially), so I shouldn't read the document, and then store it". I'm looking at script solution using
update api (http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-update.html), but it looks ugly. Maybe there are other approaches?
Thanks,
Alex
with the introduction of the range datatypes, there is no need to use a real nested object, if you meant that.
That might also help you with storing the prices, but that could just be any object I suppose (it depends if you want to search for that as well).
Update API was made for exactly that use-case, that you do not need to get the whole document, so that shounds like a plan.

How do I restrict a users access to an object?

Hi Sitepoint wizard people,
Say we have an admin application that has multiple users and various objects. What I'd like to do is control access within the object itself - that is, it will behave one way for one type of user, and another way for other users. For example...
Director Mike can override Reception user Sally's registration date. One would assume that Mike could set any date both in the past or in the future. Then we have Payroll user Steve who can also modify Sally's registration date, but only for dates in the past up until (for example) one year ago. To spice things up, then we have the HR Manager Mary who can also amend Sally's registration date, but only for dates from precisely 23rd June 2007 up until one month from now...
How can I program the access restrictions so that on the front end, the form control is restricted with a min and max date, and in the backend, the validator checks the entered date to make sure it falls between those dates? I'd obviously need to be able to tweak the min and max dates for each user type. Other objects might have different parameters - maximum amount on a discount field or days of the week for overtime, for example.
I've asked this question in different ways, but each time I get bogged down by the implementation. I'm currently developing it as a php/MySQL web-based application, but thoughts and comments from other platforms very welcome! This time I'm looking at first principles, so it doesn't matter what your background is, if you have any ideas, please let me know! What do you even call this type of access control...?
Depending of how you application is based, you could ask for credentials at the start of the application and depending on who is requiring access, you could load a different xml file containing different settings.
As for security issue, make sure that the different xml files can't be reached by the users.
Edit:
Since you are using MySQL you could do something like this.
Let's say you have a table of users that has those fields : UserId, UserName, RestrictionId.
And with a Restriction table that looks like : RestrictionId, FieldName, FieldCondition.
This way, in your php app, when a user is authenticated, you can go fetch the correct "Restrictions" on the field and apply them in your code. If it happens that you have multiple fields that require different rules then you can simply add them with the correct RestrictionId.
This DB design is far from perfect, I'm pretty sure you can do better
Since, you are already using MySql db. You can maintain the UserRole Master table details in DB itself. Load the user role data based on login, then you can easily validate the changes made by the user accordingly.

Resources