Skip to content

Commit

Permalink
Add package.js (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
indykoning authored Apr 5, 2023
1 parent db77998 commit 48e7455
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 22 deletions.
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,10 @@ The magento2 core package from MultiSafePay currently contains a bug that preven

## Installation

```
```bash
composer require rapidez/multisafepay
```

And import the JS into your `resources/js/app.js`:

```
import 'Vendor/rapidez/multisafepay/resources/js/multisafepay.js';
```

Then, in your magento -> configuration -> multisafepay -> general settings, enable custom return urls for PWA and use the following return URLs:

```
Expand Down
3 changes: 3 additions & 0 deletions resources/js/components.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import 'Vendor/rapidez/core/resources/js/vue'

Vue.component('msp-pending', () => import('./components/MSPPending.vue'))
12 changes: 12 additions & 0 deletions resources/js/eventlisteners.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
document.addEventListener('turbo:load', () => {
window.app.$on('checkout-payment-saved', (data) => {
if (!data.order.payment_method_code.includes('multisafepay_')) {
return;
}
window.app.checkout.doNotGoToTheNextStep = true
let cart = window.app.user ? 'mine' : localStorage.mask;
magentoUser.get(`/multisafepay/${cart}/payment-url/${data.order.id}`).then(response => {
window.location.replace(response.data);
});
});
})
16 changes: 1 addition & 15 deletions resources/js/multisafepay.js
Original file line number Diff line number Diff line change
@@ -1,15 +1 @@
import MSPPending from './components/MSPPending.vue'
Vue.component('msp-pending', MSPPending)

document.addEventListener('turbo:load', () => {
window.app.$on('checkout-payment-saved', (data) => {
if (!data.order.payment_method_code.includes('multisafepay_')) {
return;
}
window.app.checkout.doNotGoToTheNextStep = true
let cart = window.app.user ? 'mine' : localStorage.mask;
magentoUser.get(`/multisafepay/${cart}/payment-url/${data.order.id}`).then(response => {
window.location.replace(response.data);
});
});
})
import './package'
2 changes: 2 additions & 0 deletions resources/js/package.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import './components'
import './eventlisteners'

0 comments on commit 48e7455

Please sign in to comment.