linking an object from one data service to another data service - javascript

i have a project i am working on
the requirements are to build a service to manage customers
the service has the following functionaltiy
Create Customer
Find Customer by Id
Update Customer
Delete Customer
each customer has and id, Name, Email, Address and related credit card tokens
When Customer is created it can be linked to one or more credit cards
and when updating a customer it can be linked to a credit card
The Credit Cards are managed in a different service (one that is not built by me) that i know nothing about (can make some assumptions)
The service i built is a web api project with an sql server database
i used asp.net entity data model for that and i implemented all of the CRUD operations using the rest api
my question is how can i create the link between the 2 services to allow me to link a credit card from a different service to my customer.
the requirments are that if some one wants to view the data of the credit cards it will need to use the other service so i dont need to have access to the credit card data, only to allow to link a credit card to a customer
any ideas on how this can be done?

Unfortunately your question is a little ambiguous and, after reading your comments, it seems your question is essentially asking how to "link" to a different service, which does not exist. If you don't know anything about the other service (and certainly if it does not exist), it will be very difficult to help you "link" to it.
You mentioned that the other service may be developed. In that case, I can suggest the following:
Connect to the underlying database that the external information is being stored in, much as you are connecting to your own database now (see connecting to databases in mvc for more information)
If you are not granted access to the external database, you will most likely utilize some form of web service to make queries against the external database (see consuming web services in mvc).
From your backend, the logic basically goes: access their database or call their web service, get the id for the credit card and either pass that id through or generate your own (internal) unique id for a credit card (and creata a separate table that stores the original id as well) and associate that with your customer (in an array or object, etc). That way, when you need to retrieve credit card information, you have your customer entry with the information (id(s)) of any associated credit cards. You can use that information to query from the external service to get the required credit cards and then combine the information

Related

Pull data from CRM online using Web API

I've created a webpage that will be used as a survey for end users to submit a review of how the helpdesk technician did with resolving a ticket. I've built the webpage using HTML, CSS, JS, and PHP. The page currently needs to pull 2 things from Dynamics 365: Users name and the company. I currently pass the ticket # via the URL which I plan to use as the value in a lookup (somehow).
I think that I need to use the Dynamics API somehow to get access to pull data from the form but I am not sure how to go about that. I found this post online https://functionalthoughts.com/dynamics-365-web-api-retrieve-data-javascript/
which I think is only for web resources created inside of CRM.
Here is an image of what I currently have:
Image
and the value that I have passed via URL Image2
The end goal would be to pull the value of the name and company fields in Dynamics 365 Online.
Without full context of your application, I can only give you high level pointers.
Before anything,
You need to authenticate to Dataverse (the engine that is hosting the data your after). That means you need a an identity + JWT Token to auth.
This is the more complicated part, depending on how your managing access to your site and if your intending to allow dataverse to manage data access security.
To do that, in php, your going to want to start here: https://learn.microsoft.com/en-us/azure/active-directory/develop/reference-v2-libraries#web-application and read up the Python path for MSAL.
Once you have that you will either use a S2S app ( ConfidentialClient app ), or user identity auth ( publicclient app. )
For explanation sake, I am going to assume that you created a Confidential app to work with. In Dataverse this type of login identity is called an "Application User"
Now you need add the application user to Dataverse and grant it permission to read the data you want. You should work with the admin of the dataverse instance to get that setup. if your trying to solo it :) there is a good blog on how to do this here: https://powermaverick.dev/2020/08/10/create-application-user-in-dataflex-pro-cds/ Dont forget to grant your user a security role that can access the data your after.
Next,
You said you want to query by Ticket ID, again assuming that ticket id is in dataverse, you need to create an alternate key for the field that contains the ticket to be able to query on it.
you can find info on how to do that here: https://learn.microsoft.com/en-us/powerapps/developer/data-platform/define-alternate-keys-entity
Ok, now that you have a user to work with and can create a token, and you have an alt key on the column your trying to query on, you just need to form the query to dataverse.
General info on how to form and call queries in dataverse can be found here https://learn.microsoft.com/en-us/powerapps/developer/data-platform/webapi/query-data-web-api a specific example of retrieving via alt key can be found here: https://learn.microsoft.com/en-us/powerapps/developer/data-platform/webapi/retrieve-entity-using-web-api#retrieve-using-an-alternate-key
Now that you have all the setup done, and once you have formed your query, you will need to generate the token and add it to the authorization header of the request and send over.
That should get you data back.

