Paypal Express Checkout / React - Send Product Information - javascript

I'm working on a shop app that I want to use Paypal with to checkout.
I have installed this very nifty React implementation of the Express Checkout Button - https://www.npmjs.com/package/react-paypal-express-checkout
After setting up my merchant account, developer app, and sandbox accounts it was working right away.
The only issue I'm running into is that my app has a built-in cart; Keeping track of what items the user intends to purchase and what options they have selected for each one ( Color, size, quantity, etc ), and the seller needs to know this information so they can ship the correct products.
I was wondering if there is a way I could send some additional information with the purchase to let the seller know what products the user has purchased and what options they have selected. If somehow I could just send one extra string to appear in the seller's account I could easily attach the user's cart info.
Sorry if this is a noob-ish question. I am still fairly new to web-dev.

So I found in the documentation that you can send a table of items using item_list. With each item you can attach a name, as well as a list of options ( size, color, etc,. ) But I cannot find how to format this list in the documentation, and no one seems to know.
So as a workaround I am just attaching the options to the name so the buyer and seller can see a full list of every item and their options.
Here's what it looks like in your paypal transaction -
If anyone needs to use this I forked the node package above and implemented this functionality. Hopefully this can help someone trying to implement paypal into their react shop.

Related

Looping with Firestore querying [Web/Javascript]

How would I go about setting up a loop to query through my Firestore database structure? I don't believe I'm allowed to post pictures or links yet, so I'll try to give some path examples here. Note that there is a lot more to it than these examples.
Rating->Arrow->Arrow-Rating->(user ID)->(data fields)show_name, user_id, rating
Rating->Arrow->Arrow-Rating->(different user ID)->(data fields)show_name, user_id, rating
......
Rating->Flash->Flash-Rating->(user ID)->((data fields)show_name, user_id, rating<br />
......
To give a quick rundown of what this is all about, I'm trying to develop a mock site (with functionality) for a project, where I can display user created information (user info is created from a concurrently developed Android application) such as ratings.
Basically what I'm trying to do is get and display the average rating for each show, by getting each 'rating' field from each user in the respective "Rating" paths... i.e., getting a user rating from each show (Show-Rating->User ID/(data fields)), going to the next user from the same show, and then going to the next show and doing the same.
I'm just not entirely sure how to start going about this.
I suggest you use a cloud function that listens for changes in the ratings node. Use OnUpdate listener
Store every movie rating in its own node, and only query that node for the rating
This will reduce a lot of computation on the client side and will also be more efficient
Use this guide that describes a distributed counter

React Native - OneSignal Push Notifications concept setup with conditioning

I have created a school app which shows the students about the class if it is going to take place or not (Like substitute plan).
In the app, students have two options in the settings, first to select the class (I send the selected class as a tag in OneSignal) and then to select the courses they have in that class (The courses are stored in app local storage in an array).
Now I use these settings that the student has set (the class and the courses) to pass it as a parameter in my API to get the filtered results, and it is also working good.
The problem is just now how should I notify the students when there is a new result or an update?
I did notifications setup only for classes and it is working, first I compare the results and if there is any new result in the new and previous state, the students selected that class will be notified.
But now I also want to apply the course's condition, that if the student has selected any courses then my server side (server side is in PHP) should first check for an update of the selected class and then only send the students the notification which has selected that course, and if the student has selected many courses and there are more than one update for the selected courses only one notification should be sent.
Many Thanks in Advance! I hope I was able to explain it.
as far as i understand u want to select a subset of students dynamically. can we register all students for notif and then call the onesignal api on a subset on the fly?

SMS Personalization using AMPScript in Salesforce Marketing Cloud

My CRM team is running into problems when attempting to personalize SMS using AMPScript. The syntax used is as follows:
%%[
Var #subscriberKey
Set #subscriberKey = _subscriberKey
]%%
%%= v(#subscriberKey) =%%
Thank you for signing up for a 45 day risk-free hearing aid trial! One of our expert hearing consultants will call you soon to discuss next steps. During this call, we'll discuss your hearing loss situation and go over the details of the 45 day risk-free trial. We look forward to speaking with you shortly!
I have created a data extension in Marketing Cloud with just me in it, and used it on a journey that sends a text message with this content to my phone. The text message delivers, however the personalization content is not in there, just the plain text is shown. Of course, once the personalization works, we will change it so that other information is in there and not subscriberKey, but for now it would be a ton of help to know why the syntax is not working when it should.
Kind regards,
Michael
you will need to add the personalized field i.e. First Name/ Subscriber Key/etc in the following format %%FirstName%% . This field is actually picked up from the Attributed which are linked in your Contact Builder. Look for Mobile Connect Demographics, make sure these attributes which are trying to add in personalization are present there.
Now next step is how to link your information from your Master DE to the MobileConnect Demographics, for that u need to create an Import Activity from Contact Builder, and Import these details in a Mobile Connect List.
Hope this helps.
Mobile Connect Lists are different from Emails Studio Lists - Keep this in mind.

How could I manage permissions of jhipster's authorities?

I am coding a webapp using JHipster code generator.
I created 2 extra roles, now I have 5 in total:
ROLE_USER, ROLE_ADMIN, ROLE_ANONYMOUS, ROLE_PRESIDENT, ROLE_VICE_PRESIDENT
I was wondering how could I manage their permissions to show some RESTs.
For example, I would like to let the PRESIDENT add new users to database, other simple users should not see the web service that do the work.
Is there a file that I'm ignoring by mistake that could help me with this feature?
Giving thanks in advice for your precious time,
Manuel
Adding new roles to JHipster needs to be added in 2 places.
The obvious one is the AngularJS frontend. To add your new role to user edit view, you add them to the select options in "user-management.controller.js" at vm.authorities = ['ROLE_USER', 'ROLE_ADMIN']
To enforce the role at different places in UI, you either add your roles to the state JS files. Just add them to data.authorities (check user-management.state.js)
If you like to have a template block visible only if a user has the proper role, check out the hasAnyAuthority directive.
The other Part is to secure the backend. If using a current JHipster version and SQL database, authorities are stored in the database. Add your custom roles to authorities.csv of your liquibase migrations.
Last but not least, you can enforce roles in WebSecurityConfiguration or MicroserviceSecurityConfiguration (just look at the existing antMatchers)

Determine user type in Google Class Room (Either Teacher or Student)

How can I determine if a user that is logged into my app is a Teacher or a Student?
I can successfully log in to my app using a Google Classroom test account, but when I look at the information retrieved, I see nothing in regards to role. I've looked through the API but so far I've only seen calls related to getting courses and rosters. I tried the user profile call, but the info returned did not include a role.
At a basic level, I just want to do loggedInUser.role === teacher.
Edit:
Updated for clarification. I am not looking for courses.students or courses.teachers. I consider those roster information. I already have a profile from a logged in user. I shouldn't have to see what role they are by listing teachers in a course.
Via the Classroom API, you can only determine if a user is a teacher or a student relative to a particular course. (It's possible for a user to be a teacher in one course, and a student in another.)
If you need to determine if a user is a real-world teacher or student, you need to do this via a mechanism separate from Classroom.
You might also like to star this issue to learn about any possible improvements to the API.
You're looking for courses.students and courses.teachers:
https://developers.google.com/classroom/reference/rest/v1/courses.students
https://developers.google.com/classroom/reference/rest/v1/courses.teachers
Once you have a course ID you can query these using the "list" request:
https://developers.google.com/classroom/reference/rest/v1/courses.teachers/list
https://developers.google.com/classroom/reference/rest/v1/courses.students/list

Categories

Resources