Merge pull request #23690 from woocommerce/update/obw-stripe

Update OWB Payment Gateway structure
This commit is contained in:
Gerhard Potgieter 2019-05-16 18:26:29 +02:00 committed by GitHub
commit afd7e72c03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 307 additions and 119 deletions

View File

@ -4,15 +4,18 @@ body {
background: #f1f1f1;
padding: 0;
}
#wc-logo {
border: 0;
margin: 0 0 24px;
padding: 0;
text-align: center;
img {
max-width: 30%;
}
}
.wc-setup {
text-align: center;
@ -20,10 +23,12 @@ body {
text-align: left;
width: auto;
}
.hidden {
display: none;
}
}
.wc-setup-content {
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.13);
padding: 2em;
@ -33,7 +38,10 @@ body {
zoom: 1;
text-align: left;
h1, h2, h3, table {
h1,
h2,
h3,
table {
margin: 0 0 20px;
border: 0;
padding: 0;
@ -41,38 +49,50 @@ body {
clear: none;
font-weight: 500;
}
p {
margin: 20px 0;
font-size: 1em;
line-height: 1.75em;
color: #666;
}
table {
font-size: 1em;
line-height: 1.75em;
color: #666;
}
a {
color: #a16696;
&:hover, &:focus {
&:hover,
&:focus {
color: #111;
}
}
.form-table {
th {
width: 35%;
vertical-align: top;
font-weight: normal;
}
td {
vertical-align: top;
select, input {
select,
input {
width: 100%;
box-sizing: border-box;
}
input[size] {
width: auto;
}
.description {
line-height: 1.5em;
display: block;
@ -80,7 +100,9 @@ body {
color: #999;
font-style: italic;
}
.input-checkbox, .input-radio {
.input-checkbox,
.input-radio {
width: auto;
box-sizing: inherit;
padding: inherit;
@ -88,37 +110,48 @@ body {
box-shadow: none;
}
}
.section_title {
td {
padding: 0;
h2, p {
h2,
p {
margin: 12px 0 0;
}
}
}
th, td {
th,
td {
padding: 12px 0;
margin: 0;
border: 0;
&:first-child {
padding-right: 1em;
}
}
}
table.tax-rates {
width: 100%;
font-size: 0.92em;
th {
padding: 0;
text-align: center;
width: auto;
vertical-align: middle;
}
td {
border: 1px solid #f5f5f5;
padding: 6px;
text-align: center;
vertical-align: middle;
input {
outline: 0;
border: 0;
@ -127,18 +160,22 @@ body {
text-align: center;
width: 100%;
}
&.sort {
cursor: move;
color: #ccc;
&::before {
content: '\f333';
font-family: 'dashicons';
content: "\f333";
font-family: "dashicons";
}
}
&.readonly {
background: #f5f5f5;
}
}
.add {
padding: 1em 0 0 1em;
line-height: 1em;
@ -149,14 +186,16 @@ body {
overflow: hidden;
position: relative;
display: inline-block;
&::before {
content: '\f502';
font-family: 'dashicons';
content: "\f502";
font-family: "dashicons";
position: absolute;
left: 0;
top: 0;
}
}
.remove {
padding: 1em 0 0 1em;
line-height: 1em;
@ -167,40 +206,51 @@ body {
overflow: hidden;
position: relative;
display: inline-block;
&::before {
content: '\f182';
font-family: 'dashicons';
content: "\f182";
font-family: "dashicons";
position: absolute;
left: 0;
top: 0;
}
}
}
.wc-setup-pages {
width: 100%;
border-top: 1px solid #eee;
thead th {
display: none;
}
.page-name {
width: 30%;
font-weight: bold;
}
th, td {
th,
td {
padding: 14px 0;
border-bottom: 1px solid #eee;
&:first-child {
padding-right: 9px;
}
}
th {
padding-top: 0;
}
.page-options {
p {
color: #777;
margin: 6px 0 0 24px;
line-height: 1.75em;
input {
vertical-align: middle;
margin: 1px 0 0;
@ -208,50 +258,64 @@ body {
width: 1.75em;
line-height: 1.75em;
}
label {
line-height: 1;
}
}
}
}
@media screen and (max-width: 782px) {
.form-table {
tbody {
th {
width: auto;
}
}
}
}
.twitter-share-button {
float: right;
}
.wc-setup-next-steps {
overflow: hidden;
margin: 0 0 24px;
padding-bottom: 2px;
h2 {
margin-bottom: 12px;
}
.wc-setup-next-steps-first {
float: left;
width: 50%;
box-sizing: border-box;
}
.wc-setup-next-steps-last {
float: right;
width: 50%;
box-sizing: border-box;
}
ul {
padding: 0 2em 0 0;
list-style: none outside;
margin: 0;
li a {
display: block;
padding: 0 0 0.75em;
}
.setup-product {
a.button {
background-color: #f7f7f7;
border-color: #ccc;
@ -266,11 +330,14 @@ body {
padding: 1em;
text-align: center;
&:hover, &:focus, &:active {
&:hover,
&:focus,
&:active {
background: #f5f5f5;
border-color: #aaa;
}
}
a.button-primary {
color: #fff;
background-color: #bb77ae;
@ -278,7 +345,9 @@ body {
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 0 #a36597;
text-shadow: 0 -1px 1px #a36597, 1px 0 1px #a36597, 0 1px 1px #a36597, -1px 0 1px #a36597;
&:hover, &:focus, &:active {
&:hover,
&:focus,
&:active {
color: #fff;
background: #a36597;
border-color: #a36597;
@ -286,9 +355,10 @@ body {
}
}
}
li a::before {
color: #82878c;
font: normal 20px/1 'dashicons';
font: normal 20px/1 "dashicons";
speak: none;
display: inline-block;
padding: 0 10px 0 0;
@ -297,32 +367,39 @@ body {
text-decoration: none !important;
vertical-align: top;
}
.learn-more a::before {
content: '\f105';
content: "\f105";
}
.video-walkthrough a::before {
content: '\f126';
content: "\f126";
}
.newsletter a::before {
content: '\f465';
content: "\f465";
}
}
}
.woocommerce-newsletter,
.updated {
padding: 24px 24px 0;
margin: 0 0 24px;
overflow: hidden;
background: #f5f5f5;
p {
padding: 0;
margin: 0 0 12px;
}
form,
p:last-child {
margin: 0 0 24px;
}
}
.woocommerce-tracker {
margin: 24px 0;
border: 1px solid #eee;
@ -334,6 +411,7 @@ body {
font-size: 14px;
line-height: 1.5em;
}
.checkbox {
line-height: 24px;
font-weight: 500;
@ -342,32 +420,38 @@ body {
margin-bottom: 20px;
}
}
.checkbox {
input[type="checkbox"] {
opacity: 0;
position: absolute;
left: -9999px;
}
label {
position: relative;
display: inline-block;
padding-left: 28px;
&:before,
&:after {
&::before,
&::after {
position: absolute;
content: "";
display: inline-block;
}
&:before {
&::before {
height: 16px;
width: 16px;
left: 0px;
left: 0;
top: 3px;
border: 1px solid #aaa;
background-color: #fff;
border-radius: 3px;
}
&:after {
&::after {
height: 5px;
width: 9px;
border-left: 2px solid;
@ -378,21 +462,26 @@ body {
color: #fff;
}
}
input[type="checkbox"] + label::after {
content: none;
}
input[type="checkbox"]:checked + label::after {
content: "";
}
input[type="checkbox"]:focus + label::before {
outline: rgb(59, 153, 252) auto 5px;
}
input[type="checkbox"]:checked + label::before {
background: #935687;
border-color: #935687;
}
}
}
.wc-setup-steps {
padding: 0 0 24px;
margin: 0;
@ -401,6 +490,7 @@ body {
color: #ccc;
width: 100%;
display: inline-flex;
li {
width: 100%;
float: left;
@ -410,6 +500,7 @@ body {
position: relative;
border-bottom: 4px solid #ccc;
line-height: 1.4em;
a {
color: #a16696;
text-decoration: none;
@ -417,14 +508,17 @@ body {
margin: -1.5em;
position: relative;
z-index: 1;
&:hover, &:focus {
&:hover,
&:focus {
color: #111;
text-decoration: underline;
}
}
}
li::before {
content: '';
content: "";
border: 4px solid #ccc;
border-radius: 100%;
width: 4px;
@ -436,27 +530,33 @@ body {
margin-bottom: -8px;
background: #fff;
}
li.active {
border-color: #a16696;
color: #a16696;
font-weight: bold;
&::before {
border-color: #a16696;
}
}
li.done {
border-color: #a16696;
color: #a16696;
&::before {
border-color: #a16696;
background: #a16696;
}
}
}
.wc-setup .wc-setup-actions {
overflow: hidden;
margin: 20px 0 0;
position: relative;
.button {
font-size: 1.25em;
padding: 0.5em 1em;
@ -466,6 +566,7 @@ body {
height: auto;
border-radius: 4px;
}
.button-primary {
background-color: #bb77ae;
border-color: #a36597;
@ -474,7 +575,9 @@ body {
margin: 0;
opacity: 1;
&:hover, &:focus, &:active {
&:hover,
&:focus,
&:active {
background: #a36597;
border-color: #a36597;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 0 #a36597;
@ -499,9 +602,10 @@ body {
}
.wc-wizard-storefront {
.wc-wizard-storefront-intro {
padding: 40px 40px 0;
background: #F5F5F5;
background: #f5f5f5;
text-align: center;
img {
@ -510,12 +614,14 @@ body {
display: block;
}
}
.wc-wizard-storefront-features {
list-style: none outside;
margin: 0 0 20px;
padding: 0 0 0 30px;
overflow: hidden;
}
.wc-wizard-storefront-feature {
margin: 0;
padding: 20px 30px 20px 2em;
@ -526,31 +632,39 @@ body {
margin-left: -2em;
position: absolute;
}
&.first {
clear: both;
float: left;
}
&.last {
float: right;
}
}
.wc-wizard-storefront-feature__bulletproof::before {
content: '🔒';
content: "🔒";
}
.wc-wizard-storefront-feature__mobile::before {
content: '📱';
content: "📱";
}
.wc-wizard-storefront-feature__accessibility::before {
content: '👓';
content: "👓";
}
.wc-wizard-storefront-feature__search::before {
content: '🔍';
content: "🔍";
}
.wc-wizard-storefront-feature__compatibility::before {
content: '🔧';
content: "🔧";
}
.wc-wizard-storefront-feature__extendable::before {
content: '🎨';
content: "🎨";
}
}
@ -617,23 +731,15 @@ body {
padding: 2px 0;
}
&.klarna-logo .wc-wizard-service-name {
background: #000000;
img {
&.klarna-logo .wc-wizard-service-name img {
max-width: 87px;
padding: 12px 0;
}
}
&.square-logo .wc-wizard-service-name {
background: #000000;
img {
&.square-logo .wc-wizard-service-name img {
max-width: 95px;
padding: 12px 0;
}
}
&.eway-logo .wc-wizard-service-name img {
max-width: 87px;
@ -688,7 +794,7 @@ body {
display: none;
}
&:before {
&::before {
content: "";
display: block;
width: 16px;
@ -704,7 +810,7 @@ body {
border-color: #999;
background-color: #999;
&:before {
&::before {
right: auto;
left: 0;
}
@ -723,6 +829,7 @@ body {
}
&.checked {
.wc-wizard-service-settings {
display: inline-block;
@ -752,11 +859,14 @@ body {
position: absolute;
visibility: visible;
}
&.closed {
.wc-wizard-service-enable::before {
content: "\f347"; // down chevron
}
}
.wc-wizard-service-enable input {
visibility: hidden;
position: relative;
@ -819,12 +929,14 @@ body {
flex-direction: column;
color: #a6a6a6;
}
.wc-wizard-service-item:not(:first-child) .wc-wizard-service-description {
font-size: 0.92em;
padding-bottom: 10px;
}
.shipping-method-setting {
input {
width: 95px; // match dropdown height
border: 1px solid #aaa;
@ -843,14 +955,16 @@ body {
.shipping-method-description,
.shipping-method-setting .description {
color: #7e7e7e;
font-size: .9em;
font-size: 0.9em;
}
.shipping-method-setting input::placeholder {
color: #e1e1e1;
}
}
.wc-setup-shipping-units {
p {
line-height: 1.5em;
font-size: 13px;
@ -917,16 +1031,20 @@ h3.jetpack-reasons {
font-size: 14px;
}
.jetpack-logo, .wcs-notice {
.jetpack-logo,
.wcs-notice {
display: block;
margin: 1.75em auto 2em auto;
max-height: 175px;
}
.activate-splash {
.jetpack-logo {
width: 170px;
margin-bottom: 0;
}
.wcs-notice {
margin-top: 1em;
padding-left: 57px;
@ -966,11 +1084,11 @@ h3.jetpack-reasons {
}
.plugin-install-info-list-item::after {
content: ', ';
content: ", ";
}
.plugin-install-info-list-item:last-of-type::after {
content: '. ';
content: ". ";
}
a {
@ -1019,12 +1137,14 @@ h3.jetpack-reasons {
}
.address-step {
.select2 {
min-width: 100%; // widen currency, product type dropdowns
}
}
.store-address-container {
.city-and-postcode {
display: flex;
@ -1037,21 +1157,25 @@ h3.jetpack-reasons {
}
}
}
input[type="text"],
select,
.select2-container {
margin-bottom: 10px;
}
}
.product-type-container {
margin-top: 14px;
margin-bottom: 1px;
}
#woocommerce_sell_in_person {
margin-left: 0;
}
.wc-wizard-service-settings {
.payment-email-input {
border: 1px solid #aaa;
border-color: #ddd;
@ -1132,6 +1256,7 @@ h3.jetpack-reasons {
}
p {
&.next-step-heading {
margin: 0;
font-size: 0.95em;
@ -1145,6 +1270,7 @@ h3.jetpack-reasons {
}
h3 {
&.next-step-description {
margin: 0;
font-size: 16px;
@ -1166,6 +1292,7 @@ h3.jetpack-reasons {
font-size: 15px;
margin: 1em 0 1em 1.5em;
}
.button::last-child {
margin-right: 1.5em;
}
@ -1177,11 +1304,11 @@ p.next-steps-help-text {
color: #9f9f9f;
padding: 0 2em;
text-align: center;
font-size: .9em;
font-size: 0.9em;
}
p.jetpack-terms {
font-size: .8em;
font-size: 0.8em;
text-align: center;
max-width: 480px;
margin: 0 auto;
@ -1213,7 +1340,8 @@ p.jetpack-terms {
}
}
.wc-wizard-service-setting-stripe_create_account, .wc-wizard-service-setting-ppec_paypal_reroute_requests {
.wc-wizard-service-setting-stripe_create_account,
.wc-wizard-service-setting-ppec_paypal_reroute_requests {
display: flex;
align-items: flex-start;
@ -1225,17 +1353,20 @@ p.jetpack-terms {
width: 1.5em;
}
.stripe_create_account, .ppec_paypal_reroute_requests {
.stripe_create_account,
.ppec_paypal_reroute_requests {
order: 2;
margin-left: 0.3em;
}
}
.wc-wizard-service-setting-stripe_email, .wc-wizard-service-setting-ppec_paypal_email {
.wc-wizard-service-setting-stripe_email,
.wc-wizard-service-setting-ppec_paypal_email {
margin-top: 0.75em;
margin-left: 1.5em;
label.stripe_email, label.ppec_paypal_email {
label.stripe_email,
label.ppec_paypal_email {
position: absolute;
margin: -1px;
padding: 0;
@ -1248,7 +1379,7 @@ p.jetpack-terms {
input.payment-email-input {
box-sizing: border-box;
margin-bottom: .5em;
margin-bottom: 0.5em;
width: 100%;
height: 32px;
}
@ -1272,10 +1403,12 @@ p.jetpack-terms {
align-items: center;
margin-bottom: 1.5em;
&:before, &:after {
&::before,
&::after {
top: auto;
}
&:after {
&::after {
margin-top: -1.5px;
}
}
@ -1309,16 +1442,17 @@ p.jetpack-terms {
&.recommended-item-icon-woocommerce_services {
background-color: #f0f0f0;
max-height: 1.5em;
padding: 1.3em .7em;
padding: 1.3em 0.7em;
}
&.recommended-item-icon-shipstation {
background-color: #f0f0f0;
padding: .3em;
padding: 0.3em;
}
}
.recommended-item-description-container {
h3 {
font-size: 15px;
font-weight: bold;
@ -1343,6 +1477,7 @@ p.jetpack-terms {
}
.wc-setup {
#tiptip_content {
background: #5f6973;
}
@ -1359,13 +1494,17 @@ p.jetpack-terms {
}
@media only screen and (max-width: 400px) {
#wc-logo img {
max-width: 80%;
}
.wc-setup-steps {
display: none;
}
.store-address-container {
.city-and-postcode {
display: block;
@ -1374,43 +1513,55 @@ p.jetpack-terms {
}
}
}
.wc-wizard-service-item,
.wc-wizard-services-list-toggle {
flex-wrap: wrap;
.wc-wizard-service-enable {
order: 2;
padding: 20px 0 0;
}
.wc-wizard-service-description {
order: 3;
}
.wc-wizard-service-name {
padding: 20px 20px 0;
text-align: left;
justify-content: space-between !important;
img {
margin: 0;
}
}
}
.newsletter-form-container {
display: block;
.newsletter-form-email {
display: block;
box-sizing: border-box;
width: 100%;
margin-bottom: 10px;
}
.button.newsletter-form-button {
float: left;
}
}
.wc-wizard-next-steps .wc-wizard-next-step-item {
flex-wrap: wrap;
.wc-wizard-next-step-description {
margin-bottom: 0;
}
.wc-wizard-next-step-action {
p {
margin: 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -1393,7 +1393,7 @@ class WC_Admin_Setup_Wizard {
'name' => __( 'WooCommerce PayPal Checkout Gateway', 'woocommerce' ),
'image' => WC()->plugin_url() . '/assets/images/paypal.png',
'description' => $paypal_checkout_description,
'enabled' => true,
'enabled' => false,
'class' => 'checked paypal-logo',
'repo-slug' => 'woocommerce-gateway-paypal-express-checkout',
'settings' => array(
@ -1432,7 +1432,7 @@ class WC_Admin_Setup_Wizard {
'klarna_checkout' => array(
'name' => __( 'Klarna Checkout for WooCommerce', 'woocommerce' ),
'description' => $klarna_checkout_description,
'image' => WC()->plugin_url() . '/assets/images/klarna-white.png',
'image' => WC()->plugin_url() . '/assets/images/klarna-black.png',
'enabled' => true,
'class' => 'klarna-logo',
'repo-slug' => 'klarna-checkout-for-woocommerce',
@ -1440,7 +1440,7 @@ class WC_Admin_Setup_Wizard {
'klarna_payments' => array(
'name' => __( 'Klarna Payments for WooCommerce', 'woocommerce' ),
'description' => $klarna_payments_description,
'image' => WC()->plugin_url() . '/assets/images/klarna-white.png',
'image' => WC()->plugin_url() . '/assets/images/klarna-black.png',
'enabled' => true,
'class' => 'klarna-logo',
'repo-slug' => 'klarna-payments-for-woocommerce',
@ -1448,9 +1448,9 @@ class WC_Admin_Setup_Wizard {
'square' => array(
'name' => __( 'WooCommerce Square', 'woocommerce' ),
'description' => $square_description,
'image' => WC()->plugin_url() . '/assets/images/square-white.png',
'image' => WC()->plugin_url() . '/assets/images/square-black.png',
'class' => 'square-logo',
'enabled' => true,
'enabled' => false,
'repo-slug' => 'woocommerce-square',
),
'eway' => array(
@ -1503,16 +1503,31 @@ class WC_Admin_Setup_Wizard {
}
if ( $spotlight ) {
$offered_gateways = array(
$offered_gateways = array();
if ( $can_stripe ) {
$gateways['stripe']['enabled'] = true;
$gateways['stripe']['featured'] = true;
$offered_gateways += array( 'stripe' => $gateways['stripe'] );
} elseif ( $can_paypal ) {
$gateways['ppec_paypal']['enabled'] = true;
}
if ( in_array( $spotlight, array( 'klarna_checkout', 'klarna_payments' ), true ) ) {
$gateways[ $spotlight ]['enabled'] = true;
$gateways[ $spotlight ]['featured'] = false;
$offered_gateways += array(
$spotlight => $gateways[ $spotlight ],
);
if ( $can_paypal ) {
$offered_gateways += array( 'ppec_paypal' => $gateways['ppec_paypal'] );
} else {
$offered_gateways += array(
$spotlight => $gateways[ $spotlight ],
);
}
if ( $can_stripe ) {
$offered_gateways += array( 'stripe' => $gateways['stripe'] );
if ( $can_paypal ) {
$offered_gateways += array( 'ppec_paypal' => $gateways['ppec_paypal'] );
}
if ( $can_eway ) {
@ -1532,6 +1547,8 @@ class WC_Admin_Setup_Wizard {
$gateways['stripe']['enabled'] = true;
$gateways['stripe']['featured'] = true;
$offered_gateways += array( 'stripe' => $gateways['stripe'] );
} elseif ( $can_paypal ) {
$gateways['ppec_paypal']['enabled'] = true;
}
if ( $can_paypal ) {
@ -1596,7 +1613,7 @@ class WC_Admin_Setup_Wizard {
// Show the user-saved state if it was previously saved.
// Otherwise, rely on the item info.
if ( is_array( $previously_saved_settings ) ) {
$should_enable_toggle = isset( $previously_saved_settings['enabled'] ) && 'yes' === $previously_saved_settings['enabled'];
$should_enable_toggle = ( isset( $previously_saved_settings['enabled'] ) && 'yes' === $previously_saved_settings['enabled'] ) ? true : ( isset( $item_info['enabled'] ) && $item_info['enabled'] );
} else {
$should_enable_toggle = isset( $item_info['enabled'] ) && $item_info['enabled'];
}

View File

@ -1,8 +1,11 @@
<?php
/**
* Class WC_Tests_Setup_Functions.
* @package WooCommerce\Tests\Setup
*/
/**
* Class Functions.
* @package WooCommerce\Tests\Setup
* Class WC_Tests_Setup_Functions.
*/
class WC_Tests_Setup_Functions extends WC_Unit_Test_Case {
@ -15,73 +18,90 @@ class WC_Tests_Setup_Functions extends WC_Unit_Test_Case {
public function test_wizard_in_cart_payment_gateways() {
$setup_wizard = new WC_Admin_Setup_Wizard();
function get_enabled( $gateway ) {
return isset( $gateway['enabled'] ) && $gateway['enabled'];
}
function gateways( $setup_wizard ) {
return array_map( 'get_enabled', $setup_wizard->get_wizard_in_cart_payment_gateways() );
}
// non-admin user
// non-admin user.
$this->user_id = $this->factory->user->create( array( 'role' => 'shop_manager' ) );
wp_set_current_user( $this->user_id );
$this->assertEquals(
gateways( $setup_wizard ),
array(
'paypal' => false,
)
),
$this->get_gateways_statuses( $setup_wizard )
);
// set admin user
// set admin user.
$this->user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
wp_set_current_user( $this->user_id );
update_option( 'woocommerce_default_country', 'US' );
$this->assertEquals(
gateways( $setup_wizard ),
array(
'stripe' => true,
'ppec_paypal' => true,
)
'ppec_paypal' => false,
),
$this->get_gateways_statuses( $setup_wizard )
);
update_option( 'woocommerce_default_country', 'CN' );
$this->assertEquals(
gateways( $setup_wizard ),
array(
'ppec_paypal' => true,
)
),
$this->get_gateways_statuses( $setup_wizard )
);
update_option( 'woocommerce_default_country', 'SE' );
$this->assertEquals(
gateways( $setup_wizard ),
array(
'klarna_checkout' => true,
'ppec_paypal' => true,
'stripe' => false,
)
'ppec_paypal' => false,
'stripe' => true,
),
$this->get_gateways_statuses( $setup_wizard )
);
update_option( 'woocommerce_default_country', 'DE' );
$this->assertEquals(
gateways( $setup_wizard ),
array(
'klarna_payments' => true,
'ppec_paypal' => true,
'stripe' => false,
)
'ppec_paypal' => false,
'stripe' => true,
),
$this->get_gateways_statuses( $setup_wizard )
);
update_option( 'woocommerce_default_country', 'GB' );
update_option( 'woocommerce_sell_in_person', 'yes' );
$this->assertEquals(
gateways( $setup_wizard ),
array(
'square' => true,
'ppec_paypal' => true,
'stripe' => false,
)
'square' => false,
'ppec_paypal' => false,
'stripe' => true,
),
$this->get_gateways_statuses( $setup_wizard )
);
}
/**
* Helper method to call the tested method and return a simplified version
* of the returned values. It returns only if the gateways are enable or not
* which is what we are currently checking in the tests.
*
* @param WC_Admin_Setup_Wizard $setup_wizard Setup wizard object.
*
* @return array
*/
protected function get_gateways_statuses( $setup_wizard ) {
return array_map( array( $this, 'get_enabled' ), $setup_wizard->get_wizard_in_cart_payment_gateways() );
}
/**
* Return wheter a given gateway is enable or not.
*
* @param array $gateway Gateway information.
* @return bool
*/
protected function get_enabled( $gateway ) {
return isset( $gateway['enabled'] ) && $gateway['enabled'];
}
}