A microservice architechtural interview task - rest

I am looking for a job as a system analyst and in interviews I come across tasks like this.
Imagine that you are working on a credit scoring system that decides whether a user is creditworthy. The user fills an application form and receives notification (say, in SMS) with the scoring result. Apart from the data provided by the user the system utilizes their credit bureau information.
What questions will you ask to clarify the task and what microservices will you propose to create for this system?
It is obvious that the solution I propose is too simple or not enough detailed, so I will be most grateful for the help.
I usually suggest that there will be 4 microsevices:
Service requesting information about the user from the bank database;
Service requesting credit bureau information;
Service performing scoring;
Service sending notifications.

Some questions that come to mind about clarify the task. Would be...
What is the intended use of the credit scoring system? Is it intended to be used by a financial institution to decide whether to grant a loan, or is it intended for some other purpose?
Who will be responsible for maintaining and updating the system? Will there be a dedicated team of developers and analysts working on the system, or will it be the responsibility of a single individual or department?
What data sources will be used to generate the credit scores? Will the system rely solely on information from the user's credit bureau, or will it also incorporate data from other sources, such as bank account information or employment history?
How will the system handle users who do not have a credit bureau file? Will there be a process in place to handle these cases, or will the system simply reject these users?
Based on the information, I came up with the same microservices as you.
A user data service that stores and manages information about users, including their personal and financial information.
A credit scoring service that calculates credit scores based on the data provided by the user and other sources.
A notification service that sends SMS messages to users with their credit scores and any other relevant information.
A data integration service that manages the flow of data between the different microservices and external data sources.
This is just one possible solution, and the specific services involved would be dependent on finding out more information on the business requirements.

Related

Is it somehow possible to get transaction details from any paypal user using my service?

Assume the following situation:
I have a 3rd party service offering some kind of analytics/report/whatever... on a paypal user's transaction history.
Is it possible to fetch payments (only amount - in case that matters) of private paypal accounts (ofc assuming they somehow granted access by registering to my service), even though they didn't buy anything of me directly?
I hope the situation is somewhat clear, unfortunately I coulnd't find any matching questions on the web.
Thanks in advande!
It's easier to download activity and import a CSV than to query transactions via API, but there is a Transaction Search API that can be used.

Google analytics and different domain tracking

I asked this question directly to the Google Analytics community with absolutely no answer.
The question is as follow:
I have a AI based site, which give a customer a specific aid to select the right product he/she want to buy. The front ed application is React/js based.
My site is usually a small icon on a merchant site, and the user, while he/she is navigating the merchant site, can decide to recall clicking on a specific icon.
Then my site opens and help the user to select the right product(s) belonging to the merchant site. The product are choosen and then clicked to be added to the merchant cart.
Of course, there is a written agreement between the merchant and I to be signed, and some changes to the merchant site to incorporate my clickable icon: I'd like to pass a piece of code to the merchant including the icon and all the code needed to implement this kind of application.
So, given that the merchant call my site passing a specific transaction related token and the customer info (if any) when the user click on my icon, how can I:
directly add one or more items into the merchant cart
track the action made by the user after he/she leave me site and return to the merchant one to conclude the journey with a payment, so I can later invoice the merchant for the right commission
track if the user remove some (or all the) item from the cart, so I have less to nothing commissions to invoice.
I tried to follow the instruction given by google, but they are a mess, and I wasn't able to reach any conclusion.
Any help will be really appreciated.
Adding items to the merchant's cart is possible using some live API that the client would extend, but the easiest way to do it would be just using the window.postMessage(). So, I would suggest having your button implemented as a simple iframe. That will make it possible for you to send messages to the parent page from that button. The parent page, however, has to be ready to listen to those messages and add to cart whatever ids you specify. So the client devs will have to do some implementation for this to work.
Well, no, this is a bit too much to ask for. You can ask the merchant to share that data with you so that you could improve your algos (tune them for the client) and, therefore, improve the merchant's conversion rates (which is a win-win scenario), but the merchant would have to actively either implement parallel tracking to your instance of analytics (install your pixel, if you're willing to develop one), or share their own data with you.
That's what a lot of very similar services do. Let's say, Facebook. Facebook sells traffic. When you buy traffic, you generally don't want to pay for irrelevant/badly converting tracking, so you're implementing so-called facebook pixel. Facebook doesn't do this implementation. Client's developers/implementation experts implement it and trigger various events through it, making it send signals to the FB endoint, indicating which client this is from, for which campaign, what the action is page load, purchase, add to cart... Just take a quick glance at FB documentation: https://www.facebook.com/business/help/402791146561655?id=1205376682832142
Facebook is just an example. There are many-many services that do similar pixels. It may be not about selling traffic, it may be about adjusting site look and feel based on AI, or generating discounts and customizing conversion funnels, or even simpler stuff like feedback chat performance and suggestions modules. All these and more exist as third parties and pretty much all of the established ones use pixels for tracking.
If you don't want to spend time at the moment to make your own tracking logic, then implementing a parallel GA tracking will be a pain for you (for your clients, actually). Instead, it would be easier to enrich their data with your products. Let's say, have them implement a product-level custom dimension that would "paint" products added to cart by you and share the data with you.
Note that a client who goes for it must be a very loyal client since analytics data is normally treated as sensitive and is not readily shared with third parties, not mentioning the implementation of a custom dimension (or the using the expensive product parameters) just for a third party to count their conversions. Yes, it has to be a good friend that allows this.
Finally, you could ask them installing your GTM instance or giving you access to theirs, but that would effectively give you the power to execute arbitrary code on any of their page. I would never give a third party that power.
Tl;Dr: I would suggest making your own very simple pixel. Even though it sounds now like a lot of work, it will worth it if the project itself has real potential to be useful for ecommerce.
Exactly the same as 2.

