Skip to content

Commit

Permalink
Merge pull request #23748 from woocommerce/update/obw
Browse files Browse the repository at this point in the history
Onboarding wizard cleanup
  • Loading branch information
rodrigoprimo committed May 21, 2019
2 parents 90aa716 + f8642f2 commit e8844a9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 43 deletions.
Binary file removed assets/images/klarna-white.png
Binary file not shown.
Binary file removed assets/images/square-white.png
Binary file not shown.
61 changes: 18 additions & 43 deletions includes/admin/class-wc-admin-setup-wizard.php
Expand Up @@ -1492,53 +1492,14 @@ public function get_wizard_in_cart_payment_gateways() {
return $can_paypal ? array( 'paypal' => $gateways['paypal'] ) : array();
}

$spotlight = '';
$klarna_or_square = false;

if ( $this->is_klarna_checkout_supported_country( $country ) ) {
$spotlight = 'klarna_checkout';
$klarna_or_square = 'klarna_checkout';
} elseif ( $this->is_klarna_payments_supported_country( $country ) ) {
$spotlight = 'klarna_payments';
$klarna_or_square = 'klarna_payments';
} elseif ( $this->is_square_supported_country( $country ) && get_option( 'woocommerce_sell_in_person' ) ) {
$spotlight = 'square';
}

if ( $spotlight ) {
$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 ],
);

} else {
$offered_gateways += array(
$spotlight => $gateways[ $spotlight ],
);
}

if ( $can_paypal ) {
$offered_gateways += array( 'ppec_paypal' => $gateways['ppec_paypal'] );
}

if ( $can_eway ) {
$offered_gateways += array( 'eway' => $gateways['eway'] );
}

if ( $can_payfast ) {
$offered_gateways += array( 'payfast' => $gateways['payfast'] );
}

return $offered_gateways;
$klarna_or_square = 'square';
}

$offered_gateways = array();
Expand All @@ -1551,6 +1512,20 @@ public function get_wizard_in_cart_payment_gateways() {
$gateways['ppec_paypal']['enabled'] = true;
}

if ( $klarna_or_square ) {
if ( in_array( $klarna_or_square, array( 'klarna_checkout', 'klarna_payments' ), true ) ) {
$gateways[ $klarna_or_square ]['enabled'] = true;
$gateways[ $klarna_or_square ]['featured'] = false;
$offered_gateways += array(
$klarna_or_square => $gateways[ $klarna_or_square ],
);
} else {
$offered_gateways += array(
$klarna_or_square => $gateways[ $klarna_or_square ],
);
}
}

if ( $can_paypal ) {
$offered_gateways += array( 'ppec_paypal' => $gateways['ppec_paypal'] );
}
Expand Down

0 comments on commit e8844a9

Please sign in to comment.