get( 'onboarding.state' ); /* @var Bearer $bearer The bearer. */ $bearer = $c->get( 'api.bearer' ); /* @var DccApplies $dcc_applies The ddc applies. */ $dcc_applies = $c->get( 'api.helpers.dccapplies' ); /* @var MessagesApply $messages_apply The messages apply. */ $messages_apply = $c->get( 'button.helper.messages-apply' ); /* @var Renderer $renderer The renderer. */ $renderer = $c->get( 'status-report.renderer' ); $items = array( array( 'label' => esc_html__( 'Onboarded', 'woocommerce-paypal-payments' ), 'description' => esc_html__( 'Whether PayPal account is correctly configured or not.', 'woocommerce-paypal-payments' ), 'value' => $this->onboarded( $bearer, $state ), ), array( 'label' => esc_html__( 'Shop country code', 'woocommerce-paypal-payments' ), 'description' => esc_html__( 'Country / State value on Settings / General / Store Address.', 'woocommerce-paypal-payments' ), 'value' => wc_get_base_location()['country'], ), array( 'label' => esc_html__( 'PayPal card processing available in country', 'woocommerce-paypal-payments' ), 'description' => esc_html__( 'Whether PayPal card processing is available in country or not.', 'woocommerce-paypal-payments' ), 'value' => $dcc_applies->for_country_currency() ? esc_html__( 'Yes', 'woocommerce-paypal-payments' ) : esc_html__( 'No', 'woocommerce-paypal-payments' ), ), array( 'label' => esc_html__( 'Pay Later messaging available in country', 'woocommerce-paypal-payments' ), 'description' => esc_html__( 'Whether Pay Later is available in country or not.', 'woocommerce-paypal-payments' ), 'value' => $messages_apply->for_country() ? esc_html__( 'Yes', 'woocommerce-paypal-payments' ) : esc_html__( 'No', 'woocommerce-paypal-payments' ), ), array( 'label' => esc_html__( 'Vault enabled', 'woocommerce-paypal-payments' ), 'description' => esc_html__( 'Whether vaulting is enabled on PayPal account or not.', 'woocommerce-paypal-payments' ), 'value' => $this->vault_enabled( $bearer ), ), ); echo wp_kses_post( $renderer->render( esc_html__( 'WooCommerce PayPal Payments', 'woocommerce-paypal-payments' ), $items ) ); } ); } /** * {@inheritDoc} */ public function getKey() { } /** * It returns the current onboarding status. * * @param Bearer $bearer The bearer. * @param State $state The state. * @return string */ private function onboarded( $bearer, $state ): string { try { $token = $bearer->bearer(); } catch ( RuntimeException $exception ) { return esc_html__( 'No', 'woocommerce-paypal-payments' ); } $current_state = $state->current_state(); if ( $token->is_valid() && $current_state === $state::STATE_ONBOARDED ) { return esc_html__( 'Yes', 'woocommerce-paypal-payments' ); } return esc_html__( 'No', 'woocommerce-paypal-payments' ); } /** * It returns whether vaulting is enabled or not. * * @param Bearer $bearer The bearer. * @return string */ private function vault_enabled( $bearer ) { try { $token = $bearer->bearer(); return $token->vaulting_available() ? esc_html__( 'Yes', 'woocommerce-paypal-payments' ) : esc_html__( 'No', 'woocommerce-paypal-payments' ); } catch ( RuntimeException $exception ) { return esc_html__( 'No', 'woocommerce-paypal-payments' ); } } }