Skip to content

Commit

Permalink
Merge release/2.7.0 into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
naman03malhotra committed Jul 14, 2021
2 parents 16c5a7c + d199760 commit a238582
Show file tree
Hide file tree
Showing 262 changed files with 8,939 additions and 2,284 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ trim_trailing_whitespace = true
[*.txt]
trim_trailing_whitespace = false

[*.{md,json,yml}]
[*.{md,json,yml,snap}]
trim_trailing_whitespace = false
indent_style = space
indent_size = 2
91 changes: 59 additions & 32 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
/** @format */

{
"root": true,
"parser": "babel-eslint",
"extends": [ "wpcalypso/react", "plugin:jsx-a11y/recommended", "prettier", "plugin:@woocommerce/eslint-plugin/recommended" ],
"extends": [
"wpcalypso/react",
"plugin:jsx-a11y/recommended",
"prettier",
"plugin:@woocommerce/eslint-plugin/recommended"
],
"plugins": [ "jsx-a11y", "jest", "jsdoc-alignment" ],
"env": {
"browser": true,
Expand All @@ -29,10 +33,21 @@
}
},
"rules": {
"camelcase": [ "error", { "properties": "always" } ],
"camelcase": [
"error",
{
"properties": "never",
"ignoreGlobals": true
}
],
"import/no-extraneous-dependencies": "off",
"indent": "off",
"max-len": [ "error", { "code": 140 } ],
"max-len": [
"error",
{
"code": 140
}
],
"no-console": "warn",
"react/no-danger": "off",
"react/react-in-jsx-scope": "off",
Expand All @@ -41,7 +56,12 @@
"wpcalypso/redux-no-bound-selectors": "warn",
"react/jsx-curly-spacing": [
2,
{ "when": "always", "children": { "when": "always" } }
{
"when": "always",
"children": {
"when": "always"
}
}
],
"jsx-a11y/label-has-for": [
"error",
Expand All @@ -52,37 +72,32 @@
"jsdoc/check-tag-names": [
"error",
{
"definedTags": [
"format"
]
"definedTags": [ "format" ]
}
],
"yoda": [
"error",
"always"
],
"yoda": [ "error", "always" ],
/* partially disable rules to get @woocommerce/eslint-plugin integration done */
"jsdoc/no-undefined-types": "off",
"jsdoc/require-param": "off",
"jsdoc/check-param-names": "off",
"jsdoc/require-property": "off",
"@wordpress/no-global-event-listener": "off",
"jsdoc/no-undefined-types": "off",
"jsdoc/require-param": "off",
"jsdoc/check-param-names": "off",
"jsdoc/require-property": "off",
"@wordpress/no-global-event-listener": "off",
"@wordpress/no-unused-vars-before-return": "off",
"@wordpress/i18n-translator-comments": "off",
"@wordpress/valid-sprintf": "off",
"@woocommerce/dependency-group": "off",
"react-hooks/exhaustive-deps": "error",
"react-hooks/rules-of-hooks": "error",
"jest/no-conditional-expect": "off",
"jest/valid-title": "off",
"jest/expect-expect": "off",
"jest/no-disabled-tests": "off",
"jest/no-standalone-expect": "off",
"jest/no-identical-title": "off",
"jest/no-deprecated-functions": "off",
"no-alert": "off",
"object-shorthand": "off",
"no-multi-str": "off"
"@wordpress/i18n-translator-comments": "off",
"@wordpress/valid-sprintf": "off",
"@woocommerce/dependency-group": "off",
"react-hooks/exhaustive-deps": "error",
"react-hooks/rules-of-hooks": "error",
"jest/no-conditional-expect": "off",
"jest/valid-title": "off",
"jest/expect-expect": "off",
"jest/no-disabled-tests": "off",
"jest/no-standalone-expect": "off",
"jest/no-identical-title": "off",
"jest/no-deprecated-functions": "off",
"no-alert": "off",
"object-shorthand": "off",
"no-multi-str": "off"
},
"overrides": [
{
Expand All @@ -97,6 +112,18 @@
"prettier/@typescript-eslint"
],
"rules": {
"camelcase": "off",
"@typescript-eslint/naming-convention": [
"error",
{
"selector": [ "method", "variableLike" ],
"format": [ "camelCase", "PascalCase" ]
},
{
"selector": "typeProperty",
"format": [ "camelCase", "snake_case" ]
}
],
"@typescript-eslint/no-explicit-any": "off",
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": [ "error" ],
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/php-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
tools: composer
coverage: none
# install dependencies and run linter
- run: composer self-update 2.0.6 && composer install --no-progress && ./vendor/bin/phpcs --standard=phpcs.xml.dist $(git ls-files | grep .php$)
- run: composer self-update 2.0.6 && composer install --no-progress && ./vendor/bin/phpcs --standard=phpcs.xml.dist $(git ls-files | grep .php$) && ./vendor/bin/psalm

test:
name: PHP testing
Expand Down
3 changes: 3 additions & 0 deletions .husky/post-checkout
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@

# using `--no-install` just in case it's the first time a person is checking out the repo and doesn't have yarnhook installed
npx --no-install yarnhook

# make sure the autoload files are regenerated
composer dumpautoload
3 changes: 3 additions & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@

# using `--no-install` just in case it's the first time a person is checking out the repo and doesn't have yarnhook installed
npx --no-install yarnhook

# make sure the autoload files are regenerated
composer dumpautoload
3 changes: 3 additions & 0 deletions .husky/post-rewrite
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@

# using `--no-install` just in case it's the first time a person is checking out the repo and doesn't have yarnhook installed
npx --no-install yarnhook

# make sure the autoload files are regenerated
composer dumpautoload
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,32 @@ This is a feature plugin for accepting payments via a WooCommerce-branded paymen

## Dependencies

- WooCommerce
- WooCommerce

## Development

### Install dependencies & build

- `npm install`
- `composer install`
- `npm run build:client`
- `npm install`
- `composer install`
- `npm run build:client`, or if you're developing the client you can have it auto-update when changes are made: `npm start`

## Setup

If you're using the Docker environment see setup instructions here:
https://github.com/Automattic/woocommerce-payments/blob/trunk/docker/README.md

Install the following plugins:
- WooCommerce

- WooCommerce

## Test account setup

For setting up a test account follow [these instructions](https://docs.woocommerce.com/document/payments/testing/dev-mode/).

You will need a externally accessible URL to set up the plugin. You can use ngrok for this.

```ngrok http 8082```
`ngrok http 8082`

See: https://github.com/Automattic/woocommerce-payments/blob/trunk/CONTRIBUTING.md (possibly move contents here for visibility sake)

Expand Down
5 changes: 5 additions & 0 deletions bin/run-psalm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

set -e

./vendor/bin/psalm $*
7 changes: 7 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
*** WooCommerce Payments Changelog ***

= 2.7.0 - 2021-xx-xx =
* Add - Add a link to the snackbar notice that appears after submitting or saving evidence for a dispute challenge.
* Add - Support saving new cards and paying with previously saved cards in the WooCommerce Checkout Block.
* Fix - WooCommerce Payments admin pages redirect to the onboarding page when the WooCommerce Payments account is disconnected.
* Fix - Do not overwrite admin pages when account is disconnected.
* Update - Set a description when creating payment intents.

= 2.6.1 - 2021-07-01 =
* Fix - Updates the notes query filters to prevent breaking the WooCommerce > Home inbox.

Expand Down
36 changes: 36 additions & 0 deletions client/additional-methods-setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { addFilter } from '@wordpress/hooks';
* Internal dependencies
*/
import MethodSelector from './methods-selector';
import UpePreviewMethodSelector from './upe-preview-methods-selector';
import WcPayUpeContextProvider from '../settings/wcpay-upe-toggle/provider';

addFilter(
'woocommerce_admin_onboarding_task_list',
Expand Down Expand Up @@ -37,6 +39,40 @@ addFilter(
'woocommerce-payments'
),
isDismissable: true,

// overwriting the default values, while the test is running
// using object spread to override the attributes makes things a bit easier when it'll be time to clean up
...( window.wcpayAdditionalMethodsSetup
.isUpeSettingsPreviewEnabled
? {
additionalInfo: __(
'Get early access to additional payment methods and an improved checkout experience',
'woocommerce-payments'
),
title: __(
'Boost your sales by accepting new payment methods',
'woocommerce-payments'
),
container: (
<WcPayUpeContextProvider
defaultIsUpeEnabled={
'1' ===
window.wcpayAdditionalMethodsSetup
.isUpeEnabled
}
>
<UpePreviewMethodSelector />
</WcPayUpeContextProvider>
),
completed:
'yes' ===
window.wcpayAdditionalMethodsSetup
.isSetupCompleted ||
'1' ===
window.wcpayAdditionalMethodsSetup
.isUpeEnabled,
}
: {} ),
},
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
useEnabledPaymentMethodIds,
useGetAvailablePaymentMethodIds,
useSettings,
useDigitalWalletsEnabledSettings,
usePaymentRequestEnabledSettings,
} from '../../data';
import './add-payment-methods-task.scss';

Expand Down Expand Up @@ -73,9 +73,9 @@ const AddPaymentMethodsTask = () => {
] = useEnabledPaymentMethodIds();

const [
initialIsDigitalWalletsEnabled,
setIsDigitalWalletsEnabled,
] = useDigitalWalletsEnabledSettings();
initialIsPaymentRequestEnabled,
setIsPaymentRequestEnabled,
] = usePaymentRequestEnabledSettings();

const { saveSettings, isSaving } = useSettings();

Expand All @@ -93,8 +93,8 @@ const AddPaymentMethodsTask = () => {
)
);

const [ isWalletsChecked, setWalletsChecked ] = useState(
initialIsDigitalWalletsEnabled
const [ isPaymentRequestChecked, setPaymentRequestChecked ] = useState(
initialIsPaymentRequestEnabled
);

const { setCompleted } = useContext( WizardTaskContext );
Expand All @@ -116,13 +116,13 @@ const AddPaymentMethodsTask = () => {
return;
}

setIsDigitalWalletsEnabled( isWalletsChecked );
setIsPaymentRequestEnabled( isPaymentRequestChecked );
updateEnabledPaymentMethodIds( checkedPaymentMethods );

const isSuccess = await saveSettings();
if ( ! isSuccess ) {
// restoring the state, in case of soft route
setIsDigitalWalletsEnabled( initialIsDigitalWalletsEnabled );
setIsPaymentRequestEnabled( initialIsPaymentRequestEnabled );
updateEnabledPaymentMethodIds( initialEnabledPaymentMethodIds );
return;
}
Expand All @@ -137,9 +137,9 @@ const AddPaymentMethodsTask = () => {
saveSettings,
setCompleted,
initialEnabledPaymentMethodIds,
initialIsDigitalWalletsEnabled,
isWalletsChecked,
setIsDigitalWalletsEnabled,
initialIsPaymentRequestEnabled,
isPaymentRequestChecked,
setIsPaymentRequestEnabled,
] );

const countryName = useGetCountryName();
Expand Down Expand Up @@ -234,8 +234,8 @@ const AddPaymentMethodsTask = () => {
</Card>
<div className="wcpay-wizard-task__description-element">
<CheckboxControl
checked={ isWalletsChecked }
onChange={ setWalletsChecked }
checked={ isPaymentRequestChecked }
onChange={ setPaymentRequestChecked }
label={ __(
'Enable Apple Pay & Google Pay',
'woocommerce-payments'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const SetupComplete = () => {
}

updateOptions( {
// eslint-disable-next-line camelcase
wcpay_additional_methods_setup_completed: 'yes',
} );

Expand Down
Loading

0 comments on commit a238582

Please sign in to comment.