Coder Social home page Coder Social logo

woocommerce / woocommerce-paypal-payments Goto Github PK

View Code? Open in Web Editor NEW
58.0 18.0 47.0 11.87 MB

Home Page: https://wordpress.org/plugins/woocommerce-paypal-payments/

License: GNU General Public License v2.0

PHP 83.88% JavaScript 15.25% SCSS 0.48% Shell 0.32% Dockerfile 0.07%

woocommerce-paypal-payments's Introduction

WooCommerce PayPal Payments

PayPal's latest complete payments processing solution. Accept PayPal, Pay Later, credit/debit cards, alternative digital wallets local payment types and bank accounts. Turn on only PayPal options or process a full suite of payment methods. Enable global transaction with extensive currency and country coverage.

Dependencies

  • PHP >= 7.2
  • WordPress >=5.3
  • WooCommerce >=4.5

Development

Install dependencies & build

  • $ composer install
  • $ yarn install

Optionally, change the PAYPAL_INTEGRATION_DATE constant to gmdate( 'Y-m-d' ) to run the latest PayPal JavaScript SDK

Unit tests and code style

  1. $ composer install
  2. $ ./vendor/bin/phpunit
  3. $ ./vendor/bin/phpcs
  4. $ ./vendor/bin/psalm

Building a release package

If you want to build a release package (that can be used for deploying a new version on wordpress.org or manual installation on a WP website via ZIP uploading), follow these steps:

  1. Clone the repository and cd into it.
  2. Make sure you have the version in the plugin root file updated.
  3. Update the PayPal JavaScript SDK integration date by using the current date for the PAYPAL_INTEGRATION_DATE constant.
  4. The following command should get you a ZIP file ready to be used on a WordPress site:
$ yarn run build

or if using the DDEV setup:

$ yarn run ddev:build-package

Setup

You can install WooCommerce PayPal Payments locally using the dev environment of your preference, or you can use the DDEV setup provided in this repository which includes WP, WC and all developments tools.

To set up the DDEV environment, follow these steps:

  1. Install Docker and DDEV.
  2. Edit the configuration in the .ddev/config.yml file if needed.
  3. $ ddev start
  4. $ ddev orchestrate to install WP/WC.
  5. Open https://wc-pp.ddev.site

Use $ ddev orchestrate -f for reinstalattion (will destroy all site data). You may also need $ ddev restart to apply the config changes.

Running tests and other tasks in the DDEV environment

Tests and code style:

  • $ yarn ddev:test
  • $ yarn ddev:lint
  • $ yarn ddev:fix-lint - PHPCBF to fix basic code style issued

See package.json for other useful commands.

For debugging, see the DDEV docs. Enable xdebug via $ ddev xdebug, and press Start Listening for PHP Debug Connections in PHPStorm. After creating the server in the PHPStorm dialog, you need to set the local project path for the server plugin path. It should look like this.

See tests/playwright for e2e (browser-based) tests.

Test account setup

You will need a PayPal sandbox merchant and customer accounts to configure the plugin and make test purchases with it.

For setting up test accounts follow these instructions.

Webhooks

For testing webhooks locally, follow these steps to set up ngrok:

  1. Install ngrok.

  • If using DDEV, run our wrapper Bash script which will start ddev share and replace the URLs in the WP database:

    $ .ddev/bin/share
    
  • For other environments, run

    $ ngrok http -host-header=rewrite wc-pp.myhost
    

    and in your environment variables (accessible to the web server) add NGROK_HOST with the host that you got from ngrok, like abcd1234.ngrok.io. ngrok will be used only for the webhook listening URL. The URLs displayed on the WordPress pages, used in redirects, etc. will still remain local.

  1. Complete onboarding or resubscribe webhooks on the Webhooks Status page.

License

GPL-2.0 License

Contributing

All feedback / bug reports / pull requests are welcome.

woocommerce-paypal-payments's People

Contributors

a-danae avatar alexp11223 avatar brianyu28 avatar burdulixda avatar chaithi avatar chickenn00dle avatar danieldudzic avatar dennisnissle avatar dependabot[bot] avatar diegocurbelo avatar dinamiko avatar dnaber-de avatar fitimvata avatar inpsydeniklas avatar james-allan avatar jorgeatorres avatar khalilgharbaoui avatar lcmry avatar leonardola avatar mattallan avatar mayisha avatar meszarosrob avatar mmaymo avatar narek13 avatar pedrosilva-pt avatar prettyboymp avatar ratnakardubey avatar strangerkir avatar websupporter avatar xedinunknown avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

woocommerce-paypal-payments's Issues

Credit Card logos

Extracted from #4

  • When multiple logos are displayed, they appear a bit cramped.

Here is a screenshot comparing logos with another payment gateway. Perhaps we could add a tiny bit of margin as is done in Stripe: https://d.pr/i/da3wul

  • When Elo, Hiper, and/or JCB logos are shown, they are not sized properly in the order received screen: https://d.pr/i/7quZtH
  • On the same screen, the payment details section showing img HTML: https://d.pr/i/bU5O2P

Should merchants be able to display logos for Credit Cards that are disabled? I'm thinking a merchant may inadvertently select the same credit card for both of these fields, which may lead to some confusion for their customers.

Settings page is a bit cluttered

Extracted from #4.

Right now, if I want to disable buttons on the mini-cart, for example, it is a bit of a pain sifting through all of the different buttons and messaging sections to find what I am looking for. It might be better to have all button settings together, all messaging settings together, or even separate these into different tabs to reduce the number of settings on a single page.

Internet Explorer 11 Support

I'm not sure if IE11 support is on the table for 1.0 but I've created this issue to discuss/track it.

PayPal Checkout

  • PayPal Smart Buttons don't load

PayPal Card Processing

  • No Credit Cards payment fields or payment method option are loading

(the double place order buttons should be fixed once #26 is merged)

Extend README.md

  1. The README.md still says "PayPal Commerce" and such
  2. Add instructions on how to deploy the extension (building the final copy/ZIP file without all the development dependencies, etc)

Testing round 1 - feedback

Hey everyone!

Thanks for all your hard work on this! 😸
I've been trying out the extension and have some observations, which you'll find below. Some of my teammates will be doing the same soon, so expect a more thorough report once they had a chance to test, but it would be great if we could start looking at/discussing these issues in the meantime.

Thanks!

UX

  • (Settings) Once the e-mail address is entered and saved, it’s no longer possible to enable or disable sandbox mode without performing a full reset. Question: In PPEC you could have separate sandbox/live credentials and switch between those at any point. Is this doable in PayPal for WooCommerce?
  • Question: Do you need a special setup/approval on your account’s side to enable “PayPal Card processing”? If so, can this be checked somehow before allowing this setting to be enabled? Locally, I get an empty box and some console errors when trying to use this option. See screencast.

Checkout

  • (PayPal Credit) Despite not being in the US, I can see the “PayPal CREDIT” button. That even though isEligible() returns false for paypal.FUNDING.CREDIT.
  • [ ] On the Checkout page, when there are other payment options available everytime “PayPal” is selected the page scrolls up for some reason. Tested on Chrome 85.0 (macOS). See screencast.
  • When “PayPal Card processing” is enabled, the form appears in a weird place, at least on the Storefront theme: screenshot.
  • If possible, when “Credit Cards” is selected we should focus on the first card field to make it clear to the user that a form appeared and they still have something to fill out.

Code / environment

  • Plugin author (“Plugin:” header) should be “WooCommerce”.
  • Extension can’t be activated on PHP 7.0 due to various fatal errors. WooCommerce core requires PHP 7.0 but recommends 7.2 (and even warns users about it). If we could support 7.0 that would be great, but 7.2+ is ok as long as activating on 7.0 (which is still valid for WC) doesn’t result in a fatal error but a warning of some kind.
  • Can we remove the repositories section from composer.json as it's linked to private packagist account?
  • There are still some violations of the WooCommerce standards, but code is in overall much better shape in this regard now. Only 3 or 4 source code files seem to require modifications at this point.
  • Namespaced code should probably go into the \WooCommerce or \WooCommerce\PayPal namespace directly, not \Inpsyde. Not critical or high priority.
  • PHP notice logged when activating the plugin on the WC > Settings > Payments screen:

    [04-Sep-2020 17:07:37 UTC] PHP Notice: Trying to get property 'id' of non-object in […]paypal-for-woocommerce/modules/ppcp-wc-gateway/src/class-wcgatewaymodule.php on line 182

cc @websupporter

[Card Processing] Unable to complete checkout with JCB or ELO

When attempting to checkout using JCB or ELO (cards generated here), I get the following console error:

Uncaught 
Object { name: "UNPROCESSABLE_ENTITY", details: (1) […], message: "The requested action could not be performed, semantically incorrect, or failed business validation.", debug_id: "9ccb991afc015", informationLink: "https://developer.paypal.com/docs/api/orders#errors" }
js:2:38223

It looks like PayPal is returning an error here, but nothing appears on the front-end letting the user know the payment has failed. It just looks like the payment process never started.

When testing, I used a dummy Brazil address for ELO, and a Japan address for JCB.

Purchases over 1.000 USD fail

Describe the bug

When I purchase an item which costs more than 1,000.. USD, the order does not get created.

To reproduce

  1. Add 1.000 items of a product, which costs more then 1.00 USD, to the cart
  2. Try to pay with PayPal

Missing support for refunds through the Edit Order page

Not sure if this was missed in the implementation but are we supposed to be able to refund orders through the Edit Order page in Woo? Apologies if I've missed some documentation where this was taken out of 1.0 or something :)

What I'm referring to is when I go through the checkout flow and create an order with PayPal Checkout, I noticed you can't process refunds via the Edit Order page by clicking the "Refund $x via PayPal" similar to other WooCommerce gateways.

For comparison here's an order made with our Express Checkout extension: https://d.pr/i/DeP9Ut

Replace PAYPAL.FUNDING.CREDIT with PAYPAL.FUNDING.PAYLATER

The new Pay in 4 feature is to be rolled out October 1.

In most cases, this is done automatically. However, in cases where you're using Standalone function (such as on checkout page), replace PAYPAL.FUNDING.CREDIT with PAYPAL.FUNDING.PAYLATER

undefined function WooCommerce\PayPalCommerce\ApiClient\Endpoint\getallheaders()

Stacktrace:

2020-09-24T15:27:53+00:00 CRITICAL Uncaught Error: Call to undefined function WooCommerce\PayPalCommerce\ApiClient\Endpoint\getallheaders() in /srv/users/usercb6924e6/apps/usercb6924e6/public/wp-content/plugins/paypal-for-woocommerce/modules/ppcp-api-client/src/Endpoint/class-webhookendpoint.php:267
Stack trace:
#0 /srv/users/usercb6924e6/apps/usercb6924e6/public/wp-content/plugins/paypal-for-woocommerce/modules/ppcp-webhooks/src/class-incomingwebhookendpoint.php(122): WooCommerce\PayPalCommerce\ApiClient\Endpoint\WebhookEndpoint->verify_current_request_for_webhook(Object(WooCommerce\PayPalCommerce\ApiClient\Entity\Webhook))
#1 /srv/users/usercb6924e6/apps/usercb6924e6/public/wp-includes/rest-api/class-wp-rest-server.php(1016): WooCommerce\PayPalCommerce\Webhooks\IncomingWebhookEndpoint->verify_request(Object(WP_REST_Request))
#2 /srv/users/usercb6924e6/apps/usercb6924e6/public/wp-includes/rest-api/class-wp-rest-server.php(376): WP_REST_Server->dispatch(Object(WP_REST_Request))
#3 /srv/users/usercb6924e6/apps/usercb6924e6/public/wp-includes/re in /srv/users/usercb6924e6/apps/usercb6924e6/public/wp-content/plugins/paypal-for-woocommerce/modules/ppcp-api-client/src/Endpoint/class-webhookendpoint.php on line 267

Environment:

PHP 7.2.33

HTML tags in Product description

Describe the bug

When the product description contains HTML tags (e.g. to separate different content paragraphs with headings), these HTML tags are visible in the PayPal dialogue.

To reproduce

  1. Create a product with HTML tags like headings at the beginning of the description
  2. Click the PayPal button on the product page
  3. Go to the product list in the PayPal dialogue.

Screenshots

image

Expected behaviour

The HTML tags should not be present in the PayPal dialogue.

Environment (please complete the following information):

  • WordPress Version: latest
  • WooCommerce Version: latest
  • WooCommerce PayPal Payments Plugin Version: 1.0.0
  • Browser [e.g. chrome, safari] and Version: all

Order with Payment received when Hosted Fields transaction is declined

When a Hosted Fields transaction is declined, the API call responds with a 201 status code, but will include purchase_units -> payments -> captures -> status (Documentation link)

Since this acts differently than PayPal payments, it looks like this wasn’t implemented to check for, so these transactions are being marked as completed. This can cause merchants to ship out items, but not having been paid.

To reproduce

  1. In Settings Payments enable PayPal Card Processing
  2. Add product to cart and go to Checkout page
  3. In Billing details First name use: CCREJECT-INVALID
  4. Select credit card as payment and fill the fields
  5. Place order

Expected behavior

Once order is received the order status should be On hold.

What happened instead

Once order is received the order status is Processing with a Payment received Order note.

Environment:

  • WordPress Version 5.5.3
  • WooCommerce Version 4.6.1
  • WooCommerce PayPal Payments Plugin Version 1.0.2

When Gateway is not enabled, Card Processing can still be enabled

When the gateway is not enabled, merchants can still enable Card Processing, and the Card Processing form will appear on the front end:

Gateway settings:
https://d.pr/i/SiEzRw

Card Processing Settings:
https://d.pr/i/w3RRKb

Front end:
https://d.pr/i/YrQtZk

Unfortunately, when the form is filled out and submitted, the payment fails unless the Gateway is enabled again.

I'm guessing Card Processing should not be available when the gateway is not enabled.

To Reproduce:

  1. Connect the gateway to a valid PP account
  2. Enable Card Processing
  3. Make sure to disable the gateway
  4. Attempt to checkout via Credit Card. You will see an error: https://d.pr/i/4LEBsu
  5. Re-enable the gateway
  6. Attempt to checkout via Credit Card again. It should be successful.

Sandbox/Live switch

When in the progressive state, after a merchant inputs an email address, but before finishing the connection process, sandbox cannot be toggled.

This may be a consequence of only allowing either Sandbox or Live, but I imagine some merchants may either inadvertently select, or forget to check the Sandbox option when entering an email address. In these cases, it would be nice to not lock in which mode the site ends up in so a reset isn't required to get it right.

Honestly, it would be best if merchants could store both sandbox and production credentials, but I think this is something @jorgeatorres already brought up.

Extracted out of #4.

GB country has ACDC blocked

Describe the bug

Due to the code here the disable-funding=card is added to the SDK for all GB merchants, meaning they cannot use ACDC features.

The code snippet I outlined checks if the store country is GB, if so, it adds disable-funding=card to the JavaScript SDK query parameters.

What this does is disables the black Credit or Debit Card button, but also prevents the hosted fields that allow for processing direct credit cards.

This means any GB merchant that onboards to the Credit Card Processing section should have buyers have a Credit Card option to enter their CC number, exp date, CVV, but because of this code block, those fields will never render.

Looking back at our discussions during implementation, this was supposed to be disable-funding=credit as PayPal Credit was not supported in the UK

To reproduce

  1. Have store country set to GB.
  2. Onboard to ACDC.

Expected behavior

ACDC form should show.

Provide option for Credit Card to appear above PayPal in checkout

Describe the bug

Since the module is not broken into two methods, the user doesn't have control over which payment method (between PayPal and Credit Card) appears first in checkout.

Additional details

Provide toggle in the Credit Card Processing section to allow merchant to set Credit Cards first in checkout.

PayPal Smart buttons don't load when using a production/live account and `WP_Debug` is turned on/true

When WP_Debug is set to true, we load the PayPal SDK with the buyer-country parameter set to the users billing country:

if (
defined( 'WP_DEBUG' ) && \WP_DEBUG && is_user_logged_in()
&& WC()->customer && WC()->customer->get_billing_country()
) {
$params['buyer-country'] = WC()->customer->get_billing_country();

The issue is the buyer-country parameter only works when loading the PP sandbox sdk, so if a live store turns on WP Debug, the PayPal Smart buttons won't load on the checkout.

This results in a console error and in more details:

throw new Error("SDK Validation error: 'Query parameter buyer-country disallowed in production env'" );

/* Original Error:

Query parameter buyer-country disallowed in production env (debug id: 5818ee24e2620)

*/

Steps to reproduce

  1. Connect a production/live PayPal account
  2. Enable buttons on the checkout
  3. Turn on WP_Debug
  4. Load the checkout page
  5. You should see a console error log and no Smart buttons loading

Solution

Append a check for sandbox environment to the above condition

high volume of failed calls to /v1/notifications/webhooks

There is a large number of failed calls to the POST /v1/notifications/webhooks API, it seems that register method gets called also when the webhook is already registered: https://github.com/woocommerce/woocommerce-paypal-payments/blob/trunk/modules/ppcp-webhooks/src/class-webhookregistrar.php#L69-L92

When registration fails this code tries to reschedule it again: https://github.com/woocommerce/woocommerce-paypal-payments/blob/trunk/modules/ppcp-webhooks/src/class-webhookregistrar.php#L86-L89

It could be that there are some fails, which are not related to e.g. timeout, but are bound to the paypal account (maybe there are accounts, which simply can't register a webhook).

One solution could be investigate the specific error and seperate different reasons for failing to decide if reschedule or not.

Another solution could be remove the rescheduling logic and let it fail, the response error(s) are already logged here:
https://github.com/woocommerce/woocommerce-paypal-payments/blob/trunk/modules/ppcp-api-client/src/Endpoint/class-webhookendpoint.php#L106
https://github.com/woocommerce/woocommerce-paypal-payments/blob/trunk/modules/ppcp-api-client/src/Endpoint/class-webhookendpoint.php#L124

Testing PayPal Checkout (checkout page)

Hey all 👋 Nice work on this extension so far! While testing PayPal Checkout on the checkout page most of the core functionality was working perfectly but I found a few issues/bugs.

Billing Address not sent to PayPal correctly

While testing the PayPal Checkout flow I noticed that when I click on the PayPal smart button on the checkout page, the billing address City field was pre-populated with the State field and the state field was empty:


The Shipping address section seems fine: https://d.pr/i/GZoce0

  • Fix Billing City and State fields sent to PayPal

Can't test the Debit or Credit Card smart button

I wasn't able to pay for the order using the Debit or Credit Card buttons. I have a Sandbox customer that I test the same flow on our WooCommerce PayPal Express Checkout extension, but with this gateway I'm constantly getting the Try Again message:

  • Successfully pay using the Debit or Credit Card button

Double Place Order buttons

I'm not sure what the intended behaviour is but when I have both "PayPal Checkout" and "PayPal Card Processing" enabled, I get double place order buttons and no PayPal Smart buttons or card fields on the checkout.

What's expected for stores that enable both of these options? (apologies if this has come up in other peoples issues)


Other smaller issues found on the checkout

  • When I have the WooCommerce PayPal Express Checkout (our other PayPal Extension) gateway enabled, the PayPal Payments smart buttons don't load on the checkout. Here's a screencast: https://d.pr/v/3WdaMK
  • When I leave the Sandbox merchant ID credential empty, I'm still able to use PayPal Checkout. Is this intended? Is the Merchant ID not needed for PayPal Checkout?

Subscriptions Support Testing

I've enabled subscriptions support by defining PPCP_FLAG_SUBSCRIPTION and enabled the vault setting in settings but noticing a few issues with Subscriptions:

General Issues

  • "Vaulting - Enable Vaulting". This setting isn't clear that it's needed for Subscriptions support. I do see the setting tool tip mentions it but I wonder if we need to be more clear or use a different term instead of Vaulting. Some common phrases used in other gateways is "Tokenization" or "Save Profiles". Thoughts?
  • When the "vaulting" setting is enabled the credit card form looks off: https://d.pr/i/UIoRi4
  • Deprecated subscription function is being used ❌
[30-Sep-2020 03:43:04 UTC] PHP Deprecated:  WC_Subscriptions_Manager::process_subscription_payment_failure_on_order is <strong>deprecated</strong> since version 2.6.0 with no alternative available. in /Users/matt/local/store/wp-includes/functions.php on line 4801

PayPal Checkout & PayPal Card Processing

  • Subscription and parent order both look good ✅
  • Processing a renewal order results in on-hold subscription and pending payment order ❌

[Card Processing] Lag between place order button click and UI loading indicator

There is about a 5-10 second delay between the time a user clicks the Place order button and the time the loading indicator appears: https://d.pr/i/pIfktD

Viewing XHR requests in dev tools, I can see requests happening, but on the front-end, it appears as though nothing is happening for a few seconds until the loading indicator finally appears.

If a customer selects the button a second time, a console error appears indicating payment is in progress, but again, nothing on the front-end: https://d.pr/i/wAf5pg

Steps to Reproduce

  1. Make sure PayPal is connected and Credit Card Processing is enabled.
  2. Add a product to cart and proceed to checkout
  3. Select Credit Cards option and fill in all required form fields
  4. Open dev tools and either navigate to the Network Tab or enable XHR messages in console
  5. Select the Place order button. In dev tools, you will see magic happening. On the front-end, nothing will appear to be happening for a few seconds. Then the loading indicator will appear.

*This may be specific to my environment, but this doesn't happen with any other payment gateways for me.

Disable capturing on Pending Payment Orders

While testing some less common cases for #44 I got the following fatal error when trying to capture a pending payment made through PayPal Checkout:

30-Sep-2020 03:25:46 UTC] PHP Fatal error:  Uncaught Error: Call to a member function authorizations() on null in /Users/matt/local/store/wp-content/plugins/paypal-for-woocommerce/modules/ppcp-wc-gateway/src/Processor/class-authorizedpaymentsprocessor.php:136
Stack trace:
#0 /Users/matt/local/store/wp-content/plugins/paypal-for-woocommerce/modules/ppcp-wc-gateway/src/Processor/class-authorizedpaymentsprocessor.php(86): WooCommerce\PayPalCommerce\WcGateway\Processor\AuthorizedPaymentsProcessor->all_authorizations(Object(WooCommerce\PayPalCommerce\ApiClient\Entity\Order))
#1 /Users/matt/local/store/wp-content/plugins/paypal-for-woocommerce/modules/ppcp-wc-gateway/src/Gateway/class-paypalgateway.php(200): WooCommerce\PayPalCommerce\WcGateway\Processor\AuthorizedPaymentsProcessor->process(Object(Automattic\WooCommerce\Admin\Overrides\Order))
#2 /Users/matt/local/store/wp-content/plugins/paypal-for-woocommerce/modules/ppcp-wc-gateway/src/class-wcgatewaymodule.php(278): WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway->capture_authorized_payment(Ob in /Users/matt/local/store/wp-content/plugins/paypal-for-woocommerce/modules/ppcp-wc-gateway/src/Processor/class-authorizedpaymentsprocessor.php on line 136

Steps to reproduce

  1. Set intent to Authorize in: WooCommerce > Settings > Payments > PayPal
  2. Add a product to the cart
  3. Visit the checkout and click on the PayPal button
  4. Once PayPal pop-up appears you can close it
  5. Visit the new Pending Payment order Edit Order page
  6. Try to capture the payment and you'll get the above fatal error

Expected Behaviour

Can we hide the capture action on orders that haven't been paid for?

Remove ability to change shipping address on PayPal from checkout page

Mexico team pointed out an issue with the checkout page when checking out with PayPal.

After customer has entered their address on Woo and then submit to PayPal, they can still change their address within the PayPal modal, which can potentially cause issues with Chargebacks.

Best practice is to set the following in the Application Context object:

"shipping_preference": "SET_PROVIDED_ADDRESS"

Note this should only be done via the Checkout page when the buyer has already provided a shipping address. When using the shortcut flows (cart, mini-cart, product) the behavior shouldn't change.

Current behavior:
image (2)

Expected behavior:

image (3)

[Card Processing] Payment option and fields are slow to load the first time (and after changing store settings)

This is a minor issue but after changing the WooCommerce settings (i.e. currency or base location) or enabling card processing for the first time, I noticed that the payment method and card fields were slow to load on the checkout.

Here's a screen recording to show what I mean: https://d.pr/v/8Apttx

Notice the first load takes a couple of seconds, then subsequent reloads are instant.
It's only a couple of seconds, but when I first enabled Card Processing, the fields took a lot longer to load (up to 10 seconds) but I didn't get a recording of that.

While I'm not aware of any issues, I'm wondering if we should disable the "Place Order" button so that customers don't try place an order button while the payment method and card fields are still loading in.

Steps to replicate

  1. Change store currency
  2. Change base country
  3. Load the checkout

Different Credit Card form styles cross-browser

Chrome

Updated screenshot to latest issues*

Old screenshot: https://d.pr/i/hi7W43

Issues:

  • Card icon position is off
  • No placeholders for credit card number field or the CVV field
  • the placeholder for the expiry date says "MM/YYYY" but the label says "MM/YY"

Firefox

Issues:

  • No placeholders for credit card number field or the CVV field
  • the placeholder for the expiry date says "MM/YYYY" but the label says "MM/YY"

Safari

Issues:

  • Can't see any of the fields
  • No placeholders for card number or CVV
  • Similarly to above, the expiry date place order, and label aren't consistent

Internet Explorer

Are we supporting IE with v1.0?

  • Card form doesn't load on IE (No errors in console from what I could see 🤔 )

Is it possible to default to guest checkout and not force users to create a PayPal account when re-attempting to pay with Credit Card?

Extracted from #4.

is it possible to default to guest checkout and not force users to create a PayPal account when re-attempting to pay with Credit Card?

For example, this is what I see when attempting to retry: https://d.pr/i/4jztQh

But in WooCommerce PayPal Checkout Payment Gateway, I see the following which doesn't require creating an account: https://d.pr/i/WrmfDW

purchase_units -> amount -> value should be string

https://developer.paypal.com/docs/api/orders/v2/?mark=amount#definition-amount_with_breakdown

When send to the API, the value property of the amount object should be a string, but it is a float:
https://github.com/woocommerce/woocommerce-paypal-payments/blob/trunk/modules/ppcp-api-client/src/Entity/class-amount.php#L77

The money object does this string conversion towards the API here
https://github.com/woocommerce/woocommerce-paypal-payments/blob/trunk/modules/ppcp-api-client/src/Entity/class-money.php#L68

and we should follow this pattern and adhere to the APIs definition.

Checkout error when PayPal onboarding is in progressive state

When onboarding is in the progressive state (only email and merchant ID present), checkout results in the following error:

Error processing checkout. Please try again.

Here is a screencast of this happening in the progressive state: https://d.pr/i/3QfxQi

And of checkout working as expected when onboarding is complete (with the same PP sandbox account(s)): https://d.pr/i/ZTsUzI

Steps to reproduce:

  1. Connect via the onboarding connect button
  2. Optional: If connection was successful, remove API Client ID and Secret Keys then save settings
  3. Attempt to checkout an item using PayPal and see the above error

Connecting to PayPal Sandbox consistently fails on first attempt

I was testing the Connect to PayPal Sandbox button and I noticed that it was consistently failing to connect on every first attempt after disconnecting the store, then works on the second attempt.

After attempting to connect my store to PayPal Sandbox I get the following error:

I had a look in the logs and there's a bunch of logs for:

2020-10-15T02:50:10+00:00 WARNING [Error] Unknown error while connecting to PayPal

Steps to reproduce

I took a screencast which showcases the issues I'm having: https://d.pr/v/Chl736

(apologies for the long video, I wanted to run it through onboarding twice to show it's consistently happening)

  1. If your store is connected to PayPal, disconnect it first.
  2. Click on the "Connect to PayPal Sandbox" button
  3. Complete the onboarding/connection process
  4. Once you've returned back to your store, you'll get an error notice.
  5. At this point, I noticed all the PayPal Checkout settings are visible as well
  6. Retry going through the onboarding/connection process by clicking the "Connect to PayPal Sandbox" button using the same login.
  7. Once returned from PayPal onboarding, your store will be connected

Better handle store currencies that are not supported (159)

Describe the bug

When the store is set to use a currency that is not supported by PayPal, the gateway still shows as a payment option but payments fail with a non-descriptive error message.

To reproduce

  1. Set your store's currency to one not supported by PayPal, say "Indonesian rupiah (Rp)". This is on WC > Settings > General.
  2. Go to WC > Payments > PayPal. Confirm that everything looks good and the payment gateway can be activated, as if the plugin can be used with this currency.
  3. Go to the frontend and try to pay for a product.
  4. You'll see an error message and the following logged to the error logs:

    2020-11-05T09:17:24+00:00 WARNING [UNPROCESSABLE_ENTITY] The requested action could not be performed, semantically incorrect, or failed business validation. https://developer.paypal.com/docs/api/orders/v2/#error-CURRENCY_NOT_SUPPORTED

Expected behavior

The gateway should show an error message when going to the settings screen and prevent me from activating it if it's not designed to work with my store currency. This is what PayPal Standard shows when you go to WC > Payments > PayPal Standard, for example:

Screen Shot 2020-11-05 at 06 15 26

Installation prefix setting name a bit confusing

Extracted from #4

The installation prefix setting name might be a bit confusing. Is this prefix specific to invoices? If so, we may want to rename this to Invoice prefix to make this clearer for merchants.

Can't test the Debit or Credit Card smart button

Extracted from #7

I wasn't able to pay for the order using the Debit or Credit Card buttons. I have a Sandbox customer that I test the same flow on our WooCommerce PayPal Express Checkout extension, but with this gateway I'm constantly getting the Try Again message:

image

No logging for failed Credit Card payments

Extracted from #4.

No logging for failed Credit Card payments. I have only confirmed this with the Credit Card/Debit button, but for example, when something goes wrong I see the following message: https://d.pr/i/P0VWpB

Despite logging being enabled, no log file/entry is generated for this.

Before golive

Hi,
a couple of things, which need to be addressed before we can go live. Most important: The real merchant/client id of the platform and the real endpoint URLs of connect.woocommerce.com need to be added.

PayPal just released a new optimized endpoint for global usage with many more connection peers. Please update the code to point to:
api-m.paypal.com for production and
api-m.sandbox.paypal.com for sandbox

https://github.com/woocommerce/paypal-for-woocommerce/blob/49c66ecd006633eb871db2ea510be294d2826ffb/modules/ppcp-api-client/services.php#L47-L52
https://github.com/woocommerce/paypal-for-woocommerce/blob/49c66ecd006633eb871db2ea510be294d2826ffb/modules/ppcp-onboarding/services.php#L34-L38
https://github.com/woocommerce/paypal-for-woocommerce/blob/49c66ecd006633eb871db2ea510be294d2826ffb/modules/ppcp-onboarding/services.php#L55-L58

"The value of a field does not conform to the expected format" error when using certain e-mail addresses

During checkout, if the e-mail address contains certain characters, for instance + (plus sign), the following error is presented to the user:

Screen Shot 2020-10-08 at 17 14 01

This refers to payer/email_address specifically.

Not sure if the e-mail address has to be encoded a certain way or if this is an issue on PayPal's side, but e-mail addresses such as "[email protected]" are both valid e-mail addresses and common practice.

Requiring an email before being able to connect adds some confusion to the process.

Is it possible to display the button by default, and delay inputting an email address to this step: https://d.pr/i/GZJA4D

Another option might be to allow merchants to kick off the connection process as soon as they enter an email (without requiring the additional step of saving settings).

As it stands, when I first see the PPCP settings page, it's unclear I need to input my PayPal email address to kick off the connection process. And once I do figure this out, the next state displays the following: https://d.pr/i/wky3bH

The Email Address field indicates I am connected, but the button indicates otherwise. I imagine some merchants may stop here without finalizing the connection process until they later realize payments aren't working as they expect.

Extraced from #4.

Attempting to checkout without country selected results in unexpected error message

Attempting to checkout without selecting a country results in the following error: https://d.pr/i/tsrqzK

All other required fields result in more specific errors, for example:

<strong>Billing Email address</strong> is a required field.

Note: Even these errors are a bit broken as we are able to see the HTML strong tags.

Steps to reproduce

  1. Make sure PayPal is connected
  2. Add an item to cart and go to checkout
  3. Fill out all billing details except country
  4. Attempt to pay with PayPal
  5. You will see the above error

Feedback Round 2

Hey y'all. Great work on this so far! 🙇‍♂️

I've got another round of feedback which I'll use this issue to track and share. If you'd prefer I open individual issues for each point instead, let me know and I'll close this and do that.

Anyway, here goes:

Settings Page

  • Incorrect tooltip for all Credit Messaging ratio settings: https://d.pr/i/MPH5d0
  • The 1x4 ratio option is a bit awkward.

This is what it looks like on Storefront on desktop: https://d.pr/i/wmCDVw

And on mobile: https://d.pr/i/sqzBA3

(Product and Cart messaging banners are similar)

In both cases, there is a large chunk of unused space. Is this intentional? If so, would you consider changing this ratio to reduce this empty space?

  • The installation prefix setting name might be a bit confusing. Is this prefix specific to invoices? If so, we may want to rename this to Invoice prefix to make this clearer for merchants.

  • Settings page is a bit cluttered. Right now, if I want to disable buttons on the mini-cart, for example, it is a bit of a pain sifting through all of the different buttons and messaging sections to find what I am looking for. It might be better to have all button settings together, all messaging settings together, or even separate these into different tabs to reduce the number of settings on a single page.

Checkout

  • No logging for failed Credit Card payments. I have only confirmed this with the Credit Card/Debit button, but for example, when something goes wrong I see the following message: https://d.pr/i/P0VWpB

Despite logging being enabled, no log file/entry is generated for this.

  • Related to the above, is it possible to default to guest checkout and not force users to create a PayPal account when re-attempting to pay with Credit Card?

For example, this is what I see when attempting to retry: https://d.pr/i/4jztQh

But in WooCommerce PayPal Checkout Payment Gateway, I see the following which doesn't require creating an account: https://d.pr/i/WrmfDW

  • Also related to the above, on failure, it would be nice to not have to try again, and be able to select a different payment method. Right now, after selecting the Credit Card/Debit button, the other methods disappear and don't return on failure.

Code

  • I'm seeing some coding standards violations in several PHP files. Mostly just spacing/indentation at beginning of lines and missing doc comments.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.