Paypal Checkout Button Loaded Multiple times - paypal

I have been integrated Express checkout with my Drupal 8 site. In my case I want show paypal button at once only and also I have loaded Checkout.min.js one time only through library. But here it has rendered 3 times as below.
paypal button
While inspecting the js file, I could see checkout.min.js file loaded multiple times
as like this.
But I have loaded Checkout.min.js one time only through library like below,
paypal_webform:
version: 1.x
css:
theme:
css/custom.css: {}
js:
https://www.paypalobjects.com/api/checkout.min.js: { type: external}
js/custom.js: { preprocess: false }
dependencies:
- core/jquery
- core/jquery.once
- core/drupal.ajax
- core/drupal
- core/drupalSettings
So please help me out, thanks in advance.

Related

firebase dynamic links in stripe throws err_unknown_url_scheme

I've been developing an app with firebase and stripe payment. I've created a checkout session in stripe and added firebase dynamic links for the success_url and cancel_url. The URLs are working fine. I've tested them outside stripe with a simple html file and it opens the app and takes the user to the correct page. If the page doesn't exist it'll take the user to the assigned website. This is stripe checkout session code:
const session = await stripe.checkout.sessions.create({
line_items: [{
price_data: { currency: 'INR', unit_amount: amount, product_data: { name: 'name' } },
quantity: 1,
}],
mode: 'payment',
success_url: 'https://-------.page.link/payment-success',
cancel_url: 'https://-------.page.link/payment-failed',
payment_intent_data: {
application_fee_amount: fee
},
}, {
stripeAccount: req.query.stripeId,
});
I've changed up the actual link since I don't know how much I'm allowed to share. But I can guarantee the dynamic links works fine. But after payment, the test payment at least, it's suppose to open the app and take the user to a payment success page. AND it was working fine for the first 2 or 3 days. After payment it re-opened the app and took the user to the correct page. But when I tried a few days later, this is what it's taking us to:
Again, I've removed the link since I don't know how much I'm allowed to share. It won't even open the app right now. It just shows this message in the browser. Both success and cancel url are doing the same. Why does the links work outside the function but not in it? Has anyone ever faced any similar issues before? Any help will be greatly appreciated.
It seems like you're trying to open the Checkout Session in a WebView which causing the issue in the redirect. Webviews don't know how to handle an URL Scheme other than http:// or https://. That being said, your problem isn't uncommon and there are multiple ways of solving this.
Your first approach would be to open the Checkout Session in an external browser as described in this answer or try to create your own WebViewClient and override shouldOverrideUrlLoading method like described in this answer. Just note that since the last edit of that answer the signature of the shouldOverrideUrlLoading method has changed but the logic should still be used the same way but instead of dealing with the String url, you will have to deal with a WebResourceRequest.
Had the same issue. I solved it by changing the mode like following:
await launchUrl(
url,
mode: LaunchMode.externalApplication, // Add this line
)
url_launcher version => 6.1.7

Google Action prompt link url on Webhook response not working as expected

I am trying to add a prompt link to my Google Action:
https://developers.google.com/assistant/conversational/reference/rest/v1/TopLevel/fulfill#link
My response looks like this:
payload.prompt.link = {
name: 'Open My Website',
open: {
url: 'https://mywebsite.com'
}
}
When testing on my Nest Hub, the link does show as a suggestion on the bottom of the page. However, when I click on it, it simply sends it as an utterance to my Action instead of open the web page.
Any idea why this is happening? And what is the expected behavior for prompt links? I cannot find much documentation on them.
This appears to be the Actions Builder implementation of Link-Out Suggestions, which were not originally available when the Actions Builder was released. They were, however, available for Dialogflow previously.
Link-Out Suggestions require the "WEB_LINK" device capability to work. Smart Displays do not have this device capability.

IBM's Watson Assistant has stopped responding

