mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Show "Venmo" instead of "PayPal" when using its' button
This commit is contained in:
parent
cf5d1ec21f
commit
f4a32a01e7
8 changed files with 155 additions and 161 deletions
|
@ -14,7 +14,10 @@ const bootstrap = () => {
|
|||
const errorHandler = new ErrorHandler(PayPalCommerceGateway.labels.error.generic);
|
||||
const spinner = new Spinner();
|
||||
const creditCardRenderer = new CreditCardRenderer(PayPalCommerceGateway, errorHandler, spinner);
|
||||
const renderer = new Renderer(creditCardRenderer, PayPalCommerceGateway);
|
||||
const onSmartButtonClick = data => {
|
||||
window.ppcpFundingSource = data.fundingSource;
|
||||
};
|
||||
const renderer = new Renderer(creditCardRenderer, PayPalCommerceGateway, onSmartButtonClick);
|
||||
const messageRenderer = new MessageRenderer(PayPalCommerceGateway.messages);
|
||||
const context = PayPalCommerceGateway.context;
|
||||
if (context === 'mini-cart' || context === 'product') {
|
||||
|
|
|
@ -4,7 +4,8 @@ const onApprove = (context, errorHandler) => {
|
|||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
nonce: context.config.ajax.approve_order.nonce,
|
||||
order_id:data.orderID
|
||||
order_id:data.orderID,
|
||||
funding_source: window.ppcpFundingSource,
|
||||
})
|
||||
}).then((res)=>{
|
||||
return res.json();
|
||||
|
@ -13,7 +14,7 @@ const onApprove = (context, errorHandler) => {
|
|||
errorHandler.genericError();
|
||||
return actions.restart().catch(err => {
|
||||
errorHandler.genericError();
|
||||
});;
|
||||
});
|
||||
}
|
||||
location.href = context.config.redirect;
|
||||
});
|
||||
|
|
|
@ -5,7 +5,8 @@ const onApprove = (context, errorHandler, spinner) => {
|
|||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
nonce: context.config.ajax.approve_order.nonce,
|
||||
order_id:data.orderID
|
||||
order_id:data.orderID,
|
||||
funding_source: window.ppcpFundingSource,
|
||||
})
|
||||
}).then((res)=>{
|
||||
return res.json();
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
class Renderer {
|
||||
constructor(creditCardRenderer, defaultConfig) {
|
||||
constructor(creditCardRenderer, defaultConfig, onSmartButtonClick) {
|
||||
this.defaultConfig = defaultConfig;
|
||||
this.creditCardRenderer = creditCardRenderer;
|
||||
this.onSmartButtonClick = onSmartButtonClick;
|
||||
}
|
||||
|
||||
render(wrapper, hostedFieldsWrapper, contextConfig) {
|
||||
|
@ -19,6 +20,7 @@ class Renderer {
|
|||
paypal.Buttons({
|
||||
style,
|
||||
...contextConfig,
|
||||
onClick: this.onSmartButtonClick,
|
||||
}).render(wrapper);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue