Skip to content

Commit

Permalink
Merge pull request #102 from victorpahuus/patch-1
Browse files Browse the repository at this point in the history
Update woocommerce-onpay.php
  • Loading branch information
ebbesmoeller authored Jan 17, 2024
2 parents 3675d1b + fa12443 commit 177d27b
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions woocommerce-onpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,7 @@ public function admin_options() {
echo ent2ncr($html);
return;
} catch (OnPay\API\Exception\TokenException $exception) { // Something's wrong with the token, print link to reauth
$html .= $this->getOnboardingHtml();
$html .= '<hr>';
$html .= '<a href="' . $onpayApi->authorize() . '" class="button-primary">' . __('Log in with OnPay account', 'wc-onpay') . '</a>';
$html .= $this->getOnboardingHtml($onpayApi->authorize());
$GLOBALS['hide_save_button'] = true;
$hideForm = true;
}
Expand Down Expand Up @@ -1272,15 +1270,19 @@ private function json_response($message, $error = false, $responseCode = 200) {
die(wp_json_encode($response));
}

private function getOnboardingHtml() {
$html = '<span>' . __('Don\'t have an OnPay account yet? Order one through DanDomain from DKK 0,- per month.', 'wc-onpay') . '</span>';
$html .= '&nbsp;';
$html .= '<a href="https://dandomain.dk/betalingssystem/priser" class="button-primary" target="_blank">' . __('Get OnPay now', 'wc-onpay') . '</a>';
$html .= '&nbsp;';
$html .= '<a href="https://onpay.io/#brands" class="button" target="_blank">' . __('OnPay sellers', 'wc-onpay') . '</a>';

return $html;
}
private function getOnboardingHtml($authUrl) {
$html = '<div style="border-radius: .25rem; text-align: center; background-color: #ffffff; box-shadow: 0 15px 35px rgba(50,50,93,.1), 0 5px 15px rgba(0,0,0,.07); -webkit-box-shadow: 0 15px 35px rgba(50,50,93,.1), 0 5px 15px rgba(0,0,0,.07); padding: 1.25rem; max-width: 500px; min-height: 200px; display: flex; flex-direction: column; justify-content: space-between;">';
$html .= '<a href="' . $authUrl . '" style="background-color: #fb617f; color: #fff; border-color: #fb617f; font-weight: bold; padding: .75rem; font-size: 1rem; line-height: 1.5; border-radius: .25rem; text-decoration: none;">' . __('Log in with OnPay account', 'wc-onpay') . '</a>';
$html .= '<hr style="border-top: 1px solid rgba(0,0,0,.1); width: 100%; margin: 20px 0 20px 0;">';
$html .= '<h3 style="margin: 0 0 15px 0;">' . __('Don\'t have an OnPay account yet?', 'wc-onpay') . '</h3>';
$html .= '<span style="margin-bottom: auto;">' . __('Order one through DanDomain from DKK 0,- per month.', 'wc-onpay') . '</span>';
$html .= '<div style="display: flex;flex-wrap: wrap;align-content: space-between;">';
$html .= '<a href="https://dandomain.dk/betalingssystem/priser" style="margin: auto; width: 43%; background-color: #fb617f; color: #fff; border-color: #fb617f; font-weight: bold; padding: .375rem .75rem; line-height: 1.5; border-radius: .25rem; text-decoration: none;" target="_blank">' . __('Get OnPay now', 'wc-onpay') . '</a>';
$html .= '<a href="https://onpay.io/#brands" style="margin: auto; width: 43%; background-color: #fff; color: #fb617f; border: 1px solid #fb617f; font-weight: bold; padding: .375rem .75rem; line-height: 1.5; border-radius: .25rem; text-decoration: none;" target="_blank">' . __('OnPay sellers', 'wc-onpay') . '</a>';
$html .= '</div></div>';

return $html;
}

/**
* Return the name of the option in the WP DB.
Expand Down

0 comments on commit 177d27b

Please sign in to comment.