Merge pull request #26 from woocommerce/issue-19-dcc-logos

Adds spacing to visible logos in checkout, and removes logos and related HTML from order confirmation page.
This commit is contained in:
Rasmy Nguyen 2020-09-28 06:33:30 +00:00 committed by GitHub
commit 5951d796b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 80 additions and 20 deletions

View file

@ -0,0 +1,5 @@
#payment ul.payment_methods li img.ppcp-card-icon {
padding: 0 0 3px 3px;
max-height: 25px;
display: inline-block;
}

View file

@ -321,6 +321,14 @@ class SmartButton implements SmartButtonInterface {
$load_script = true;
}
if ( is_checkout() && $this->can_render_dcc() ) {
wp_enqueue_style(
'ppcp-hosted-fields',
$this->module_url . '/assets/css/hosted-fields.css',
array(),
1
);
}
if ( $load_script ) {
wp_enqueue_script(
'ppcp-smart-button',
@ -459,17 +467,23 @@ class SmartButton implements SmartButtonInterface {
}
/**
* Renders the HTML for the DCC fields.
* Whether DCC fields can be rendered.
*
* @throws \WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException When a setting hasnt been found.
* @return bool
* @throws \WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException When a setting was not found.
*/
private function can_render_dcc() : bool {
return $this->settings->has( 'dcc_enabled' ) && $this->settings->get( 'dcc_enabled' ) && $this->settings->has( 'client_id' ) && $this->settings->get( 'client_id' ) && $this->dcc_applies->for_country_currency();
}
/**
* Renders the HTML for the DCC fields.
*/
public function dcc_renderer() {
$id = 'ppcp-hosted-fields';
$can_render_dcc = $this->dcc_applies->for_country_currency()
&& $this->settings->has( 'client_id' )
&& $this->settings->get( 'client_id' );
if ( ! $can_render_dcc ) {
$id = 'ppcp-hosted-fields';
if ( ! $this->can_render_dcc() ) {
return;
}
@ -489,7 +503,7 @@ class SmartButton implements SmartButtonInterface {
) : '';
printf(
'<div id="%1$s">
'<div id="%1$s" style="display:none;">
<button class="button alt">%6$s</button>
</div><div id="payments-sdk__contingency-lightbox"></div><style id="ppcp-hide-dcc">.payment_method_ppcp-credit-card-gateway {display:none;}</style>',
esc_attr( $id ),

View file

@ -6,7 +6,8 @@ module.exports = {
mode: isProduction ? 'production' : 'development',
target: 'web',
entry: {
button: path.resolve('./resources/js/button.js')
button: path.resolve('./resources/js/button.js'),
"hosted-fields": path.resolve('./resources/css/hosted-fields.scss')
},
output: {
path: path.resolve(__dirname, 'assets/'),