PayPal api: How to get orders of user by users email?

I want to give some benefits on my site to users who made an order or have active subscription with my merchant account.
I have nodejs server but cant find the way to query paypal for list of orders of my merchant account.
PayPal would recommend you keep your own records of orders placed by a user; they are a payment processing service, not a data service, and do not want you querying their servers for this type of information.
They do offer downloadable activity logs in the www.paypal.com account interface, which can be obtained in .csv format. But that is for accounting and reconciliation purposes, not something you would want to run a script against.
Basically, you really ought to keep track of your own users' orders and active subscriptions if this information is important to you.

PayPal Merchant API - Getting Products Information

New to using PayPal, and had a general question regarding what it can provide.
The need is to enable someone with a merchant account on PayPal to login to a website (meaning the api should probably be in javascript) and then get from the API information about the products the merchant supplies.
Does anyone know how this can be done?
Sincerely,
-Lior
PayPal doesn't have any way to store actual inventory data. If you process orders with item details included then you pull those details using GetTransactionDetails.
If you're using the Button Manager API you could create individual buttons for different products with inventory tracking enabled on those and then you could potentially pull "inventory" data by pulling the buttons. I wouldn't recommend that, though.
Really, the best thing to do would be to manage your inventory in your own system of some sort.

Building an HTML Widget to embed paid content - how to secure communication with the backend?

I'm creating a widget that shows content when the page visitor pays for it. I'm handling the payment form inside the widget and I'm using Stripe for credit card handling, charges, etc.
My problem is: I want to make it easy for the user to pay for the content, right now, I'm my working proof of concept I only ask for the email, then:
Check if I already have this email on my system, check with my API server if it has a payment for this product associated and then let the user get to the content.
If the email is not present in the system, it is created, and return only the Stripe publishable key.
If the email is present, but it has no payment associated with this product, simply return the Stripe publishable key.
When the widget gets the Stripe key, then it shows the payment (credit card) form, which is used to get the Stripe token, and this token, along with the email, is sent back to my API server. If everything is Ok, then the widget retrieves the content and shows it to the user.
Now, the question(s): How to secure the communication between the widget and the server, besides using HTTPS? I already have support for application id/secret pairs, how can I use them to to authenticate the requests from the widget to the server? The widget will be inserted in pages on arbitrary domains, so using the Referer/Origin headers is out of the question.
I don't think that is really important, but if it helps, I'm using Django 1.7 and Django Rest Framework 3.0.5.
Thanks!
There is an api you can use, called CoinTent. Its sub-motto is "Purchase individual pieces of content for small prices with one account and one click." HEAD HEAD HEAD HEAD...

Amazon Product API with meteor

I would like to make requests for ItemSearch using Amazon Product Advertising API with meteor.
http://s3.amazonaws.com/awsdocs/Associates/latest/prod-adv-api-dg.pdf
https://images-na.ssl-images-amazon.com/images/G/01/webstore_t_d/API/WebstoreAPI_SearchProductUsersGuide.pdf
Essentially, I would like the users on my web application to search and select books that they have read which will then be displayed in their profile.
As the user types in the field, I would like the api to return a limited number of suggestions. When one item is selected, I would like to store the title and author of the book and url of the books' advertisement page on amazons website.
I have been sourcing the documents and branching out from the following two links. I am beginning to understand in an abstract way of how the error and data callbacks work. Everything I am reading is abstract.
I need to help in setting up the searchItem feature which falls under Amazon Product Advertising API
. I will limit the search index to the 'books' product category. According to amazon, I am effectively advertising for amazon in my use case so I joined their affiliates program https://affiliate-program.amazon.com/
But really, my use case intensions are for my users to list books they have read on their profile page. I need to capture 3 data points (title, author, and, url of the advertising page for the book on amazon.com).
Has anybody attempted to use this API? If so, please can you shed light on how you set up to make requests to the API in meteor.
The Amazon Product Advertising API does not fall under Amazon Web Services, but instead, Amazon Associates.
The AWS SDK does not support non-AWS services (including other Amazon services), and likely never will. You'll need to find an entirely different package for hitting the Amazon Product Advertising API.

Categories