Just over a year ago I created a chatbot using IBM Watson Assistant. It is successfully interfacing with wordpress and facebook. it was working perfectly well in a web page too, but has now stopped outputting any text. I created the website integration by copying the code shown in the "preview link" page created by IBM when the bot is under development. That code includes a library file called "chat.0.0.4.js" and corresponding css. When the code runs now, the chatbot renders correctly, but when I look at the browser console I see at line 12990 in chat.0.0.4.js:
400 - {"error":"Invalid Request Body","errors":[{"message":"When source.type is not 'watson', source.id is required
Does anyone know how to fix this? I see that the integration code from the "preview link" is now totally different and I wonder if the mechanism I used a year ago is now depreciated?
Thanks.
I think you need to use the newer version, the script to integrate WA has changed and now looks like this:
<script>
window.watsonAssistantChatOptions = {
integrationID: 'YOUR_INTEGRATION_ID',
region: 'YOUR_REGION',
serviceInstanceID: 'YOUR_SERVICE_INSTANCE',
onLoad: function(instance) {
instance.updateUserID(L12345);
instance.render();
}
};
setTimeout(function(){
const t=document.createElement('script');
t.src="https://web-chat.global.assistant.watson.appdomain.cloud/loadWatsonAssistantChat.js";
document.head.appendChild(t);
});
</script>

Deeplink in Ionic V4?

We are using Ionic 4 with lazy loading. My app routing works by app.routing.module.ts file. How to use deep link to open app from external link like email or sms?
It seems you didn't type this into Google first so this question is likely going to be closed shortly.
Ionic provide a deep linking library:
https://ionicframework.com/docs/native/deeplinks
It's used like this:
this.deeplinks.routeWithNavController(this.navController, {
'/about-us': AboutPage,
'/products/:productId': ProductPage
}).subscribe(match => {
// match.$route - the route we matched, which is the matched entry from the arguments to route()
// match.$args - the args passed in the link
// match.$link - the full link data
console.log('Successfully matched route', match);
}, nomatch => {
// nomatch.$link - the full link data
console.error('Got a deeplink that didn\'t match', nomatch);
});
You are supposed to do as much research as you can on your own before you open a question on StackOverflow. People are happy to help but they usually want to see you have tried for yourself as you are just giving your job to somebody else otherwise.

Ionic 2 Livereload

When developing with Ionic 2 how does one stay on the current page when making code changes? In Ionic 1 livereload would take you back to your current url - however in ionic 2 there are no urls.
Is there a setting that will make livereload keep me on the current page?
I'm open to enabling URLs as well if that's what it takes to not have to manually navigate back to my page on every code change. However I haven't been able to find how to do that in the v2 docs yet.
To stop live reloading in Ionic2 following changes I have done in the configurations file : ionic.config.js.
In ionic.config.js
watch: {
sass: ['app/**/*.scss'],
html: ['app/**/*.html'],
livereload: [
'www/build/**/*.html',
'www/build/**/*.js',
'www/build/**/*.css'
]
}
above section edited to :
watch: {
sass: ['app/**/*.scss'],
html: ['app/**/*.html'],
}
Then stopped ionic serve by q, and again started. Auto refreshing got stopped, we have to manually refresh to reflect the latest changes.
You could set the this.rootPage in your app.component.ts to the page you are working on. I often do this if i am working on say the foobar.ts page for a while ill change it to
this.rootPage = FooBar;
And then change it back to the default root page when i am done.
Actually ionic.config.js has been deprecated . So i found a way may , go to this node_modules\#ionic\app-scripts\config . Change in file called watch.js
srcFiles: {
paths: ['{{SRC}}/**/*.(ts|html|s(c|a)ss)'],
options: { ignored: ['{{SRC}}/**/*.spec.ts', '{{SRC}}/**/*.e2e.ts', '**/*.DS_Store'] },
callback: watch.buildUpdate
},
No, there is no way to do what you are asking for, because ionic 2 is not using urls. Actually they are handling the pages as a variable on window, so when you or the live reload refresh the page it will go to the initial state. By the way actually there are no plans for implement the angular router, let's wait until the RC, maybe they would like to implement it