Plugin Directory

Changeset 1857630


Ignore:
Timestamp:
04/13/2018 06:25:51 AM (8 years ago)
Author:
gosomi
Message:

submit 이벤트 대응

Location:
woo-bootpay/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • woo-bootpay/trunk/assets/js/bootpay-order.js

    r1857603 r1857630  
    66        var paymentGatewayName = $('#order_review input[name=payment_method]:checked').val();
    77        if (bootpayGateways.indexOf(paymentGatewayName) === -1) return true;
     8
     9        var jsApiKey = wc_checkout_params.js_api_key;
     10        if (jsApiKey === undefined || jsApiKey.length === 0) {
     11            alert('Javascript API KEY를 입력해주세요.');
     12            return false;
     13        }
     14
     15        $.ajax({
     16            type: 'POST',
     17            url: wc_checkout_params.checkout_url,
     18            data: $(this).serialize(),
     19            dataType: 'json',
     20            success: function (response) {
     21                if (response.result !== 'success') {
     22                    alert('주문이 잘못되었습니다.');
     23                    return;
     24                }
     25
     26                var orderData = response.order_data;
     27                BootPay.request({
     28                    application_id: jsApiKey,
     29                    price: orderData.price,
     30                    name: orderData.name,
     31                    items: orderData.items,
     32                    phone: orderData.user_info.phone,
     33                    user_info: orderData.user_info,
     34                    order_id: orderData.order_id,
     35                    show_agree_window: wc_checkout_params.show_agree_window === 'yes' ? 1 : 0
     36                }).error(function (data) {
     37                    console.log(data);
     38                    alert('결제가 실패하였습니다.');
     39                }).cancel(function (data) {
     40                    console.log(data);
     41                    alert('결제가 진행도중 취소되었습니다. 다시 시도해주세요.');
     42                }).ready(function (data) {
     43                    if (data.receipt_id !== undefined) {
     44                        location.href = response.checkout_url + '&receipt_id=' + data.receipt_id;
     45                    } else {
     46                        alert('결제가 정상적으로 처리 되지 않았습니다.');
     47                    }
     48                }).confirm(function (data) {
     49                    // TODO: 재고 처리 관리 로직을 넣어야 한다.
     50                    this.transactionConfirm(data);
     51                }).done(function (data) {
     52                    // 결제 완료된 이후 처리
     53                    if (data.receipt_id !== undefined) {
     54                        location.href = response.checkout_url + '&receipt_id=' + data.receipt_id;
     55                    } else {
     56                        alert('결제가 정상적으로 처리 되지 않았습니다.');
     57                    }
     58                }).close(function (data) {
     59
     60                });
     61            },
     62            error: function (error) {
     63                console.log(error);
     64            }
     65        });
     66        return false;
     67    });
     68
     69    $('form#order_review, form[name=checkout]').on('submit', function (e) {
     70        var paymentGatewayName = $('#order_review input[name=payment_method]:checked').val();
     71        if (bootpayGateways.indexOf(paymentGatewayName) === -1) return true;
     72
     73        e.preventDefault();
     74        e.stopImmediatePropagation();
     75
    876        var jsApiKey = wc_checkout_params.js_api_key;
    977        if (jsApiKey === undefined || jsApiKey.length === 0) {
  • woo-bootpay/trunk/bootpay-woocommerce.php

    r1857621 r1857630  
    44 * Plugin URI: https://www.bootpay.co.kr
    55 * Description: 우커머스에 PG를 손쉽게 붙일 수 연동 플러그인 ( 이니시스 / 다날 / KCP / LGU+ 모두 쉽게 붙이는 Woo-bootpay )
    6  * Version: 1.0.9
     6 * Version: 1.1.0
    77 * Author: Gosomi
    88 * Author URI: https://blog.areum.io
  • woo-bootpay/trunk/readme.txt

    r1857621 r1857630  
    55Requires at least: 3.6
    66Tested up to: 4.9.1
    7 Stable tag: 1.0.9
     7Stable tag: 1.1.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.