How to check if paypal.checkout.setup() has already been called? - paypal-sandbox

Error: You are calling paypal.checkout.setup() more than once. This function can only be called once per page load. Any further calls will be ignored.
Are there any flags of getters in PayPal API to check it?
Similar Paypal Express Checkout - You are calling paypal.checkout.setup() more than once

Related

PasswordSignInAsync - Failing when calling this programmatically?

Please help, I want to test a service method - and during this testing I want to forcefully log-in a user by providing the user name and password - this will not be used for production, simply for a test I am conducting. But when I get the sign in manager and call the PasswordSignInAsync I receive a strange error, this error is not generated when going via Login.cshtml.cs code which reads the same?

Custom event tracking doesn't send event

I'm trying to get custom event tracking to work on my website.
My problem is: The custom GA tracking is not being send. I cannot see it in GA or in my network tab. Also there is no error in the developer console.
How can I debug / fix the problem?
What I have tried to solve the problem:
We use GTM to implement GA. GA works fine.
I have created a function to get triggered when a event occurs. I have tested the function - it fires properly when the event is being triggered.
The the ga 'send' command uses functions to dynamically generate the right tracking. I have tested the functions individually inside a console.log >> they work fine.
I have tested that the 'ga' command is available. It is not being rejected by the console with an error message like 'unknown'. So the command is available. It just doesn't work properly >> no error message at all.
Technical Background:
We use WordPress 5.0.2 to run our website.
I have tested it locally (WAMP) and on our staging environment.
The function:
function stepTracking() {
ga('send', 'event', eventLabel(), eventAction, eventCategory());
}
My goal is to A. Understand why the command is not working and B. Send the tracking properly.
Thank you guys,
Max
It looks like you are using a GA event as opposed to a GTM event. Try the dataLayer.push mechanism.

Retry Cloud Functions for Firebase until it succeeds

I'd like to create a cloud function which sends an e-mail based on a change in my database. I use postmark, but that's not relevant for this function. I looked at the firebase-examples.
My question is: What if the mail service returns an error or if the mail service is temporary down? I don't see any form of error handling in the examples.
My 'solution' would be to try again in 5 minutes for example. Is that possible and advisable in cloud functions?
If you throw an exception when sending the email fails, it should retry the function up to 7 days.
Open detailed usage states for your function in the firebase console
Edit the function
Click the link to configure retry
Enable "Retry on failure"
I haven't tried it myself yet for your use case, but it works for my storage triggered function when it fails.

authWithCustomToken not firing callback

When a user registers on my system, I create the user internally, and then allow the user to register with Firebase using the firebase client lib. This generates a session token for the user. Later, when a user starts the app again, the app automatically logs the user in like this:
ref.authWithCustomToken(sessionToken, function(error, authData) {...
debugger
I have verified that the sessionToken is available when the function is executed, but debugger is never reached, and no error is ever emitted.
Any help is appreciated!
I know it's a bit late, but I experienced a similar problem and it had me scratching my head for a while, so just in case it helps somebody else, here's what I found.
If I run authWithCustomToken with a token generated with one uid (uid1) and then run it again on the same ref with a different uid (uid2), the callback doesn't get fired the second time around.
In my case, I had declared the same ref in different modules that were used in the same node process and was trying to authenticate them with different uids. Although I had declared the ref twice, Firebase still saw it as the same ref because it was in the same process and referred to the same Firebase location. By declaring and authorising the ref in a parent module, I was then able to use onAuth in the child modules and the onAuth callbacks all fired as expected.
I had a similar problem with iOS, authWithCustomToken callback was never called right after install.
All consecutive launches worked fine.
My findings might be related so I thought I share them.
Problem was I called
func applicationWillResignActive(application: UIApplication) {
Firebase.goOffline()
}
func applicationWillEnterForeground(application: UIApplication) {
Firebase.goOnline()
}
in AppDelegate. Turns out if you call Firebase.goOnline() without logging in first it messes up the callback. Once I removed those two lines everything worked fine.

hook_user not being called for 'login' operation

I've read in the drupal documentation that hook_user should be invoked for the login operation. To test this I've added a call to drupal_set_message at the top of my modules hook implementation and the only message I'm receiving is a call with 'load' as the $op.
I've confirmed that drupal_set_message can be called multiple times and it doesn't erase the previous message, so I'm confident that hook_user is only being invoked the one time.
Any good reasons for why hook_user isn't being invoked with 'login' as an operation when I'm logging in?
Drupal version is 6 and my module is called "favequest_favorites" its implementation of hook_user (for testing purposes) is:
function favequest_favorites_user($op, &$edit, &$user, $caterogy=NULL) {
drupal_set_message($op);
}
As is often the case I've tracked this down to the interaction of modules.
Do not use the "Login Destination" module if you plan on using hook_user in your modules.
It bails out before all other modules may have had a chance to execute.
You've got a typo with the spelling of the "$caterogy" variable, but that shouldn't matter, since you're not using it in this test:
function favequest_favorites_user($op, &$edit, &$user, $caterogy=NULL) {
Using your code, I get four messages on login:
load
load
login
load
How about if you edit the user account? Do you get the "view" $op on the My Account page, and the "form" $op when you edit it?
Interesting that I don't get the "logout" $op when I log out--I assume that has something to do with a redirect, once I'm no longer authenticated.
See if you have a drupal_goto after you login.
http://drupal.org/node/228688
About drupal_set_message - The messages are saved into the session. When you login the session gets reset, and that might be the reason you don't see them. For a quick debug I recommend using devel module with dd function or system log messages.
Adi

Resources