Skip to content

Commit

Permalink
Update shipping onLoad
Browse files Browse the repository at this point in the history
  • Loading branch information
nano2dev authored May 22, 2024
1 parent 0ff05df commit 7eca5fb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions latest.js
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,10 @@
window.NanoPay.config.contact_email = config.email || localStorage.getItem('nano-pay-contact-email')
window.NanoPay.config.mailing_address = config.mailing_address || (localStorage.getItem('nano-pay-mailing-address') ? JSON.parse(localStorage.getItem('nano-pay-mailing-address')) : { first_name: '', last_name: '', street_address: '', street_address_two: '', city: '', state: '', postal_code: '', country: 'US' })

if (localStorage.getItem('nano-pay-mailing-address')) {
config.onShippingUpdate(window.NanoPay.config.mailing_address, window.NanoPay.updateShipping)
}

var template = `<div id="nano-pay-backdrop" onclick="window.NanoPay.cancel(); return"></div>
<div id="nano-pay-body">
Expand Down Expand Up @@ -1141,12 +1145,12 @@
if (window.NanoPay.config && window.NanoPay.config.onShippingUpdate) {
if ( window.NanoPay.config.onShippingUpdate && window.NanoPay.config.onShippingUpdate.constructor.name === 'AsyncFunction' ) {
var async_return = await window.NanoPay.config.onShippingUpdate(window.NanoPay.config.mailing_address, window.NanoPay.updateShipping)
if (!async_return) return
// if (!async_return) return
if (typeof async_return === 'Object') window.NanoPay.config.mailing_addres = async_return
}
if ( window.NanoPay.config.onShippingUpdate && window.NanoPay.config.onShippingUpdate.constructor.name !== 'AsyncFunction' ) {
var sync_return = window.NanoPay.config.onShippingUpdate(window.NanoPay.config.mailing_address, window.NanoPay.updateShipping)
if (!sync_return) return
// if (!sync_return) return
if (typeof sync_return === 'Object') window.NanoPay.config.mailing_addres = sync_return
}
}
Expand Down

0 comments on commit 7eca5fb

Please sign in to comment.