PageSourceSearch

https://suwonmesse.com/wp-content/plugins/messe-hp-membership/js/core-payment.js?ver=1789027275

js suwonmesse.com collected 2026-10-04 13:42:10 UTC 45,351 bytes, 1,046 lines download raw bytes

1var esmem_payment = {
2  pay: {
3    instance: null,
4    payButton: null,
5    init: function (data) {
6      esmem_payment.pay.instance = new Vue({
7        el: '#frm_payment',
8        data: {
9          iParam: data,
10          payButton: null,
11          couponCodes: ['', '', '', '', '', '', '', '', '', ''],
12        },
13        mounted: function () {
14          this.FAR_sd_FairVisitorPayment()
15
16          if (this.iParam.init_ctrl_option_id != 0) {
17            this.iParam.ctrl_option_id = this.iParam.init_ctrl_option_id
18
19            setTimeout(function () {
20              esmem_payment.pay.instance.changeOPTION_ID()
21            }, 300)
22          }
23        },
24        methods: {
25          FAR_sd_FairVisitorPayment: function () {
26            var iFAR_sd_FairVisitorPayment = {
27              fair_visitor_id: this.iParam.fair_visitor_id,
28              cancel_flag: null,
29              date_from: null,
30              date_to: null,
31            }
32
33            esmem.ajax.loadSync(
34              {
35                url: ESMEMBER_API_URL + '/fair/FAR_sd_FairVisitorPayment',
36                data: iFAR_sd_FairVisitorPayment,
37                success: function (result) {
38                  var requestCount = 0
39
40                  result.forEach(function (v, i) {
41                    if (
42                      v.PAYMENT_METHOD_DESC === '신용카드' &&
43                      (v.PAYMENT_STATUS_DESC === '결제요청' ||
44                        v.PAYMENT_STATUS_DESC === '결제중' ||
45                        v.PAYMENT_STATUS_DESC === '미결제')
46                    ) {
47                      esmem_payment.pay.instance.VST_dn_ReqCancel(
48                        {
49                          fair_visitor_id: esmem_payment.pay.instance.iParam.fair_visitor_id,
50                          payment_order_id: null,
51                          update_user: esmem_payment.pay.instance.iParam.mobile,
52                        },
53                        null
54                      )
55                    } else if (
56                      v.PAYMENT_METHOD_DESC === '가상계좌' &&
57                      v.PAYMENT_STATUS_DESC === '입금대기' &&
58                      v.IAMPORT_ID === null
59                    ) {
60                      esmem_payment.pay.instance.VST_dn_ReqCancel(
61                        {
62                          fair_visitor_id: esmem_payment.pay.instance.iParam.fair_visitor_id,
63                          payment_order_id: null,
64                          update_user: esmem_payment.pay.instance.iParam.mobile,
65                        },
66                        null
67                      )
68                    } else {
69                      requestCount += parseInt(v.REQ_CNT)
70                    }
71                  })
72
73                  esmem_payment.pay.instance.iParam.max_cnt = esmem_payment.pay.instance.iParam.max_cnt - requestCount
74
75                  if (esmem_payment.pay.instance.iParam.max_cnt < 0) {
76                    esmem_payment.pay.instance.iParam.max_cnt = 0
77                  }
78
79                  if (esmem_payment.pay.instance.iParam.fair_master_id == 6 && price == 0 && requestCount == 1) {
80                    alert('이미 최대 수량만큼 결제하셨습니다.')
81                    location.href = '?c=payment&a=list&fair_id=' + esmem_payment.pay.instance.iParam.fair_id
82                  }
83                },
84                error: function () {
85                  esmem_payment.pay.instance.iParam.max_cnt = 0
86                },
87              },
88              false
89            )
90          },
91          payment: function (obj) {
92            this.payButton = obj
93            esmem_payment.pay.setBlock(true)
94
95            // 컨트롤 validation 처리
96
97            // 결제 종료일 기준으로 체크 해서 막기
98
99            if (esmem_payment.pay.instance.Validation()) {
100              esmem_payment.pay.instance
101                .VST_in_VisitorReqRegistAddition()
102                .then(esmem_payment.pay.instance.FAR_in_PaymentReqInfo)
103                .then(esmem_payment.pay.instance.IamportRequest)
104                .then(esmem_payment.pay.instance.PAY_Complete)
105                .then(esmem_payment.pay.instance.SendNotification)
106                .then(esmem_payment.pay.instance.Success, esmem_payment.pay.instance.Error)
107                .always(function (data) {})
108              esmem_payment.pay.setBlock(false) //check
109            } else {
110              esmem_payment.pay.setBlock(false)
111            }
112          },
113          VST_in_VisitorReqRegistAddition: function () {
114            var iVST_in_VisitorReqRegistAddition = {
115              visitor_id: esmem_payment.pay.instance.iParam.visitor_id,
116              fair_visitor_id: esmem_payment.pay.instance.iParam.fair_visitor_id,
117              req_cnt: esmem_payment.pay.instance.iParam.req_cnt,
118              mobile: esmem_payment.pay.instance.iParam.mobile,
119              mobile_yn: esmem_payment.pay.instance.iParam.mobile_yn,
120              ip_addr: esmem_payment.pay.instance.iParam.ip_addr,
121              pay_method: esmem_payment.pay.instance.iParam.pay_method,
122              create_user: esmem_payment.pay.instance.iParam.create_user,
123              coupon_codes: esmem_payment.pay.instance.iParam.coupons.join(','),
124              reg_type: esmem_payment.pay.instance.iParam.reg_type,
125            }
126
127            return esmem.ajax.loadSync(
128              {
129                url: ESMEMBER_API_URL + '/visitor/VST_in_VisitorReqRegistAddition',
130                data: iVST_in_VisitorReqRegistAddition,
131              },
132              false
133            )
134          },
135          FAR_in_PaymentReqInfo: function (data) {
136            if (data.State === 'success' && data.VST_in_VisitorReqRegistAddition.ERR_CD == 1) {
137              var iFAR_in_PaymentReqInfo = {
138                req_id: esmem_payment.pay.instance.iParam.fair_visitor_id, // FAIR_VISITOR_ID
139                fair_id: esmem_payment.pay.instance.iParam.fair_id,
140                payment_order_id: data.VST_in_VisitorReqRegistAddition.PAYMENT_ORDER_ID,
141                order_num: data.VST_in_VisitorReqRegistAddition.ORDER_NUM,
142                order_price:
143                  esmem_payment.pay.instance.iParam.ctrl_order_price * esmem_payment.pay.instance.iParam.req_cnt, // 주문금액 (총액, 부가세포함)
144                total_price:
145                  esmem_payment.pay.instance.iParam.ctrl_total_price * esmem_payment.pay.instance.iParam.req_cnt, // 실제금액 (총액, 부가세포함)
146                discount_price:
147                  esmem_payment.pay.instance.iParam.pay_method === '6'
148                    ? esmem_payment.pay.instance.iParam.ctrl_order_price * esmem_payment.pay.instance.iParam.req_cnt
149                    : esmem_payment.pay.instance.iParam.ctrl_discount_price * esmem_payment.pay.instance.iParam.req_cnt, // 할인금액 (총액)
150                option_id: esmem_payment.pay.instance.iParam.option_id, // 결제 옵션 아이디
151                pay_method: esmem_payment.pay.instance.iParam.pay_method, // 결제방법(마스터코드) ( SELECT * FROM MASTER_CODE WHERE MASTER_CODE_GROUP_ID = 11 )
152                mobile_yn: esmem_payment.pay.instance.iParam.mobile_yn, // 모바일 결제 유무 (Y:모바일 결제, N:모바일 아님)
153                ip_addr: esmem_payment.pay.instance.iParam.ip_addr, // 결제요청자 IP주소
154                pay_type: 1, // 1: 사전등록/ 2:세미나(단일&기간권)/ 3: 업체참가비
155                create_user: esmem_payment.pay.instance.iParam.mobile,
156                visitor_id: esmem_payment.pay.instance.iParam.visitor_id,
157                expire_date: data.VST_in_VisitorReqRegistAddition.EXPIRE_DATE, // vbank_expire_date
158              }
159
160              jQuery.extend(esmem_payment.pay.instance.iParam, iFAR_in_PaymentReqInfo)
161
162              return esmem.ajax.loadSync(
163                {
164                  url: ESMEMBER_API_URL + '/fair/FAR_in_PaymentReqInfo',
165                  data: iFAR_in_PaymentReqInfo,
166                },
167                false
168              )
169            } else {
170              return esmem.ajax.fail(data.VST_in_VisitorReqRegistAddition)
171            }
172          },
173          IamportRequest: function (data) {
174            if (data.state === 'Success') {
175              var receiveMobileNumber = []
176              receiveMobileNumber[0] = esmem_payment.pay.instance.iParam.mobile
177              // 아래 코드 중복 이유는 아임포트 가상계좌 입금
177완료 쪽에서 받는 부분을 놔두고 sms_info 를 새로 추가 하였다.
178              var custom_data = {
179                MSG_in_Sendmessge_Visitor: {
180                  fair_visitor_id: esmem_payment.pay.instance.iParam.fair_visitor_id,
181                  template_code: esmem_payment.pay.instance.iParam.template_code,
182                  receiver: esmem_payment.pay.instance.iParam.mobile, // 문자 수신 번호
183                  sender: esmem_payment.pay.instance.iParam.sender, // 문자 발신 번호
184                  sendername: esmem_payment.pay.instance.iParam.sendername, //  문자 발신자 이름
185                  title: '사전등록 안내',
186                  content: esmem_payment.pay.instance.iParam.msg_contents,
187                  // email_info: {
188                  //     to_email: esmem_payment.pay.instance.iParam.to_email,
189                  //     from_email: esmem_payment.pay.instance.iParam.from_email,
190                  //     from_name: esmem_payment.pay.instance.iParam.from_name,
191                  //     send_title: esmem_payment.pay.instance.iParam.email_title,
192                  //     send_contents: esmem_payment.pay.instance.iParam.email_contents
193                  // },
194                  sms_info: {
195                    fair_visitor_id: esmem_payment.pay.instance.iParam.fair_visitor_id,
196                    templatecode: esmem_payment.pay.instance.iParam.template_code,
197                    receiveMobileNumber: receiveMobileNumber, // 문자 수신 번호
198                    callBack: esmem_payment.pay.instance.iParam.sender, // 문자 발신 번호
199                    sender: esmem_payment.pay.instance.iParam.sendername, //  FAIR_MASTER_CD
200                    fair_master_id: esmem_payment.pay.instance.iParam.fair_master_id, //  FAIR_MASTER_ID
201                    title: '사전 결제 안내',
202                    token: esmem_payment.pay.instance.iParam.token, //
203                    button: esmem_payment.pay.instance.iParam.button, //
204                    senderkey: esmem_payment.pay.instance.iParam.sender_key, //
205                    message: esmem_payment.pay.instance.iParam.msg_contents,
206                  },
207                },
208              }
209
210              jQuery.extend(esmem_payment.pay.instance.iParam, {
211                merchant_uid: data[0].RET_ORDER_NUM,
212                custom_data: custom_data,
213              })
214
215              var def = $.Deferred()
216
217              if (this.iParam.pay_method === '6' || parseInt(esmem_payment.pay.instance.iParam.total_price) == 0) {
218                // 쿠폰
219                def.resolve({
220                  imp_uid: null,
221                  merchant_uid: esmem_payment.pay.instance.iParam.merchant_uid,
222                  pay_method: '6',
223                  custom_data: esmem_payment.pay.instance.iParam.custom_data,
224                })
225              } else {
226                var r_url = esmem_payment.pay.instance.iParam.site_url + '/member/?c=payment&a=list'
227
228                // 모바일 이고 가상계좌가 아닐 경우
229                if (
230                  esmem_payment.pay.instance.iParam.mobile_yn == 'Y' &&
231                  esmem_payment.pay.instance.iParam.pay_method != 2
232                ) {
233                  r_url = esmem_payment.pay.instance.iParam.site_url + '/member/?c=payment%26a=complete%26'
234                }
235
236                IMP.request_pay(
237                  {
238                    pg: 'html5_inicis',
239                    pay_method: esmem_payment.pay.instance.getPAYMENT_METHOD_IAMPORT(
240                      esmem_payment.pay.instance.iParam.pay_method
241                    ),
242                    merchant_uid: esmem_payment.pay.instance.iParam.merchant_uid,
243                    name: esmem_payment.pay.instance.iParam.fair_desc + ' 사전등록',
244                    amount: esmem_payment.pay.instance.iParam.total_price,
245                    buyer_email: esmem_payment.pay.instance.iParam.to_email,
246                    buyer_name: esmem_payment.pay.instance.iParam.visitor_name,
247                    buyer_tel: esmem_payment.pay.instance.iParam.mobile,
248                    vbank_due: esmem_payment.pay.instance.iParam.expire_date,
249                    custom_data: esmem_payment.pay.instance.iParam.custom_data,
250                    m_redirect_url: r_url,
251                    req_type: 'VST',
252                  },
253                  function (result) {
254                    if (result.success) {
255                      def.resolve(result)
256                    } else {
257                      esmem_payment.pay.setBlock(false)
258
259                      esmem_payment.pay.instance.VST_dn_ReqCancel({
260                        fair_visitor_id: esmem_payment.pay.instance.iParam.fair_visitor_id,
261                        payment_order_id: null,
262                        update_user: esmem_payment.pay.instance.iParam.mobile,
263                      })
264
265                      def.reject(result)
266                    }
267                  }
268                )
269              }
270
271              return def.promise()
272            } else if (data.state === 'False') {
273              return esmem.ajax.fail(data[0])
274            } else {
275              return esmem.ajax.fail(null)
276            }
277          },
278          PAY_Complete: function (data) {
279            if (data.state === 'False') {
280              return esmem.ajax.fail(null)
281            } else {
282              var iFAR_in_PaymentReqInfo = {
283                imp_uid: data.imp_uid,
284                merchant_uid: data.merchant_uid,
285                pay_method: esmem.common.isSetValue(data.pay_method),
286              }
287
288              return esmem.ajax.loadSync(
289                {
290                  url: ESMEMBER_API_URL + '/payment/PAY_Complete_Inicis',
291                  data: iFAR_in_PaymentReqInfo,
292                },
293                false
294              )
295            }
296          },
297          SendNotification: function (data) {
298            if (data.state === 'success') {
299              if (esmem_payment.pay.instance.iParam.pay_method != 2) {
300                // 가상계좌가 아닐경우
301                // 알림톡, SMS
302                //esmem_payment.pay.instance.SendAlimTalk();
303                if (
304                  esmem_payment.pay.instance.iParam.pay_method == '1' ||
305                  (esmem_payment.pay.instance.iParam.pay_method == '6' &&
306                    parseInt(esmem_payment.pay.instance.iParam.total_price) == 0)
307                ) {
308                  // 신용카드 && 0 원 결제명 이벤트로 처리 한다.
309                  esmem_payment.pay.instance.SendAlimTalk()
310                }
311
312                // // 메일
313                // if (esmem_payment.pay.instance.iParam.custom_data.MSG_in_Sendmessge_Visitor.email_info.from_email !== null) {
314                //     esmem_payment.pay.instance.SendMail();
315                // }
316              }
317
318              return esmem.ajax.success(data)
319            } else {
320              //[3] 아직 제대로 결제가 되지 않았습니다.
321              //[4] 결제된 금액이 요청한 금액과 달라 결제를 자동취소처리하였습니다.
322              var msg = data.message
323              alert(msg)
324
325              return esmem.ajax.fail(null)
326            }
327          },
328          SendMail: function () {
329            esmem.ajax.loadSync(
330              {
331                url: ESMEMBER_API_URL + '/Webservice/send_html_mail',
332                data: esmem_payment.pay.instance.iParam.custom_data.MSG_in_Sendmessge_Visitor.email_info,
333              },
334              false
335            )
336          },
337          SendAlimTalk: function () {
338            esmem.ajax.loadSync(
339              {
340                url: ESMEMBER_API_URL + '/message/send',
341                data: esmem_payment.pay.instance.iParam.custom_data.MSG_in_Sendmessge_Visitor.sms_info,
342              },
343              false
344            )
345          },
346          VST_dn_ReqCancel: function (data) {
347            esmem.ajax.loadSync(
348              {
349                url: ESMEMBER_API_URL + '/visitor/VST_dn_ReqCancel',
350                data: data,
351              },
352              false
353            )
354          },
355          Validation: function () {
356            var msg = ''
357
358            if (
359              esmem_payment.pay.instance.iParam.pay_method == 1 ||
360              esmem_payment.pay.instance.iParam.pay_method == 2
361            ) {
362              if (esmem_payment.pay.instance.iParam.option_id == '') {
363                msg += '- 티켓옵션\n'
364              }
365              console.log(esmem_payment.pay.instance.iParam.req_cnt)
366              if (esmem_payment.pay.instance.iParam.req_cnt == 0) {
367                msg += '- 수량\n'
368              }
369              if (esmem_payment.pay.instance.iParam.pay_method == '') {
370                msg += '- 결제방법\n'
371              }
372            } else if (esmem_payment.pay.instance.iParam.pay_method == 6) {
373              if (esmem_payment.pay.instance.iParam.option_id == 0) {
374                msg += '- 티켓옵션\n'
375              }
376              if (
377                esmem_payment.pay.instance.iParam.req_cnt == 0 ||
378                esmem_payment.pay.instance.iParam.coupons.length == 0
379              ) {
380                msg += '- 쿠폰\n'
381              }
382            }
383
384            if (msg.length > 0) {
385              alert('다음 값을 선택(입력)해 주세요.\n\n' + msg)
386              return false
387            } else {
388              return true
389            }
390
391            //
392            // req_id: esmem_payment.pay.instance.iParam.fair_visitor_id, // FAIR_VISITOR_ID
393            // fair_id: esmem_payment.pay.instance.iParam.fair_id,
394            // payment_order_id: data.VST_in_VisitorReqRegistAddition.PAYMENT_ORDER_ID,
395            // order_num: data.VST_in_VisitorReqRegistAddition.ORDER_NUM,
396            // order_price: esmem_payment.pay.instance.iParam.ctrl_order_price * esmem_payment.pay.instance.iParam.req_cnt, // 주문금액 (총액, 부가세포함)
397            // total_price: esmem_payment.pay.instance.iParam.ctrl_total_price * esmem_payment.pay.instance.iParam.req_cnt, // 실제금액 (총액, 부가세포함)
398            // discount_price: (esmem_payment.pay.instance.iParam.pay_method === '6' ? esmem_payment.pay.instance.iParam.ctrl_order_price * esmem_payment.pay.instance.iParam.req_cnt : esmem_payment.pay.instance.iParam.ctrl_discount_price * esmem_payment.pay.instance.iParam.req_cnt), // 할인금액 (총액)
399            // option_id: esmem_payment.pay.instance.iParam.option_id, // 결제 옵션 아이디
400            // pay_method: esmem_payment.pay.instance.iParam.pay_method, // 결제방법(마스터코드) ( SELECT * FROM MASTER_CODE WHERE MASTER_CODE_GROUP_ID = 11 )
401            // mobile_yn: esmem_payment.pay.instance.iParam.mobile_yn, // 모바일 결제 유무 (Y:모바일 결제, N:모바일 아님)
402            // ip_addr: esmem_payment.pay.instance.iParam.ip_addr, // 결제요청자 IP주소
403            // pay_type: 1, // 1: 사전등록/ 2:세미나(단일&기간권)/ 3: 업체참가비
404            // create_user: esmem_payment.pay.instance.iParam.mobile,
405            // visitor_id: esmem_payment.pay.instance.iParam.visitor_id,
406            // expire_date: data.VST_in_VisitorReqRegistAddition.EXPIRE_DATE, // vbank_expire_date
407          },
408          Success: function (data) {
409            // 쿠폰
410            if (esmem_payment.pay.instance.iParam.pay_method == 6) {
411              alert('쿠폰 등록이 완료되었습니다.')
412            } else if (esmem_payment.pay.instance.iParam.pay_method == 2) {
413              alert('입금대기 상태입니다.\n결제내역 페이지에서 결제진행중인 가상계좌에 입금하여 주십시오.')
414            } else if (esmem_payment.pay.instance.iParam.pay_method == 1) {
415              alert('결제가 완료되었습니다.')
416            }
417
418            if (
419              esmem_payment.pay.instance.iParam.pay_method == 1 ||
420              esmem_payment.pay.instance.iParam.pay_method == 6
421            ) {
422              location.href = '?c=payment&a=complete&fair_id=' + esmem_payment.pay.instance.iParam.fair_id
423            } else {
424              location.href = '?c=payment&a=list&fair_id=' + esmem_payment.pay.instance.iParam.fair_id
425            }
426          },
427          Error: function (result) {
428            console.log('에러' + result)
429
430            esmem_payment.pay.setBlock(false)
431
432            var msg = '결제에 실패하였습니다.\n'
433
434            if (!esmem.common.isEmpty(result.ERR_MSG)) msg = result.ERR_MSG
435            else if (!esmem.common.isEmpty(result.error_msg)) msg = result.error_msg
436
437            if (result.error_code === 'F1002') {
438              console.log(result.error_code)
439
440              var iFAR_in_PaymentReqInfo = {
441                imp_uid: result.imp_uid,
442                merchant_uid: result.merchant_uid,
443              }
444
445              esmem.ajax.loadSync(
446                {
447                  url: ESMEMBER_API_URL + '/payment/PAY_Complete',
448                  data: iFAR_in_PaymentReqInfo,
449                },
450                false
451              )
452            } else {
453              alert(msg)
454              esmem_payment.pay.instance.VST_dn_ReqCancel({
455                fair_visitor_id: esmem_payment.pay.instance.iParam.fair_visitor_id,
456                payment_order_id: null,
457                update_user: esmem_payment.pay.instance.iParam.mobile,
458              })
459            }
460          },
461          checkCoupon: function (refTxt, refBtn) {
462            // 무료초청 코드
463            const validPairs = [{ fair_id: 776, coupon_code: 'ILKO-0221-0223' }]
464            const usageFreeCoupon = validPairs.some(
465              (pair) =>
466                pair.fair_id == esmem_payment.pay.instance.iParam.fair_id &&
467                pair.coupon_code == this.$refs[refTxt][0].value
468            )
469            const couponApi = usageFreeCoupon
470              ? 'FAR_sr_CheckCompanyFairSmsCoupon_Handy'
471              : 'FAR_sr_CheckCompanyFairSmsCoupon'
472
473            if (!usageFreeCoupon) {
474              if (this.$refs[refTxt][0].value.trim() == '' || this.$refs[refTxt][0].value.trim().length < 14) {
475                alert('쿠폰번호가 올바르지 않습니다. ')
476                return
477              }
478            }
479
480            var oParam = {
481              coupon_code: this.$refs[refTxt][0].value,
482              fair_id: esmem_payment.pay.instance.iParam.fair_id,
483              mobile: esmem_payment.pay.instance.iParam.mobile,
484            }
485
486            if (!(esmem_payment.pay.instance.$refs[refBtn][0].getAttribute('CHK-FLAG') === 'Y')) {
487              esmem.ajax.loadSync(
488                {
489                  url: ESMEMBER_API_URL + '/fair/' + couponApi,
490                  data: oParam,
491                  success: function (result) {
492                    if (result.USE_YN === 'N') {
493                      esmem_payment.pay.instance.regCoupon(
494                        oParam.coupon_code,
495                        function () {
496                          esmem_payment.pay.instance.iParam.req_cnt = esmem_payment.pay.instance.iParam.req_cnt + 1
497
498                          esmem_payment.pay.instance.$refs[refBtn][0].innerHTML = '등록완료'
499                          esmem_payment.pay.instance.$refs[refBtn][0].classList.add('success')
500                          esmem_payment.pay.instance.$refs[refBtn][0].setAttribute('CHK-FLAG', 'Y')
501
502                          esmem_payment.pay.instance.$refs[refTxt][0].classList.add('success')
503                          esmem_payment.pay.instance.$refs[refTxt][0].readOnly = true
504
505                          //alert('쿠폰이 등록되었습니다. 수량을 확인해 주세요.');
506                        },
507                        function () {
508                          alert('이미 등록된 쿠폰입니다.')
509                          esmem_payment.pay.instance.$refs[refTxt][0].value = ''
510                        }
511                      )
512                    } else if (result.USE_YN === 'Y') {
513                      alert('이미 사용된 쿠폰입니다.')
514                      esmem_payment.pay.instance.$refs[refTxt][0].value = ''
515                    } else if (result.USE_YN === 'D') {
516                      alert('사용가능한 대상자가 아닙니다.')
517                      esmem_payment.pay.instance.$refs[refTxt][0].value = ''
518                    } else {
519                      alert('등록된 쿠폰이 아닙니다.')
520                      esmem_payment.pay.instance.$refs[refTxt][0].value = ''
521                    }
522                  },
523                },
524                false
525              )
526            }
527          },
528          regCoupon: function (coupon, success_callback, fail_callback) {
529            coupon = coupon.toUpperCase()
530
531            if (esmem_payment.pay.instance.iParam.coupons.indexOf(coupon) === -1) {
532              esmem_payment.pay.instance.iParam.coupons.push(coupon)
533              success_callback()
534            } else {
535              fail_callback()
536            }
537          },
538          movePayList: function () {
539            location.href = '?c=payment&a=list&fair_id=' + esmem_payment.pay.instance.iParam.fair_id
540          },
541          changeOPTION_ID: function () {
542            var vObj = JSON.parse(esmem_payment.pay.instance.iParam.ctrl_option_id)
543
544            if (esmem_payment.pay.instance.iParam.pay_method === '6') {
545              // 쿠폰일 경우 결제금액 0원 처리
546              esmem_payment.pay.instance.iParam.ctrl_order_price = 0 //vObj.originPrice !== undefined ? vObj.originPrice : 0;
547              esmem_payment.pay.instance.iParam.ctrl_total_price = 0
548              esmem_payment.pay.instance.iParam.ctrl_discount_price = 0 //vObj.originPrice !== undefined ? vObj.originPrice : 0;
549              esmem_payment.pay.instance.iParam.option_id = vObj.value !== undefined ? vObj.value : 0
550            } else {
551              // 그 외
552              esmem_payment.pay.instance.iParam.ctrl_order_price = vObj.originPrice !== undefined ? vObj.originPrice : 0
553              esmem_payment.pay.instance.iParam.ctrl_total_price = vObj.price !== undefined ? vObj.price : 0
554              esmem_payment.pay.instance.iParam.ctrl_discount_price =
555                this.iParam.ctrl_order_price - this.iParam.ctrl_total_price
556              esmem_payment.pay.instance.iParam.option_id = vObj.value !== undefined ? vObj.value : 0
557            }
558          },
559          getPAYMENT_METHOD_IAMPORT: function (payment_method) {
560            if (payment_method == '1') {
561              return 'VCard:Card'
562            } else if (payment_method == '2') {
563              return 'vbank'
564            } else {
565              return ''
566            }
567          },
568          noticeCoupon: function () {
569            // 쿠폰 선택시 하단 텍스트 변경
570            if (this.iParam.option_id == 6 && (this.iParam.option_id == 0 || this.iParam.req_cnt == 0)) {
571              return true
572            }
573
574            return false
575          },
576          addHyphens: function (index) {
577            var couponCode = this.couponCodes[index]
578            if (!couponCode || couponCode.trim() === '') {
579              return ''
580            }
581            const cleanedCode = couponCode.replace(/-/g, '')
582            this.couponCodes[index] = cleanedCode.match(/.{1,4}/g).join('-')
583
584            return true
585          },
586        },
587        computed: {
588          calcPrice: function () {
589            return (this.iParam.ctrl_total_price * this.iParam.req_cnt).comma()
590          },
591        },
592        watch: {
593          'iParam.pay_method': {
594            handler: function (val, oldVal) {
595              // 결제방법 변경시 결제옵션, 수량 초기화
596              if (oldVal == 6 && (val == 1 || val == 2)) {
597                esmem_payment.pay.instance.iParam.ctrl_option_id = 0
598                esmem_payment.pay.instance.iParam.req_cnt = 0
599                esmem_payment.pay.instance.iParam.coupons = []
600              }
601
602              if (val == 6) {
603                esmem_payment.pay.instance.iParam.req_cnt = 0
604                esmem_payment.pay.instance.iParam.ctrl_order_price = 0 //vObj.originPrice !== undefined ? vObj.originPrice : 0;
605                esmem_payment.pay.instance.iParam.ctrl_total_price = 0
606                esmem_payment.pay.instance.iParam.ctrl_discount_price = 0 //vObj.originPrice !== undefined ? vObj.originPrice : 0;
607                esmem_payment.pay.instance.iParam.ctrl_total_price = 0
608                esmem_payment.pay.instance.iParam.coupons = []
609              }
610            },
611            deep: true,
612          },
613        },
614      })
615    },
616    setBlock: function (flag) {
617      if (flag) {
618        esmem.common.block()
619        jQuery(esmem_payment.pay.instance.payButton).addClass('disabled') /* 버튼 이중 클릭 방지 */
620      } else {
621        esmem.common.unblock()
622        jQuery(esmem_payment.pay.instance.payButton).removeClass('disabled') /* 버튼 이중 클릭 방지 */
623      }
624    },
625  },
626  list: {
627    instance: null,
628    init: function (data) {
629      esmem_payment.list.instance = new Vue({
630        el: '#frm_payment',
631        data: {
632          iParam: data,
633          PAYMENT_ORDER_LIST: null,
634          selectedPayment: {},
635          selectedPaymentDetail: [],
636          cancelPaymentDetail: [],
637          commission: 0,
638          refundInfo: {
639            REASON: '',
640            REFUNDACCOUNT: '',
641            REFUNDACCOUNTBANK: '',
642            REFUNDACCOUNTHOLDER: '',
643            TOT_QTY: 0,
644            TOT_PRICE: 0,
645            PAYMENT_METHOD: null,
646          },
647          price: 0,
648          bank: [],
649        },
650        mounted: function () {
651          this.List('N', this.iParam)
652          this.COM_sd_BANK()
653        },
654        methods: {
655          initData: function () {
656            this.selectedPaymentDetail = []
657            this.cancelPaymentDetail = []
658            this.price = 0
659            this.refundInfo = {
660              REASON: '',
661              REFUNDACCOUNT: '',
662              REFUNDACCOUNTBANK: '',
663              REFUNDACCOUNTHOLDER: '',
664              TOT_QTY: 0,
665              TOT_PRICE: 0,
666              PAYMENT_METHOD: null,
667            }
668          },
669          List: function (cancelFlag) {
670            this.initData()
671
672            this.iParam.CANCEL_FLAG = cancelFlag // 조회 조건 (전체,결제,취소)
673
674            esmem.ajax.loadSync(
675              {
676                url: ESMEMBER_API_URL + '/fair/FAR_sd_FairVisitorPaymentInfo',
677                data: this.iParam,
678                success: function (result) {
679                  esmem_payment.list.instance.PAYMENT_ORDER_LIST = result
680                },
681              },
682              false
683            )
684          },
685          ShowCancelPopup: function (data) {
686            esmem_payment.list.instance
687              .Cancel_init(data)
688              .then(esmem_payment.list.instance.Success, esmem_payment.list.instance.Error)
689          },
690          Cancel_init: function (data) {
691            var def = $.Deferred()
692
693            this.price = 0
694            this.refundInfo = {
695              REASON: '',
696              REFUNDACCOUNT: '',
697              REFUNDACCOUNTBANK: '',
698              REFUNDACCOUNTHOLDER: '',
699              TOT_QTY: 0,
700              TOT_PRICE: 0,
701              PAYMENT_METHOD: null,
702            }
703
704            this.cancelPaymentDetail = this.selectedPaymentDetail.filter(function (payinfo) {
705              return payinfo.PAYMENT_ORDER_ID == data.PAYMENT_ORDER_ID
706            })
707
708            this.cancelPaymentDetail.map(function (v, i) {
709              esmem_payment.list.instance.price += v.TOTAL_PRICE
710            })
711
712            this.refundInfo.TOT_QTY = this.cancelPaymentDetail.length
713            this.refundInfo.TOT_PRICE = this.price
714            this.refundInfo.PAYMENT_METHOD = data.PAYMENT_METHOD
715
716            // 가상계좌일경우 취소 수수료
717            if (data.PAYMENT_METHOD == '2') {
718              esmem_payment.list.instance.commission = 700
719            }
720
721            // 체크된 값이 없으면 에러
722            if (this.cancelPaymentDetail.length === 0) {
723              this.selectedPayment = {}
724              def.reject(1, data)
725            } else {
726              if (this.refundInfo.TOT_PRICE == 0 && this.refundInfo.PAYMENT_METHOD == 1) {
727                this.selectedPayment = {}
728                def.reject(4, data)
729              } else {
730                this.selectedPayment = data
731                setTimeout(function () {
732                  jQuery('header.fusion-header-wrapper').css('z-index', '1')
733                  jQuery('#dialog-cancel').modal('show')
734                }, 200)
735              }
736            }
737
738            return def.promise()
739          },
740          Cancel: function () {
741            if (this.Validation()) {
742              $.blockUI({
743                message: null,
744                baseZ: 100000,
745                overlayCSS: { backgroundColor: '#aaaaaa', opacity: 0.4 },
746              })
747              esmem_payment.list.instance
748                .Cancel_available_check(this.selectedPayment)
749                .then(esmem_payment.list.instance.Cancel_order_iamport)
750                .then(esmem_payment.list.instance.Cancel_order_fms_update)
751                .then(esmem_payment.list.instance.Success, esmem_payment.list.instance.Error)
752                .always(function () {
753                  esmem.common.unblock()
754                })
755            }
756          },
757          Validation: function () {
758            if (
759              this.selectedPayment.PAYMENT_STATUS == '3' &&
760              this.selectedPayment.PAYMENT_METHOD == '1' &&
761              this.refundInfo.REASON.trim().length == 0
762            ) {
763              // 결제완료 && 신용카드 && 취소이유 미등록시
764              alert('취소사유를 입력해 주십시오.')
765              return
766            } else if (
767              this.selectedPayment.PAYMENT_STATUS == '3' &&
768              this.selectedPayment.PAYMENT_METHOD == '2' &&
769              (this.refundInfo.REASON.trim().length == 0 ||
770                this.refundInfo.REFUNDACCOUNTBANK == '' ||
771                this.refundInfo.REFUNDACCOUNT == '' ||
772                this.refundInfo.REFUNDACCOUNTHOLDER == '')
773            ) {
774              // 결제완료 && 가상계좌 && 취소이유 미등록시
775              alert('환불정보를 모두 입력해주십시오.')
776              return
777            }
778
779            return true
780          },
781          Cancel_available_check: function (data) {
782            console.log('1 : 환불 가능 여부 체크')
783            var def = $.Deferred()
784
785            $.ajax({
786              type: 'POST',
787              url: ESMEMBER_API_URL + '/membership/MEM_sr_RegistAvailableCheck',
788              data: {
789                FAIR_ID: esmem_payment.list.instance.iParam.FAIR_ID,
790              },
791              contentType: 'application/x-www-form-urlencoded',
792              success: function (result) {
793                if (result && result.REFUND_AVAILABLE_YN == 'Y') {
794                  def.resolve(data)
795                } else {
796                  def.reject(3, '환불/취소 기간이 마감되었습니다.')
797                }
798              },
799              error: function (request) {
800                console.log('1-97 : 환불 가능 여부 체크 오류')
801                def.reject('1-97 : 환불 가능 여부 체크 오류 >> ')
802              },
803            })
804
805            return def.promise()
806          },
807          Cancel_order_iamport: function (data) {
808            console.log('1 : 아임포트 결제취소 시작')
809            var def = $.Deferred()
810
811            var vbankFlag = ''
812
813            if (data.PAYMENT_METHOD == '2' && data.PAYMENT_STATUS == '8') {
814              // 가상계좌 , 입금대기,
815              vbankFlag = 'Y'
816            }
817            if (data.PAYMENT_METHOD != '6' && esmem_payment.list.instance.price != 0) {
818              // 무료쿠폰이 아닐경우 아임포트 취소처리
819              $.ajax({
820                type: 'POST',
821                url: ESMEMBER_API_URL + '/PaymentsInicis/cancelInicis',
822                data: {
823                  amount: esmem_payment.list.instance.price - esmem_payment.list.instance.commission, // 가상계좌일경우 취소 수수료
824                  imp_uid: data.IAMPORT_ID,
825                  reason: esmem_payment.list.instance.refundInfo.REASON,
826                  refund_account: esmem_payment.list.instance.refundInfo.REFUNDACCOUNT,
827                  refund_bank: esmem_payment.list.instance.refundInfo.REFUNDACCOUNTBANK,
828                  refund_holder: esmem_payment.list.instance.refundInfo.REFUNDACCOUNTHOLDER,
829                  vbank_delete: vbankFlag,
830                  req_type: 'VST',
831                  vid: ESMEMBER_ID,
832                },
833                contentType: 'application/x-www-form-urlencoded',
834                success: function (result) {
835                  if (
836                    result.success && vbankFlag === ''
837                      ? result.data.response != null && result.data.response.status == 'cancelled'
838                      : result.data != null && result.data.status == 'cancelled'
839                  ) {
840                    // 가상대기 때 리턴값이 틀리다.
841                    console.log('1-1 : 아임포트 취소 성공', result)
842                    def.resolve(data)
843                  } else if (!result.success && result.error.message === '해당거래 없음') {
844                    console.log('1-2 : 아임포트 취소 - 대상 없음', data, result)
845                    def.resolve(data)
846                  } else if (!result.success && result.error.message.trim() === '존재하지 않는 계좌') {
847                    // 가상계좌 이미 삭제 되어 나오는 메시지
848                    console.log('1-3 : 아임포트 취소 - 이미 삭제된 가상계좌', data, result)
849                    def.resolve(data)
850                  } else {
851                    console.log('1-99 : 아임포트 취소 실패', result)
852                    def.reject(null, result.error.message)
853                  }
854                },
855                error: function (request) {
856                  console.log('1-98 : 아임포트 결제 오류')
857                  def.reject('1-98 : 아임포트 결제 오류 >> ')
858                },
859              })
860            } else {
861              def.resolve(data)
862            }
863
864            return def.promise()
865          },
866          Cancel_order_fms_update: function (data) {
867            console.log('2 : FMS 데이터 베이스 업데이트 시작')
868
869            var def = $.Deferred()
870            var deferreds = []
871            var count = 0
872
873            Array.prototype.map.call(esmem_payment.list.instance.cancelPaymentDetail, function (item, index, list) {
874              var dObject = $.Deferred()
875              deferreds.push(dObject)
876
877              var rdata = {
878                req_id: item.FAIR_VISITOR_ID, // 가상계좌일경우 취소 수수료
879                req_type: 'VST',
880                payment_req_id: data.PAYMENT_REQ_ID,
881                payment_order_detail_id: item.PAYMENT_ORDER_DETAIL_ID,
882                payment_status: 6,
883                cancel_price: item.TOTAL_PRICE,
884                cancel_reason: esmem_payment.list.instance.refundInfo.REASON,
885                cancel_mobile: item.MOBILE,
886                cancel_name: item.VISITOR_NAME,
887                refund_bank_code: esmem_payment.list.instance.refundInfo.REFUNDACCOUNTBANK,
888                refund_account_no: esmem_payment.list.instance.refundInfo.REFUNDACCOUNT,
889                refund_account_name: esmem_payment.list.instance.refundInfo.REFUNDACCOUNTHOL
889DER,
890                create_user: data.mobile,
891              }
892
893              $.ajax({
894                type: 'POST',
895                url: ESMEMBER_API_URL + '/Payment/PAY_un_ReqCancel',
896                data: rdata,
897                contentType: 'application/x-www-form-urlencoded',
898                success: function (result) {
899                  if (result.PAY_un_ReqCancel.ERR_CD == 1) {
900                    console.log(
901                      '2-1 : FMS 데이터 베이스 업데이트 성공[PAYMENT_ORDER_DETAIL_ID=' +
902                        rdata.payment_order_detail_id +
903                        ']'
904                    )
905                    dObject.resolve()
906                  } else {
907                    console.log(
908                      '2-1 : FMS 데이터 베이스 업데이트 실패[PAYMENT_ORDER_DETAIL_ID=' +
909                        rdata.payment_order_detail_id +
910                        ']',
911                      result.PAY_un_ReqCancel.ERR_MSG
912                    )
913                    dObject.reject(
914                      '2-1 : FMS 데이터 베이스 업데이트 실패[PAYMENT_ORDER_DETAIL_ID=' +
915                        rdata.payment_order_detail_id +
916                        '] >> ' +
917                        result.PAY_un_ReqCancel.ERR_MSG
918                    )
919                  }
920                },
921                error: function (request) {
922                  console.log(
923                    '2-1 : FMS 데이터 베이스 업데이트 오류[PAYMENT_ORDER_DETAIL_ID=' +
924                      rdata.payment_order_detail_id +
925                      ']'
926                  )
927                  dObject.reject(
928                    '2-1 : FMS 데이터 베이스 업데이트 오류[PAYMENT_ORDER_DETAIL_ID=' +
929                      rdata.payment_order_detail_id +
930                      '] >> '
931                  )
932                },
933              })
934            })
935
936            $.when
937              .apply($, deferreds)
938              .done(function () {
939                console.log('2-2 : 데이터 베이스 업데이트 모두 완료')
940                def.resolve(true)
941              })
942              .fail(function () {
943                console.log('2-2 : 데이터 베이스 업데이트 실패')
944                def.reject(false)
945              })
946
947            return def.promise()
948          },
949          Success: function (data) {
950            jQuery('header.fusion-header-wrapper').css('z-index', '10011')
951            jQuery('#dialog-cancel').modal('hide')
952            alert('결제가 취소되었습니다.')
953            esmem_payment.list.instance.List(this.iParam.CANCEL_FLAG)
954          },
955          Error: function (code, data) {
956            if (code === 1) {
957              alert('취소하실 상품을 선택하여 주십시오.')
958            } else if (code === 2) {
959              console.log('사용자취소')
960            } else if (code === 3) {
961              alert(data)
962            } else if (code === 4) {
963              alert('이벤트 티켓은 취소하실 수 없습니다.')
964            } else {
965              alert(data)
966            }
967          },
968          movePayPage: function (fair_id) {
969            location.href = '?c=payment&a=pay&fair_id=' + fair_id
970          },
971          ChangeBank: function (e) {
972            this.refundInfo.REFUNDACCOUNTBANK = e.target.value
973          },
974          COM_sd_BANK: function () {
975            esmem.ajax.loadSync(
976              {
977                url: ESMEMBER_API_URL + '/commons/COM_sd_BANK',
978                data: null,
979                success: function (result) {
980                  esmem_payment.list.instance.bank = result
981                },
982              },
983              false
984            )
985          },
986          UI_PaymentStatus: function (status) {
987            return 'pay-order-status-' + status
988          },
989          UI_VisibleCancelButton: function (order) {
990            if (order.REFUND_AVAILABLE_YN == 'Y') {
991              if (order.PAYMENT_STATUS == '3' || order.PAYMENT_STATUS == '8') {
992                return true
993              } else {
994                return false
995              }
996            } else {
997              return false
998            }
999          },
1000          UI_VisibleDetailCheckButton: function (order, order_detail) {
1001            if (order.REFUND_AVAILABLE_YN == 'Y') {
1002              if (
1003                order_detail.PAYMENT_STATUS == 'Y' ||
1004                (order_detail.PAYMENT_METHOD == '2' && order_detail.PAYMENT_STATUS == 'I')
1005              ) {
1006                return true
1007              } else {
1008                return false
1009              }
1010            } else {
1011              return false
1012            }
1013          },
1014          VBANK_Status: function (PAYMENT_METHOD, PAYMENT_STATUS) {
1015            if (PAYMENT_METHOD == 2 && PAYMENT_STATUS == 8) {
1016              return true
1017            } else {
1018              return false
1019            }
1020          },
1021          SelectedPaymentDetail: function (detail) {
1022            console.log(this.selectedPaymentDetail)
1023          },
1024        },
1025        computed: {},
1026        watch: {},
1027      })
1028    },
1029  },
1030  util: {},
1031}
1032jQuery(function () {
1033  if (typeof esmem_payment !== 'undefined') {
1034    if (typeof InitPay != 'undefined') {
1035      InitPay()
1036    }
1037
1038    if (typeof InitComplete != 'undefined') {
1039      InitComplete()
1040    }
1041
1042    if (typeof InitList != 'undefined') {
1043      InitList()
1044    }
1045  }
1046})

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.