diff --git a/src/lib/ae_events_stores.ts b/src/lib/ae_events_stores.ts index bbb4e616..73564c5a 100644 --- a/src/lib/ae_events_stores.ts +++ b/src/lib/ae_events_stores.ts @@ -91,7 +91,7 @@ export let events_loc: Writable = localStorageStore('ae_ events_loc', e // Temporary app data. This should be stored to session storage. // Updated 2024-03-06 let events_session_data_struct: key_val = { - 'ver': '2024-03-06_17', + 'ver': '2024-03-19_17', // Shared 'ds': { 'submit_status': null, @@ -130,6 +130,24 @@ let events_session_data_struct: key_val = { qr_scan_result: null, }, + 'stripe': { + 'license_qty': 1, + 'rental_qty': 0, + 'rental_option': true, + 'api_use': false, + 'client_reference_id': null, + 'publishable_key': 'pk_live_zqaWNDfak2eDHeqnRiyaJcFi', + 'btn_payment_id': null, + 'btn_1_license': 'buy_btn_1OvqWJ2gJkNsDuiNqMCWz5nG', + 'btn_1_license_rental': 'buy_btn_1OvqVA2gJkNsDuiNhk9r8Io2', + 'btn_3_license': 'buy_btn_1OvrI22gJkNsDuiNXjBg3c4Y', + 'btn_3_license_rental': 'buy_btn_1OvrKa2gJkNsDuiNhSBCkNau', + 'btn_6_license': 'buy_btn_1OvrWc2gJkNsDuiN7mnwvZNL', + 'btn_6_license_rental': 'buy_btn_1OvrXP2gJkNsDuiNZpWZs3Uy', + 'btn_10_license': 'buy_btn_1OvrPM2gJkNsDuiNRCMHfSuz', + 'btn_10_license_rental': 'buy_btn_1OvrPs2gJkNsDuiN1nPkjPOM', + }, + // Presentation Management (Distributing) // Speakers Management (Collection) diff --git a/src/routes/events_leads/exhibit/[slug]/leads_payment.svelte b/src/routes/events_leads/exhibit/[slug]/leads_payment.svelte index 3aec87db..8ab3ce7b 100644 --- a/src/routes/events_leads/exhibit/[slug]/leads_payment.svelte +++ b/src/routes/events_leads/exhibit/[slug]/leads_payment.svelte @@ -14,6 +14,83 @@ let event_exhibit_obj = liveQuery( () => db_events.exhibits.get($events_slct.exhibit_id) ); +if (!$events_sess.stripe) { + $events_sess.stripe = {}; +} +if (!$events_sess.stripe.license_qty) { + $events_sess.stripe.license_qty = 1; + $events_sess.stripe.rental_qty = 0; + $events_sess.stripe.client_reference_id = $events_slct.exhibit_id; + // $events_sess.stripe.btn_payment_id + + console.log(`$events_sess.stripe =`, $events_sess.stripe); +} + +// $: if ($events_sess.stripe.rental_option) { +// console.log('Rental Option', $events_sess.stripe.rental_option); +// if ($events_sess.stripe.rental_option == true && !$events_sess.stripe.rental_qty) { +// $events_sess.stripe.rental_qty = 1; +// } else if (!$events_sess.stripe.rental_option) { +// $events_sess.stripe.rental_qty = 0; +// } +// } else { +// $events_sess.stripe.rental_option = false; +// } + +$: if ($events_sess.stripe && $events_sess.stripe.license_qty >= 0 || $events_sess.stripe.rental_qty >= 0) { + console.log(`$events_sess.stripe.license_qty=${$events_sess.stripe.license_qty} and $events_sess.stripe.rental_qty=${$events_sess.stripe.rental_qty}`); + // $events_sess.stripe.license_qty = parseInt($events_sess.stripe.license_qty); + + // $events_sess.stripe.rental_qty = parseInt($events_sess.stripe.rental_qty); + + if ($events_sess.stripe.rental_qty == 0) { + // $events_sess.stripe.rental_qty = 0; + + if ($events_sess.stripe.license_qty == 1) { + $events_sess.stripe.btn_payment_id = $events_sess.stripe.btn_1_license; + } + if ($events_sess.stripe.license_qty == 3) { + $events_sess.stripe.btn_payment_id = $events_sess.stripe.btn_3_license; + } + if ($events_sess.stripe.license_qty == 6) { + $events_sess.stripe.btn_payment_id = $events_sess.stripe.btn_6_license; + } + if ($events_sess.stripe.license_qty == 10) { + $events_sess.stripe.btn_payment_id = $events_sess.stripe.btn_10_license; + } + } else { + if ($events_sess.stripe.license_qty == 1) { + $events_sess.stripe.btn_payment_id = $events_sess.stripe.btn_1_license_rental; + } + if ($events_sess.stripe.license_qty == 3) { + $events_sess.stripe.btn_payment_id = $events_sess.stripe.btn_3_license_rental; + } + if ($events_sess.stripe.license_qty == 6) { + $events_sess.stripe.btn_payment_id = $events_sess.stripe.btn_6_license_rental; + } + if ($events_sess.stripe.license_qty == 10) { + $events_sess.stripe.btn_payment_id = $events_sess.stripe.btn_10_license_rental; + } + + } + + // We need to force the Stripe Buy Button to reload. I was expecting this to happen automatically lwhent he payment ID changed. + console.log(document.getElementById('stripe_buy_button')); + + if (document.getElementById('stripe_buy_button')) { + document.getElementById('stripe_buy_button').remove(); + + let stripe_buy_button = document.createElement('stripe-buy-button'); + stripe_buy_button.id = 'stripe_buy_button'; + stripe_buy_button.setAttribute('buy-button-id', $events_sess.stripe.btn_payment_id); + stripe_buy_button.setAttribute('publishable-key', $events_sess.stripe.publishable_key); + stripe_buy_button.setAttribute('client-reference-id', $events_sess.stripe.client_reference_id); + document.getElementById('stripe_buy_button_container').appendChild(stripe_buy_button); + } else { + console.log('No Stripe Buy Button found.'); + } + +} @@ -27,89 +104,224 @@ let event_exhibit_obj = liveQuery( {#if $events_loc?.leads.auth_exhibit_kv[$events_slct.exhibit_id]} {#if $event_exhibit_obj?.paid} -

Paid

+

Marked as Paid

{:else} -

Not Paid

+

Not Marked as Paid

+ +
+

Please select the number of licenses to purchase and if you need to rent any tablets for scanning. As a reminder, you can use your own device (cell phone, tablet, laptop, etc) to scan the QR codes on the badges of the attendees. Tablet rentals are limited in supply for ISHLT 2024 in Prague and will be given out on a first come first served basis.

+
- +
+ +

Each person associated with your exhibit needs a license to use the lead retrieval service for exhibitors.

+
-
+ + + + + + + + + + + +
+ +

You can use your own device(s) with this service. Renting tablets for scanning is not required.

+
+ + + + + + + +{#if $events_sess.stripe.btn_payment_id} +
+ + +

You have selected to purchase {$events_sess.stripe.license_qty} user license(s) and rent {$events_sess.stripe.rental_qty} tablet(s). Press the button above to pay by credit card, debit card, or ACH direct debit.

+

WARNING: Please be sure to double check and update the quantities on the next page.

+
+{/if} + + + +
+

NOTE: Your payment will be reviewed and is not reflected immediately on this page for your exhibit. It may take up to 2 business days for this to show as being paid. If you have any questions or concerns please email exhibits@oneskyit.com.

+
+ + -
+ -
+ -
+ -
+ -
+ -
+ -
+ -
+