아시아 온천

‘아시아 온천’

예술의전당과 도쿄 신국립극장이 세 번째로 공동 제작한 ‘아시아 온천’은 외딴 섬을 배경으로 토착민과 외지인 간의…

Back to site top
Translate »
" in the success message no longer runs — it // just prints the literal text "prepare_payment();" on the page. We instead bind to NF's JS event // bus (nfRadio) and run prepare_payment() -> call_payment() -> INICIS ourselves after a clean // submit. call_payment() is output ONLY on the INICIS payment page (by the simple_inicis // shortcode), so gating on `typeof call_payment === 'function'` already restricts this to the // subscription page and can never fire on ordinary contact-form pages. All branches log with a // [PAY] prefix so we can see exactly why call_payment() does / doesn't run. jQuery(document).ready(function(){ // '' = fire on the payment page's form regardless of number (the call_payment gate already // isolates the payment page). Set to e.g. '10' or '7' once the [PAY] log confirms the real id. var PAY_LOCK_FORM_ID = ''; function P(){ try { console.log.apply(console, ['[PAY]'].concat([].slice.call(arguments))); } catch(e){} } function getFormId(response){ if (!response) return null; if (response.data && response.data.form_id != null) return response.data.form_id; if (response.data && response.data.id != null) return response.data.id; if (response.form_id != null) return response.form_id; if (response.id != null) return response.id; return null; } function hasErrors(response){ var e = response && response.errors; if (!e) return false; if (e.length) return true; // array form if (typeof e === 'object' && Object.keys(e).length) return true; // object form return false; } function firePayment(fid){ P('FIRE payment. form_id=', fid, '| prepare_payment=', typeof prepare_payment, '| call_payment=', typeof call_payment); if (typeof prepare_payment === 'function') { try { prepare_payment(); P('prepare_payment() completed (it calls call_payment internally)'); } catch (err) { P('ERROR inside prepare_payment():', err); } } else if (typeof call_payment === 'function') { try { call_payment(); P('call_payment() completed (no prepare_payment on page)'); } catch (err) { P('ERROR inside call_payment():', err); } } else { P('ABORT: neither prepare_payment nor call_payment is defined on this page'); } } // (1) Primary path: NF event bus. Poll briefly since the NF bundle loads in the footer. (function waitNF(n){ if (window.nfRadio) { P('nfRadio available -> binding forms/submit:response'); nfRadio.channel('forms').on('submit:response', function(response){ P('submit:response fired. response=', response); var fid = getFormId(response); P('detected form_id=', fid, '| lock=', (PAY_LOCK_FORM_ID || '(any)'), '| call_payment=', typeof call_payment, '| prepare_payment=', typeof prepare_payment); if (hasErrors(response)) { P('SKIP: submission returned errors ->', response.errors); return; } if (typeof call_payment !== 'function') { P('SKIP: call_payment not defined -> not the payment page'); return; } if (PAY_LOCK_FORM_ID && fid != null && String(fid) !== String(PAY_LOCK_FORM_ID)) { P('SKIP: form_id ' + fid + ' != locked ' + PAY_LOCK_FORM_ID); return; } firePayment(fid); }); } else if (n > 0) { if (n === 50) P('waiting for nfRadio...'); setTimeout(function(){ waitNF(n - 1); }, 300); } else { P('ERROR: nfRadio never loaded (NF front-end JS missing on this page?)'); } })(50); // (2) Diagnostic-only backup: watch the raw admin-ajax submit so we still see the request / // response even if the nfRadio binding above never fires. LOG ONLY — never triggers payment. jQuery(document).ajaxComplete(function(evt, xhr, settings){ try { var d = settings && settings.data; if (typeof d !== 'string' || d.indexOf('nf_ajax_submit') === -1) return; var resp = null; try { resp = JSON.parse(xhr.responseText); } catch(e){} P('[ajaxComplete] nf_ajax_submit done. httpStatus=', xhr.status, '| form_id=', getFormId(resp), '| errors=', (resp && resp.errors), '| parsed=', resp); } catch(e){ P('[ajaxComplete] logger error', e); } }); }); var sub_menu_n=0; jQuery(document).ready(function(){ jQuery(".sub-menu,ul.sub-menu,ul#menu-main").mouseout(function(e){ e.preventDefault(); } ); setTimeout('jQuery(".sub-menu").eq(0).show()',500); }); jQuery(document).ready(function(){ });