Skip to content

Commit

Permalink
fix: frontend scripts not properly loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcuzz committed Mar 18, 2024
1 parent f499395 commit bac3ebd
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 41 deletions.
3 changes: 3 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ Alternatively you could look into using WooCommerce "Early renewals": [https://d

== Changelog ==

= 1.20.1 =
* Fixed: Frontend scripts were not properly loaded.

= 1.20.0 =
* Added: Webhooks. To enable webhooks you just need to save your settings one more time. A webhook will be automatically set-up.
* Added: Try to detect whether to use Vipps or MobilePay branding.
Expand Down
2 changes: 1 addition & 1 deletion assets/build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-element', 'wp-i18n'), 'version' => '84c5c9476111a1286299');
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-element', 'wp-i18n'), 'version' => '913e8eaa2781e094eb4f');
33 changes: 14 additions & 19 deletions assets/build/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/build/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion includes/wc-gateway-vipps-recurring.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function __construct() {
$this->title = $this->get_form_fields()['brand']['options'][ $this->brand ];
$this->description = str_replace( '{brand}', $this->title, $this->get_option( 'description' ) );
$this->enabled = $this->get_option( 'enabled' );
$this->test_mode = $this->get_option( 'test_mode' );
$this->test_mode = $this->get_option( 'test_mode' ) === "yes";
$this->merchant_serial_number = $this->get_option( 'merchant_serial_number' );
$this->secret_key = $this->get_option( 'secret_key' );
$this->client_id = $this->get_option( 'client_id' );
Expand Down
34 changes: 17 additions & 17 deletions src/pages/PaymentRedirectPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ export default function PaymentRedirectPage () {
const { logo } = window.VippsMobilePaySettings
const searchParams = new URLSearchParams(window.location.search)

// const [response, setResponse] = useState(null)
//
// const intervalHandler = setInterval(() => {
// apiFetch({
// path: `/vipps-mobilepay-recurring/v1/orders/status/${searchParams.get(
// 'order_id')}?key=${searchParams.get('key')}`, method: 'GET',
// }).then(response => setResponse(response))
// }, 1000)
//
// useEffect(() => {
// if (!response || response.status === 'PENDING') {
// return
// }
//
// clearInterval(intervalHandler)
// window.location.href = response.redirect_url
// }, [response])
const [response, setResponse] = useState(null)

const intervalHandler = setInterval(() => {
apiFetch({
path: `/vipps-mobilepay-recurring/v1/orders/status/${searchParams.get(
'order_id')}?key=${searchParams.get('key')}`, method: 'GET',
}).then(response => setResponse(response))
}, 1000)

useEffect(() => {
if (!response || response.status === 'PENDING') {
return
}

clearInterval(intervalHandler)
window.location.href = response.redirect_url
}, [response])

return (<div className={'vipps-recurring-payment-redirect-page'}>
<div className={'vipps-recurring-payment-redirect-page__container'}>
Expand Down
Loading

0 comments on commit bac3ebd

Please sign in to comment.