Precisions on Email Audit API by Google

I want to monitor employees interactions inside companies. In the case the company is using Gmail, I was thinking about using https://developers.google.com/admin-sdk/email-audit/.
But i still have some questions regarding the "lawful" purpose and I'm wondering if Email Audit is the right API if my purpose is to monitor in real-time emails knowing there will be at least 10 000 emails/day to monitor.
If you check the Usage Limits and Quotas:
Limits and quotas protect the Google infrastructure from an automated process that uses the Email Audit API in an inappropriate way. Excessive requests from an API might result from a harmless typo, or may result from an inefficiently designed system that makes needless API calls. Regardless of the cause, blocking traffic from a specific source once it reaches a certain level is necessary for the overall health of the Google Apps system. It ensures that one developer's actions cannot negatively impact the larger community.
To answer you question, if your goals falls under this description - Google Apps Email Audit API Developer's Guide:
The Google Apps Email Audit API allows Google Apps administrators to audit a user's email, email drafts, and archived chats. In addition, a domain administrator can retrieve account login information and download a user's mailbox. This API can be used only for lawful purposes in accordance with your Customer Agreement.
Then the answer would be yes, it is the appropriate API to use. If you are thinking about the 10000 emails/day, you might want to check if it is reasonable to ask for quota increase.
Hope this helps!

Questionary and user oriented CMS with subscription support

I'm looking for the CMS to run subscription service.
customer signs up and fills in preliminary question-form
customer can subscribe to receive informations based on the question-form and other question-forms filled periodically
admin is able to create new question-forms, send it to specific customer and based on his response send him an information
customer can see the admin's response in his dashboard
Some of the key features are:
user management
subscriptions support (Paypal, payment cards)
JSON API to connect the mobile iOS/Android application to the system
analysis atc.
I know there are Drupal and Joomla or commerce systems like Magento. But is there any CSM that will fit my needs?
I think that correctly modified WordPress would do the trick.
You will have to extend it's functionality with plugins. There are some nice ones for PayPal subscription and advanced Q forms making. Built in functionality will allow you to manage users and additional plugins of either your or others authorship will allow you to easily connect with JSON POST/GET requests depending what your specific needs are.
WordPress is very neat, has a great developing community, and you may create beautiful designs with it.
But system like Joomla is also very "customizable", with enough time spent you will have the features you need.
I'm sorry if that's not what you were looking for, but there will never be a 100% match to features you have specified.

It is possible to manage users/identities in a data store that exhibits eventual consistency?

Is it possible to create/store user accounts in a data store that exhibits eventual consistency?
It seems impossible to manage account creation without a heap of architectural complexity to avoid situations where two account with the same UID (e.g. email address) can occur?
Do users of eventual consistency stores use a separate consistent DB as an identity store, or are there solutions/patterns that I should be exploring?
Thanks in advance,
Jamie
It is possible to do use management in an eventually consistent data store. We do it. It works under the following assumptions:
Conflicts shouldn't happen and when they do there's a clear path to conflict resolution. If the account ID is a person's email address, then if two separate people try to register under the same email there's a bigger problem here. What we do in this case is block both new accounts as soon as the conflict is discovered and send an email to the address in conflict explaining to the user that there's an issue (possible fraud). You can either ask the user to reset to the account or ask them to contact support.
Repeated access by the same user within the timeframe in which the data is inconsistent go to the same replica. For instance, if a person just registered and the next request is a login, you must validate that login against the data replica where the new registration details exist. So if the eventual consistency is due to multiple data centers in different geographic locations and under normal conditions a request goes to the closest data center geographically, you're OK.
There are some edge cases, such as if a user registered against one data center, then that center crashed, and now the user cannot login even though he still can see the application - served from some other data center. You can calculate the expected frequency of this case based on your number of daily new users and average data center downtime. Then decide whether it's worth worrying about one user in a (million/billion/whatever your number is) having a problem and possibly contacting support. I faced the same decision not long ago and decided that from a cost-benefit perspective the answer is no.