Skip to content

Commit 279c8ed

Browse files
committed
Small code cleanup changes
1 parent 729fbaf commit 279c8ed

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

paypal/helpers/FrmPayPalLiteConnectHelper.php

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ private static function render_seller_status( $mode ) {
5454
return;
5555
}
5656

57-
$email = ! empty( $status->primary_email ) ? $status->primary_email : '';
57+
$email = $status->primary_email ?? '';
5858

5959
if ( ! $status->primary_email_confirmed ) {
6060
self::render_error( __( 'Primary email not confirmed.', 'formidable' ), $email );
@@ -71,7 +71,11 @@ private static function render_seller_status( $mode ) {
7171
return;
7272
}
7373

74-
$email = $status->primary_email ?? '';
74+
$product = self::check_for_product( $status->products );
75+
if ( ! $product || empty( $product->capabilities ) ) {
76+
self::render_error( __( 'No data was found for expected PayPal product.', 'formidable' ), $email );
77+
return;
78+
}
7579

7680
if ( $email ) {
7781
update_option( self::get_paypal_seller_status_option_name( $mode ), $status, false );
@@ -80,9 +84,33 @@ private static function render_seller_status( $mode ) {
8084
echo '<div class="frm_message">';
8185
esc_html_e( 'Your seller status is valid', 'formidable' );
8286
self::echo_email( $email );
87+
88+
echo '<br>';
89+
echo '<br>';
90+
echo '<b>' . esc_html__( 'Enabled capabilities:', 'formidable' ) . '</b>';
91+
echo '<ul style="list-style: unset; padding-left: 15px; margin-top: 0;">';
92+
$can_process_card_fields = in_array( 'CUSTOM_CARD_PROCESSING', $product->capabilities );
93+
if ( $can_process_card_fields ) {
94+
echo '<li>' . esc_html__( 'Card Processing', 'formidable' ) . '</li>';
95+
}
96+
echo '</ul>';
8397
echo '</div>';
8498
}
8599

100+
/**
101+
* @param array $products
102+
*
103+
* @return bool|object
104+
*/
105+
private static function check_for_product( $products ) {
106+
foreach ( $products as $current_product ) {
107+
if ( 'PPCP_CUSTOM' === $current_product->name ) {
108+
return $current_product;
109+
}
110+
}
111+
return false;
112+
}
113+
86114
private static function echo_email( $email ) {
87115
if ( ! $email ) {
88116
return;

paypal/views/settings/connect-settings-container.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<?php if ( ! is_ssl() ) { ?>
3434
<div>
3535
<em>
36-
<?php esc_html_e( 'Your site is not using SSL. Before using PayPal to collect payments, you will need to install an SSL certificate on your site.', 'formidable' ); // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong ?>
36+
<?php esc_html_e( 'Your site is not using SSL. Before using PayPal to collect payments, you will need to install an SSL certificate on your site.', 'formidable' ); // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong ?>
3737
</em>
3838
</div>
3939
<?php } ?>

0 commit comments

Comments
 (0)