├── index.php ├── admin ├── index.php ├── partials │ └── woocommerce-confirm-payment-admin-account-details-field.php ├── js │ └── woocommerce-confirm-payment-admin.js ├── class-woocommerce-confirm-payment-email.php ├── class-woocommerce-confirm-payment-customer-email-completed-payment.php ├── class-woocommerce-confirm-payment-customer-email-cancelled-payment.php ├── css │ └── woocommerce-confirm-payment-admin.css ├── class-woocommerce-confirm-payment-email-new-payment.php ├── class-woocommerce-confirm-payment-setting.php └── class-woocommerce-confirm-payment-admin.php ├── public ├── index.php ├── partials │ ├── woocommerce-confirm-payment-bank-details.php │ ├── woocommerce-confirm-payment-history.php │ └── woocommerce-confirm-payment-confirm-form.php ├── js │ ├── modernizr-custom.js │ ├── woocommerce-confirm-payment-public.js │ └── cleave.min.js ├── class-woocommerce-confirm-payment-history.php ├── css │ └── woocommerce-confirm-payment-public.css └── class-woocommerce-confirm-payment-public.php ├── includes ├── index.php ├── class-woocommerce-confirm-payment-deactivator.php ├── functions.php ├── class-woocommerce-confirm-payment-i18n.php ├── class-woocommerce-confirm-payment-activator.php ├── class-woocommerce-confirm-payment-loader.php └── class-woocommerce-confirm-payment.php ├── languages ├── woocommerce-confirm-payment-th.mo ├── woocommerce-confirm-payment-en_US.mo └── woocommerce-confirm-payment-en_US.po ├── templates └── emails │ ├── plain │ ├── email-payment-detail.php │ └── admin-new-payment.php │ ├── admin-cancelled-payment.php │ ├── admin-new-payment.php │ └── email-payment-detail.php ├── uninstall.php ├── woocommerce-confirm-payment.php ├── README.txt └── LICENSE.txt /index.php: -------------------------------------------------------------------------------- 1 | 22 | */ 23 | class Woocommerce_Confirm_Payment_Deactivator { 24 | 25 | /** 26 | * Short Description. (use period) 27 | * 28 | * Long Description. 29 | * 30 | * @since 0.9.0 31 | */ 32 | public static function deactivate() { 33 | 34 | //delete_option( 'wcp_flush_rewrite_rules' ); 35 | 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /templates/emails/plain/admin-new-payment.php: -------------------------------------------------------------------------------- 1 | payment_gateways()->get_available_payment_gateways(); 34 | 35 | // Get the Bacs gateway class 36 | $gateway = isset( $available_gateways['bacs'] ) ? $available_gateways['bacs'] : false; 37 | 38 | if ( false == $gateway ) return; 39 | 40 | return $gateway; 41 | 42 | } -------------------------------------------------------------------------------- /uninstall.php: -------------------------------------------------------------------------------- 1 | 26 | */ 27 | class Woocommerce_Confirm_Payment_i18n { 28 | 29 | 30 | /** 31 | * Load the plugin text domain for translation. 32 | * 33 | * @since 0.9.0 34 | */ 35 | public function load_plugin_textdomain() { 36 | 37 | load_plugin_textdomain( 38 | 'woocommerce-confirm-payment', 39 | false, 40 | dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' 41 | ); 42 | 43 | } 44 | 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /templates/emails/admin-cancelled-payment.php: -------------------------------------------------------------------------------- 1 | 27 | 28 |

Please submit your payment again. Confirm payment', 'woocommerce-confirm-payment' ), 30 | $order->get_order_number(), 31 | wcp_get_confirm_payment_url( $order->get_id() ) 32 | ); 33 | ?>

34 | 35 | 27 | 28 |

get_formatted_billing_full_name() ); ?>

29 | 30 | 22 | */ 23 | class Woocommerce_Confirm_Payment_Activator { 24 | 25 | /** 26 | * Short Description. (use period) 27 | * 28 | * Long Description. 29 | * 30 | * @since 0.9.0 31 | */ 32 | public static function activate() { 33 | 34 | $option = get_option( 'wcp_option' ); 35 | 36 | if ( empty( $option['confirm_page'] ) ) { 37 | 38 | $page_id = wp_insert_post( array( 39 | 'post_title' => wp_strip_all_tags( __( 'Confirm Payment', 'woocommerce-confirm-payment' ) ), 40 | 'post_content' => '[wcp_confirm_payment_form]', 41 | 'post_status' => 'publish', 42 | 'post_author' => 1, 43 | 'post_type' => 'page', 44 | ) ); 45 | 46 | $option['confirm_page'] = $page_id; 47 | 48 | update_option( 'wcp_option', $option ); 49 | 50 | } 51 | 52 | if ( ! function_exists( 'WC' ) ) return; 53 | 54 | update_option( 'wcp_flush_rewrite_rules', 'yes' ); 55 | 56 | $bacs_accounts = get_option('woocommerce_bacs_accounts'); 57 | $wcp_bank_accounts = get_option('wcp_bank_accounts'); 58 | 59 | if ( ! empty( $bacs_accounts ) && empty( $wcp_bank_accounts ) ) { 60 | 61 | 62 | foreach ( $bacs_accounts as $bacs_account ) { 63 | 64 | $accounts[] = array( 65 | 'bank_logo' => '', 66 | 'bank_name' => $bacs_account['bank_name'], 67 | 'account_number' => $bacs_account['account_number'], 68 | 'account_name' => $bacs_account['account_name'], 69 | ); 70 | 71 | } 72 | 73 | update_option( 'wcp_bank_accounts', $accounts ); 74 | 75 | } 76 | 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /public/partials/woocommerce-confirm-payment-bank-details.php: -------------------------------------------------------------------------------- 1 | bank_accounts ) ) : ?> 17 |
18 |

19 | bank_accounts as $account ) : ?> 20 | 34 | 35 | options['show_form_on_thankyou_page'] ) ) : ?> 36 |

37 | 38 | 39 |

Confirm payment', 'woocommerce-confirm-payment' ), wcp_get_confirm_payment_url( $order_id ) ); ?>

40 | 41 |
42 | r;r++)p.setAttribute("type",a=e[r]),i="text"!==p.type&&"style"in p,i&&(p.value=l,p.style.cssText="position:absolute;visibility:hidden;",/^range$/.test(a)&&p.style.WebkitAppearance!==n?(u.appendChild(p),s=t.defaultView,i=s.getComputedStyle&&"textfield"!==s.getComputedStyle(p,null).WebkitAppearance&&0!==p.offsetHeight,u.removeChild(p)):/^(search|tel)$/.test(a)||(i=/^(url|email)$/.test(a)?p.checkValidity&&p.checkValidity()===!1:p.value!=l)),m[e[r]]=!!i;return m}(d),s(),i(l),delete c.addTest,delete c.addAsyncTest;for(var h=0;hrun(); 81 | 82 | } 83 | run_woocommerce_confirm_payment(); -------------------------------------------------------------------------------- /admin/partials/woocommerce-confirm-payment-admin-account-details-field.php: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | bank_accounts ) ) : 30 | foreach ( $this->bank_accounts as $key => $account ) : 31 | 32 | $logo = wp_get_attachment_image( $account['bank_logo'], 'thumbnail' ); ?> 33 | 34 | 35 | 36 | 44 | 47 | 50 | 53 | 54 | 56 | 57 | 58 | 59 | 60 | 64 | 65 | 66 |
 
  61 | 62 | 63 |
67 |
-------------------------------------------------------------------------------- /public/class-woocommerce-confirm-payment-history.php: -------------------------------------------------------------------------------- 1 | 22 | */ 23 | class Woocommerce_Confirm_Payment_History { 24 | 25 | /** 26 | * The ID of this plugin. 27 | * 28 | * @since 0.9.0 29 | * @access private 30 | * @var string $plugin_name The ID of this plugin. 31 | */ 32 | private $plugin_name; 33 | 34 | /** 35 | * The version of this plugin. 36 | * 37 | * @since 0.9.0 38 | * @access private 39 | * @var string $version The current version of this plugin. 40 | */ 41 | private $version; 42 | 43 | 44 | /** 45 | * Initialize the class and set its properties. 46 | * 47 | * @since 0.9.0 48 | * @param string $plugin_name The name of the plugin. 49 | * @param string $version The version of this plugin. 50 | */ 51 | public function __construct( $plugin_name, $version ) { 52 | 53 | $this->plugin_name = $plugin_name; 54 | $this->version = $version; 55 | 56 | } 57 | 58 | public function woocommerce_menu_item( $menu_item ){ 59 | 60 | $menu_item = array_slice( $menu_item, 0, 3, true ) 61 | + array( $this->plugin_name => $this->woocommerce_endpoints_title() ) 62 | + array_slice( $menu_item, 3, NULL, true ); 63 | 64 | return $menu_item; 65 | 66 | } 67 | 68 | public function woocommerce_add_endpoints() { 69 | 70 | add_rewrite_endpoint( $this->plugin_name, EP_ROOT | EP_PAGES ); 71 | 72 | } 73 | 74 | public function woocommerce_endpoints_title() { 75 | 76 | return __( 'Payment History', 'woocommerce-confirm-payment' ); 77 | 78 | } 79 | 80 | public function woocommerce_get_query_vars( $endpoints ) { 81 | 82 | $endpoints[$this->plugin_name] = 'payment-history'; 83 | 84 | return $endpoints; 85 | 86 | } 87 | 88 | public function woocommerce_account_payment_history( $current_page ) { 89 | 90 | $current_page = empty( $current_page ) ? 1 : absint( $current_page ); 91 | 92 | $args = array( 93 | 'post_type' => 'wcp_confirm_payment', 94 | 'meta_key' => '_wcp_payment_user_id', 95 | 'meta_value' => get_current_user_id(), 96 | 'posts_per_page' => get_option( 'posts_per_page' ), 97 | 'paged' => $current_page 98 | ); 99 | 100 | $the_query = new WP_Query( $args ); 101 | 102 | wc_get_template( 103 | 'partials/woocommerce-confirm-payment-history.php', 104 | array( 105 | 'current_page' => absint( $current_page ), 106 | 'payments' => $the_query, 107 | ), 108 | '', plugin_dir_path( dirname( __FILE__ ) ) . 'public/' 109 | ); 110 | 111 | } 112 | 113 | 114 | } -------------------------------------------------------------------------------- /admin/js/woocommerce-confirm-payment-admin.js: -------------------------------------------------------------------------------- 1 | (function( $ ) { 2 | 'use strict'; 3 | 4 | /** 5 | * All of the code for your admin-facing JavaScript source 6 | * should reside in this file. 7 | * 8 | * Note: It has been assumed you will write jQuery code here, so the 9 | * $ function reference has been prepared for usage within the scope 10 | * of this function. 11 | * 12 | * This enables you to define handlers, for when the DOM is ready: 13 | * 14 | * $(function() { 15 | * 16 | * }); 17 | * 18 | * When the window is loaded: 19 | * 20 | * $( window ).load(function() { 21 | * 22 | * }); 23 | * 24 | * ...and/or other possibilities. 25 | * 26 | * Ideally, it is not considered best practise to attach more than a 27 | * single DOM-ready or window-load handler for a particular page. 28 | * Although scripts in the WordPress core, Plugins and Themes may be 29 | * practising this, we should strive to set a better example in our own work. 30 | */ 31 | 32 | $(document).ready(function(){ 33 | 34 | $( '.wcp_input_table tbody' ).sortable({ 35 | items: 'tr', 36 | cursor: 'move', 37 | axis: 'y', 38 | opacity: 0.65, 39 | placeholder: 'wcp-metabox-sortable-placeholder', 40 | }); 41 | 42 | }); 43 | 44 | $(document).on( 'click', '.wcp-remove_rows', function(event){ 45 | 46 | $('tbody.accounts tr.is-focus').remove(); 47 | 48 | }); 49 | 50 | $(document).on( 'click', '.wcp-add_rows', function(event){ 51 | 52 | 53 | event.preventDefault(); 54 | 55 | var key = $('tr.account-item').length; 56 | 57 | $('tbody.accounts').append( 58 | '\ 59 | \ 60 | \ 61 |
\ 62 | \ 63 |
\ 64 | \ 65 |
\ 66 | '+ WCP.i18n.upload +'\ 67 | ×\ 68 |
\ 69 | \ 70 | \ 71 | \ 72 | \ 73 | \ 74 | \ 75 | \ 76 | \ 77 | \ 78 | \ 79 | ' 80 | ); 81 | 82 | }); 83 | 84 | $( document ).on('focus', 'table.wcp_input_table input', function(event) { 85 | 86 | event.preventDefault(); 87 | 88 | $(this).closest('tr').addClass('is-focus').siblings().removeClass('is-focus'); 89 | 90 | }); 91 | 92 | $(document).on( 'click', '.wcp-button-remove-image', function(event){ 93 | 94 | $(this).closest('.wcp-upload-image-wrapper').removeClass('has-logo').find('input').val('').next().empty(); 95 | 96 | }); 97 | 98 | $(document).on( 'click', '.wcp-button-upload-image', function(event){ 99 | 100 | event.preventDefault(); 101 | 102 | var $this = $(this); 103 | 104 | var $wrapper = $this.closest('.wcp-upload-image-wrapper'); 105 | 106 | var uploader; 107 | 108 | uploader = wp.media.frames.file_frame = wp.media({ 109 | 110 | title: WCP.i18n.select_logo, 111 | button: { 112 | text: WCP.i18n.select 113 | }, 114 | multiple: false 115 | 116 | }); 117 | 118 | uploader.state( 'library' ).on( 'select', function(){ 119 | 120 | var image = this.get( 'selection' ).first().toJSON(); 121 | 122 | //console.log(image); 123 | $wrapper.addClass('has-logo'); 124 | $wrapper.find('input.upload-image').val( image.id ); 125 | $wrapper.find('.wcp-image-preview').html('') 126 | 127 | }); 128 | 129 | uploader.open(); 130 | 131 | }); 132 | 133 | })( jQuery ); 134 | -------------------------------------------------------------------------------- /admin/class-woocommerce-confirm-payment-email.php: -------------------------------------------------------------------------------- 1 | 22 | */ 23 | class Woocommerce_Confirm_Payment_Email{ 24 | 25 | /** 26 | * The ID of this plugin. 27 | * 28 | * @since 0.9.0 29 | * @access private 30 | * @var string $plugin_name The ID of this plugin. 31 | */ 32 | private $plugin_name; 33 | 34 | /** 35 | * The version of this plugin. 36 | * 37 | * @since 0.9.0 38 | * @access private 39 | * @var string $version The current version of this plugin. 40 | */ 41 | private $version; 42 | 43 | /** 44 | * bank_accounts 45 | * 46 | * @var array 47 | */ 48 | private $bank_accounts = array(); 49 | 50 | /** 51 | * Holds the values to be used in the fields callbacks 52 | */ 53 | private $options; 54 | 55 | /** 56 | * Initialize the class and set its properties. 57 | * 58 | * @since 0.9.0 59 | * @param string $plugin_name The name of this plugin. 60 | * @param string $version The version of this plugin. 61 | */ 62 | public function __construct( $plugin_name, $version ) { 63 | 64 | $this->plugin_name = $plugin_name; 65 | $this->version = $version; 66 | $this->options = get_option( 'wcp_option' ); 67 | $this->bank_accounts = get_option( 'wcp_bank_accounts' ); 68 | 69 | } 70 | 71 | public function register_email($emails) { 72 | 73 | require_once( 'class-woocommerce-confirm-payment-email-new-payment.php' ); 74 | require_once( 'class-woocommerce-confirm-payment-customer-email-completed-payment.php' ); 75 | require_once( 'class-woocommerce-confirm-payment-customer-email-cancelled-payment.php' ); 76 | 77 | $emails['WCP_Email_New_Payment'] = new Woocommerce_Confirm_Payment_Email_New_Payment(); 78 | $emails['WCP_Customer_Email_Completed_Payment'] = new Woocommerce_Confirm_Payment_Customer_Email_Completed_Payment(); 79 | $emails['WCP_Customer_Email_Cancelled_Payment'] = new Woocommerce_Confirm_Payment_Customer_Email_Cancelled_Payment(); 80 | 81 | return $emails; 82 | 83 | } 84 | 85 | public function add_woocommerce_email_actions( $actions ){ 86 | 87 | $actions[] = 'woocommerce_order_status_on-hold_to_checking_payment'; 88 | $actions[] = 'woocommerce_order_status_checking_payment_to_processing'; 89 | $actions[] = 'woocommerce_order_status_checking_payment_to_on-hold'; 90 | 91 | return $actions; 92 | 93 | } 94 | 95 | /** 96 | * Show the order details table 97 | * 98 | * @param WC_Order $order Order instance. 99 | * @param bool $sent_to_admin If should sent to admin. 100 | * @param bool $plain_text If is plain text email. 101 | * @param string $email Email address. 102 | */ 103 | public function payment_details( $order, $sent_to_admin = false, $plain_text = false, $email = '' ) { 104 | 105 | if ( $plain_text ) { 106 | wc_get_template( 107 | 'emails/plain/email-payment-detail.php', array( 108 | 'order' => $order, 109 | 'sent_to_admin' => $sent_to_admin, 110 | 'plain_text' => $plain_text, 111 | 'email' => $email, 112 | ), '', plugin_dir_path( dirname( __FILE__ ) ) . 'templates/' 113 | ); 114 | } else { 115 | wc_get_template( 116 | 'emails/email-payment-detail.php', array( 117 | 'order' => $order, 118 | 'sent_to_admin' => $sent_to_admin, 119 | 'plain_text' => $plain_text, 120 | 'email' => $email, 121 | ), '', plugin_dir_path( dirname( __FILE__ ) ) . 'templates/' 122 | ); 123 | } 124 | 125 | } 126 | 127 | } -------------------------------------------------------------------------------- /public/partials/woocommerce-confirm-payment-history.php: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | have_posts() ) { ?> 29 | have_posts() ) : ?> 30 | the_post(); 32 | $status = get_post_status_object( get_post_status( get_the_ID() ) ); 33 | $date = get_post_meta( get_the_ID(), '_wcp_payment_date', true ); 34 | $order_id = get_post_meta( get_the_ID(), '_wcp_payment_order_id', true ); 35 | ?> 36 | 37 | 46 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
38 | 39 | 40 | 'wcp-slip' ) )?> 41 | 42 | 43 | 44 | 45 | 47 | # 48 | label ); ?>
63 | 64 | max_num_pages ) : ?> 65 |
66 | 67 | 68 | 69 | 70 | max_num_pages ) !== $current_page ) : ?> 71 | 72 | 73 |
74 | -------------------------------------------------------------------------------- /public/js/woocommerce-confirm-payment-public.js: -------------------------------------------------------------------------------- 1 | (function( $ ) { 2 | 'use strict'; 3 | 4 | function wcp_alert(message){ 5 | return '
'+ message +'
' 6 | } 7 | 8 | $(document).on('change', 'select#wcp-order', function(event) { 9 | 10 | var selected = $("option:selected", this); 11 | 12 | $('#wcp-amount').val( selected.data('total') ); 13 | 14 | }); 15 | 16 | $(document).on('keyup click', 'input#wcp-order', function(event) { 17 | 18 | var $this = $(this); 19 | 20 | $.ajax({ 21 | type: 'POST', 22 | dataType: 'json', 23 | url: WCP.ajaxurl, 24 | data: 'order_id='+ $this.val() + '&security='+ WCP.check_order_nonce +'&action=wcp_check_order', 25 | success : function( data ){ 26 | 27 | $this.closest('.wcp-form-group').removeClass('has-error').find('.wcp-alert').remove(); 28 | 29 | if( data.errors ){ 30 | $this.closest('.wcp-form-group').addClass('has-error').append(wcp_alert(data.errors)); 31 | }else{ 32 | $('#wcp-amount').val( data.total ); 33 | } 34 | }, 35 | complete: function(data){}, 36 | error : function( err ){} 37 | }); 38 | 39 | }); 40 | 41 | $(document).on('change', 'input#wcp-slip', function(event) { 42 | 43 | var group = $(this).closest('.wcp-form-group'); 44 | 45 | group.removeClass('has-error').find('.wcp-alert').remove(); 46 | 47 | if(this.files[0].size > 2097152){ 48 | group.addClass('has-error').append(wcp_alert(WCP.i18n.maximum_upload_file)); 49 | this.value = ''; 50 | } 51 | 52 | }); 53 | 54 | $('form.wcp-form').ajaxForm({ 55 | 56 | dataType: 'json', 57 | beforeSubmit: before_confirm_payment, 58 | success: after_confirm_payment, 59 | url: WCP.ajaxurl 60 | 61 | }); 62 | 63 | function before_confirm_payment(field, form, options) { 64 | 65 | form.addClass('is-loading'); 66 | 67 | } 68 | 69 | function after_confirm_payment(data){ 70 | 71 | $('.wcp-alert, .wcp-form-success-message').remove(); 72 | $('.wcp-form-group').removeClass('has-error'); 73 | $('form.wcp-form').removeClass('is-loading'); 74 | 75 | console.log( data.asdasa ); 76 | 77 | if ( data.errors.length === 0 ) { 78 | 79 | $('.wcp-form-response').html( '
' + data.success + '
'); 80 | $('#wcp-date, #wcp-time, #wcp-slip, #wcp-amount').val(''); 81 | 82 | }else{ 83 | 84 | if( data.errors.name ) $('#wcp-name').closest('.wcp-form-group').addClass('has-error').append(wcp_alert(data.errors.name)); 85 | if( data.errors.phone ) $('#wcp-phone').closest('.wcp-form-group').addClass('has-error').append(wcp_alert(data.errors.phone)); 86 | if( data.errors.date ) $('#wcp-date').closest('.wcp-form-group').addClass('has-error').append(wcp_alert(data.errors.date)); 87 | if( data.errors.time ) $('#wcp-time').closest('.wcp-form-group').addClass('has-error').append(wcp_alert(data.errors.time)); 88 | if( data.errors.bank ) $('#wcp-bank').closest('.wcp-form-group').addClass('has-error').append(wcp_alert(data.errors.bank)); 89 | if( data.errors.amount ) $('#wcp-amount').closest('.wcp-form-group').addClass('has-error').append(wcp_alert(data.errors.amount)); 90 | if( data.errors.order ) $('#wcp-order').closest('.wcp-form-group').addClass('has-error').append(wcp_alert(data.errors.order)); 91 | if( data.errors.slip ) $('#wcp-slip').closest('.wcp-form-group').addClass('has-error').append(wcp_alert(data.errors.slip)); 92 | if( data.errors.attachment ) $('#wcp-slip').closest('.wcp-form-group').addClass('has-error').append(wcp_alert(data.errors.attachment)); 93 | 94 | $('.wcp-form-group.has-error:first input').focus(); 95 | 96 | } 97 | 98 | } 99 | 100 | if ( ! Modernizr.inputtypes.date || ! Modernizr.inputtypes.time ) { 101 | 102 | $.getScript( WCP.cleave, function( data, textStatus, jqxhr ) { 103 | 104 | if ( 'success' == textStatus ) { 105 | 106 | if( ! Modernizr.inputtypes.date ){ 107 | new Cleave('#wcp-date', { 108 | date: true, 109 | datePattern: ['d', 'm', 'Y'], 110 | max: WCP.current_date 111 | }); 112 | 113 | } 114 | if( ! Modernizr.inputtypes.time ){ 115 | new Cleave('#wcp-time', { 116 | time: true, 117 | timePattern: ['h', 'm'] 118 | }); 119 | } 120 | 121 | } 122 | 123 | }); 124 | 125 | } 126 | 127 | })( jQuery ); -------------------------------------------------------------------------------- /admin/class-woocommerce-confirm-payment-customer-email-completed-payment.php: -------------------------------------------------------------------------------- 1 | id = 'wcp_completed_payment'; 32 | $this->customer_email = true; 33 | 34 | $this->title = __( 'Completed payment', 'woocommerce-confirm-payment' ); 35 | $this->description = __( 'This is an order notification sent to customers containing order details after admin approved payment.', 'woocommerce' ); 36 | $this->template_html = 'emails/customer-processing-order.php'; 37 | $this->template_plain = 'emails/plain/customer-processing-order.php'; 38 | $this->placeholders = array( 39 | '{site_title}' => $this->get_blogname(), 40 | '{order_date}' => '', 41 | '{order_number}' => '', 42 | ); 43 | 44 | // Triggers for this email. 45 | add_action( 'woocommerce_order_status_checking_payment_to_processing_notification', array( $this, 'trigger' ), 10, 2 ); 46 | 47 | 48 | // Call parent constructor. 49 | parent::__construct(); 50 | } 51 | 52 | /** 53 | * Get email subject. 54 | * 55 | * @since 3.1.0 56 | * @return string 57 | */ 58 | public function get_default_subject() { 59 | return __( '[{site_title}] Your payment order ({order_number}) is success', 'woocommerce-confirm-payment' ); 60 | } 61 | 62 | /** 63 | * Get email heading. 64 | * 65 | * @since 3.1.0 66 | * @return string 67 | */ 68 | public function get_default_heading() { 69 | return __( 'Thank you for your payment.', 'woocommerce-confirm-payment' ); 70 | } 71 | 72 | /** 73 | * Trigger the sending of this email. 74 | * 75 | * @param int $order_id The order ID. 76 | * @param WC_Order|false $order Order object. 77 | */ 78 | public function trigger( $order_id, $order = false ) { 79 | $this->setup_locale(); 80 | 81 | if ( $order_id && ! is_a( $order, 'WC_Order' ) ) { 82 | $order = wc_get_order( $order_id ); 83 | } 84 | 85 | if ( is_a( $order, 'WC_Order' ) ) { 86 | $this->object = $order; 87 | $this->recipient = $this->object->get_billing_email(); 88 | $this->placeholders['{order_date}'] = wc_format_datetime( $this->object->get_date_created() ); 89 | $this->placeholders['{order_number}'] = $this->object->get_order_number(); 90 | } 91 | 92 | if ( $this->is_enabled() && $this->get_recipient() ) { 93 | $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() ); 94 | } 95 | 96 | $this->restore_locale(); 97 | } 98 | 99 | /** 100 | * Get content html. 101 | * 102 | * @access public 103 | * @return string 104 | */ 105 | public function get_content_html() { 106 | return wc_get_template_html( 107 | $this->template_html, array( 108 | 'order' => $this->object, 109 | 'email_heading' => $this->get_heading(), 110 | 'sent_to_admin' => false, 111 | 'plain_text' => false, 112 | 'email' => $this, 113 | ) 114 | ); 115 | } 116 | 117 | /** 118 | * Get content plain. 119 | * 120 | * @access public 121 | * @return string 122 | */ 123 | public function get_content_plain() { 124 | return wc_get_template_html( 125 | $this->template_plain, array( 126 | 'order' => $this->object, 127 | 'email_heading' => $this->get_heading(), 128 | 'sent_to_admin' => false, 129 | 'plain_text' => true, 130 | 'email' => $this, 131 | ) 132 | ); 133 | } 134 | 135 | } 136 | 137 | endif; 138 | -------------------------------------------------------------------------------- /admin/class-woocommerce-confirm-payment-customer-email-cancelled-payment.php: -------------------------------------------------------------------------------- 1 | id = 'wcp_cancelled_payment'; 32 | $this->customer_email = true; 33 | 34 | $this->title = __( 'Cancelled payment', 'woocommerce-confirm-payment' ); 35 | $this->description = __( 'This is an order notification sent to customers containing order details after admin cancelled payment.', 'woocommerce-confirm-payment' ); 36 | $this->template_html = 'emails/admin-cancelled-payment.php'; 37 | $this->template_plain = 'emails/plain/admin-cancelled-payment.php'; 38 | $this->template_base = plugin_dir_path( dirname( __FILE__ ) ) . 'templates/'; 39 | $this->placeholders = array( 40 | '{site_title}' => $this->get_blogname(), 41 | '{order_date}' => '', 42 | '{order_number}' => '', 43 | ); 44 | 45 | // Triggers for this email. 46 | add_action( 'woocommerce_order_status_checking_payment_to_on-hold_notification', array( $this, 'trigger' ), 10, 2 ); 47 | 48 | 49 | // Call parent constructor. 50 | parent::__construct(); 51 | } 52 | 53 | /** 54 | * Get email subject. 55 | * 56 | * @since 3.1.0 57 | * @return string 58 | */ 59 | public function get_default_subject() { 60 | return __( '[{site_title}] Cancelled payment order ({order_number})', 'woocommerce-confirm-payment' ); 61 | } 62 | 63 | /** 64 | * Get email heading. 65 | * 66 | * @since 3.1.0 67 | * @return string 68 | */ 69 | public function get_default_heading() { 70 | return __( 'Cancelled payment', 'woocommerce-confirm-payment' ); 71 | } 72 | 73 | /** 74 | * Trigger the sending of this email. 75 | * 76 | * @param int $order_id The order ID. 77 | * @param WC_Order|false $order Order object. 78 | */ 79 | public function trigger( $order_id, $order = false ) { 80 | $this->setup_locale(); 81 | 82 | if ( $order_id && ! is_a( $order, 'WC_Order' ) ) { 83 | $order = wc_get_order( $order_id ); 84 | } 85 | 86 | if ( is_a( $order, 'WC_Order' ) ) { 87 | $this->object = $order; 88 | $this->recipient = $this->object->get_billing_email(); 89 | $this->placeholders['{order_date}'] = wc_format_datetime( $this->object->get_date_created() ); 90 | $this->placeholders['{order_number}'] = $this->object->get_order_number(); 91 | } 92 | 93 | if ( $this->is_enabled() && $this->get_recipient() ) { 94 | $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() ); 95 | } 96 | 97 | $this->restore_locale(); 98 | } 99 | 100 | /** 101 | * Get content html. 102 | * 103 | * @access public 104 | * @return string 105 | */ 106 | public function get_content_html() { 107 | return wc_get_template_html( 108 | $this->template_html, array( 109 | 'order' => $this->object, 110 | 'email_heading' => $this->get_heading(), 111 | 'sent_to_admin' => false, 112 | 'plain_text' => false, 113 | 'email' => $this, 114 | ), '', $this->template_base 115 | ); 116 | } 117 | 118 | /** 119 | * Get content plain. 120 | * 121 | * @access public 122 | * @return string 123 | */ 124 | public function get_content_plain() { 125 | return wc_get_template_html( 126 | $this->template_plain, array( 127 | 'order' => $this->object, 128 | 'email_heading' => $this->get_heading(), 129 | 'sent_to_admin' => false, 130 | 'plain_text' => true, 131 | 'email' => $this, 132 | ), '', $this->template_base 133 | ); 134 | } 135 | 136 | } 137 | 138 | endif; 139 | -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | === Plugin Name === 2 | Contributors: (this should be a list of wordpress.org userid's) 3 | Donate link: https://www.surakrai.com/ 4 | Tags: comments, spam 5 | Requires at least: 3.0.1 6 | Tested up to: 3.4 7 | Stable tag: 4.3 8 | License: GPLv2 or later 9 | License URI: http://www.gnu.org/licenses/gpl-2.0.html 10 | 11 | Here is a short description of the plugin. This should be no more than 150 characters. No markup here. 12 | 13 | == Description == 14 | 15 | This is the long description. No limit, and you can use Markdown (as well as in the following sections). 16 | 17 | For backwards compatibility, if this section is missing, the full length of the short description will be used, and 18 | Markdown parsed. 19 | 20 | A few notes about the sections above: 21 | 22 | * "Contributors" is a comma separated list of wp.org/wp-plugins.org usernames 23 | * "Tags" is a comma separated list of tags that apply to the plugin 24 | * "Requires at least" is the lowest version that the plugin will work on 25 | * "Tested up to" is the highest version that you've *successfully used to test the plugin*. Note that it might work on 26 | higher versions... this is just the highest one you've verified. 27 | * Stable tag should indicate the Subversion "tag" of the latest stable version, or "trunk," if you use `/trunk/` for 28 | stable. 29 | 30 | Note that the `readme.txt` of the stable tag is the one that is considered the defining one for the plugin, so 31 | if the `/trunk/readme.txt` file says that the stable tag is `4.3`, then it is `/tags/4.3/readme.txt` that'll be used 32 | for displaying information about the plugin. In this situation, the only thing considered from the trunk `readme.txt` 33 | is the stable tag pointer. Thus, if you develop in trunk, you can update the trunk `readme.txt` to reflect changes in 34 | your in-development version, without having that information incorrectly disclosed about the current stable version 35 | that lacks those changes -- as long as the trunk's `readme.txt` points to the correct stable tag. 36 | 37 | If no stable tag is provided, it is assumed that trunk is stable, but you should specify "trunk" if that's where 38 | you put the stable version, in order to eliminate any doubt. 39 | 40 | == Installation == 41 | 42 | This section describes how to install the plugin and get it working. 43 | 44 | e.g. 45 | 46 | 1. Upload `woocommerce-confirm-payment.php` to the `/wp-content/plugins/` directory 47 | 1. Activate the plugin through the 'Plugins' menu in WordPress 48 | 1. Place `` in your templates 49 | 50 | == Frequently Asked Questions == 51 | 52 | = A question that someone might have = 53 | 54 | An answer to that question. 55 | 56 | = What about foo bar? = 57 | 58 | Answer to foo bar dilemma. 59 | 60 | == Screenshots == 61 | 62 | 1. This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif). Note that the screenshot is taken from 63 | the /assets directory or the directory that contains the stable readme.txt (tags or trunk). Screenshots in the /assets 64 | directory take precedence. For example, `/assets/screenshot-1.png` would win over `/tags/4.3/screenshot-1.png` 65 | (or jpg, jpeg, gif). 66 | 2. This is the second screen shot 67 | 68 | == Changelog == 69 | 70 | = 1.0 = 71 | * A change since the previous version. 72 | * Another change. 73 | 74 | = 0.5 = 75 | * List versions from most recent at top to oldest at bottom. 76 | 77 | == Upgrade Notice == 78 | 79 | = 1.0 = 80 | Upgrade notices describe the reason a user should upgrade. No more than 300 characters. 81 | 82 | = 0.5 = 83 | This version fixes a security related bug. Upgrade immediately. 84 | 85 | == Arbitrary section == 86 | 87 | You may provide arbitrary sections, in the same format as the ones above. This may be of use for extremely complicated 88 | plugins where more information needs to be conveyed that doesn't fit into the categories of "description" or 89 | "installation." Arbitrary sections will be shown below the built-in sections outlined above. 90 | 91 | == A brief Markdown Example == 92 | 93 | Ordered list: 94 | 95 | 1. Some feature 96 | 1. Another feature 97 | 1. Something else about the plugin 98 | 99 | Unordered list: 100 | 101 | * something 102 | * something else 103 | * third thing 104 | 105 | Here's a link to [WordPress](http://wordpress.org/ "Your favorite software") and one to [Markdown's Syntax Documentation][markdown syntax]. 106 | Titles are optional, naturally. 107 | 108 | [markdown syntax]: http://daringfireball.net/projects/markdown/syntax 109 | "Markdown is what the parser uses to process much of the readme file" 110 | 111 | Markdown uses email style notation for blockquotes and I've been told: 112 | > Asterisks for *emphasis*. Double it up for **strong**. 113 | 114 | `` -------------------------------------------------------------------------------- /templates/emails/email-payment-detail.php: -------------------------------------------------------------------------------- 1 | 22 | 23 | get_id(), '_wcp_order_payment_id', true ); 25 | $name = get_the_title( $payment_id ); 26 | $date = get_post_meta( $payment_id, '_wcp_payment_date', true ); 27 | $phone = get_post_meta( $payment_id, '_wcp_payment_phone', true ); 28 | $bank = get_post_meta( $payment_id, '_wcp_payment_bank', true ); 29 | $amount = get_post_meta( $payment_id, '_wcp_payment_amount', true ); 30 | $order_id = $order->get_id(); 31 | 32 | $slips = get_the_post_thumbnail_url( $payment_id, 'large' ); 33 | $slips_thumb = get_the_post_thumbnail_url( $payment_id, 'medium' ); 34 | ?> 35 |
36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 61 | 62 | 63 | 64 | 67 | 68 | 69 |
# '. $order_id . ' ';?> 60 |
65 | ' : '-' ) ?> 66 |
70 | 71 | %s', 73 | admin_url( 'edit.php?post_type=wcp_confirm_payment&action=-1&payment_id=' . $payment_id ), 74 | __( 'View details', 'woocommerce-confirm-payment' ) 75 | ) ?> 76 | 77 | 78 |
79 | 80 | -------------------------------------------------------------------------------- /includes/class-woocommerce-confirm-payment-loader.php: -------------------------------------------------------------------------------- 1 | 23 | */ 24 | class Woocommerce_Confirm_Payment_Loader { 25 | 26 | /** 27 | * The array of actions registered with WordPress. 28 | * 29 | * @since 0.9.0 30 | * @access protected 31 | * @var array $actions The actions registered with WordPress to fire when the plugin loads. 32 | */ 33 | protected $actions; 34 | 35 | /** 36 | * The array of filters registered with WordPress. 37 | * 38 | * @since 0.9.0 39 | * @access protected 40 | * @var array $filters The filters registered with WordPress to fire when the plugin loads. 41 | */ 42 | protected $filters; 43 | 44 | /** 45 | * Initialize the collections used to maintain the actions and filters. 46 | * 47 | * @since 0.9.0 48 | */ 49 | public function __construct() { 50 | 51 | $this->actions = array(); 52 | $this->filters = array(); 53 | 54 | } 55 | 56 | /** 57 | * Add a new action to the collection to be registered with WordPress. 58 | * 59 | * @since 0.9.0 60 | * @param string $hook The name of the WordPress action that is being registered. 61 | * @param object $component A reference to the instance of the object on which the action is defined. 62 | * @param string $callback The name of the function definition on the $component. 63 | * @param int $priority Optional. The priority at which the function should be fired. Default is 10. 64 | * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1. 65 | */ 66 | public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { 67 | $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); 68 | } 69 | 70 | /** 71 | * Add a new filter to the collection to be registered with WordPress. 72 | * 73 | * @since 0.9.0 74 | * @param string $hook The name of the WordPress filter that is being registered. 75 | * @param object $component A reference to the instance of the object on which the filter is defined. 76 | * @param string $callback The name of the function definition on the $component. 77 | * @param int $priority Optional. The priority at which the function should be fired. Default is 10. 78 | * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1 79 | */ 80 | public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { 81 | $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args ); 82 | } 83 | 84 | /** 85 | * A utility function that is used to register the actions and hooks into a single 86 | * collection. 87 | * 88 | * @since 0.9.0 89 | * @access private 90 | * @param array $hooks The collection of hooks that is being registered (that is, actions or filters). 91 | * @param string $hook The name of the WordPress filter that is being registered. 92 | * @param object $component A reference to the instance of the object on which the filter is defined. 93 | * @param string $callback The name of the function definition on the $component. 94 | * @param int $priority The priority at which the function should be fired. 95 | * @param int $accepted_args The number of arguments that should be passed to the $callback. 96 | * @return array The collection of actions and filters registered with WordPress. 97 | */ 98 | private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) { 99 | 100 | $hooks[] = array( 101 | 'hook' => $hook, 102 | 'component' => $component, 103 | 'callback' => $callback, 104 | 'priority' => $priority, 105 | 'accepted_args' => $accepted_args 106 | ); 107 | 108 | return $hooks; 109 | 110 | } 111 | 112 | /** 113 | * Register the filters and actions with WordPress. 114 | * 115 | * @since 0.9.0 116 | */ 117 | public function run() { 118 | 119 | foreach ( $this->filters as $hook ) { 120 | add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); 121 | } 122 | 123 | foreach ( $this->actions as $hook ) { 124 | add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); 125 | } 126 | 127 | } 128 | 129 | } 130 | -------------------------------------------------------------------------------- /admin/css/woocommerce-confirm-payment-admin.css: -------------------------------------------------------------------------------- 1 | /** 2 | * All of the CSS for your admin-specific functionality should be 3 | * included in this file. 4 | */ 5 | .wcp-wrap{} 6 | .wcp-wrap table.form-table input[type=email], 7 | .wcp-wrap table.form-table input[type=text]{ 8 | width: 400px; 9 | margin: 0; 10 | padding: 6px; 11 | box-sizing: border-box; 12 | vertical-align: top; 13 | } 14 | .wcp_input_table_wrapper{ 15 | overflow-x: auto; 16 | display: block; 17 | max-width: 800px; 18 | } 19 | table.wcp_input_table th{ 20 | display: table-cell; 21 | padding: 10px; 22 | } 23 | table.wcp_input_table tfoot th{ 24 | padding-left: 0; 25 | } 26 | table.wcp_input_table th.sort{ 27 | width: 17px; 28 | padding: 0 10px; 29 | } 30 | table.wcp_input_table td { 31 | display: table-cell; 32 | padding: 0; 33 | border-right: 1px solid #dfdfdf; 34 | border-bottom: 1px solid #dfdfdf; 35 | border-top: 0; 36 | background: #fff; 37 | cursor: default; 38 | } 39 | table.wcp_input_table td input[type=text]{ 40 | width: 100% !important; 41 | min-width: 100px; 42 | padding: 8px 10px; 43 | margin: 0; 44 | border: 0; 45 | outline: 0; 46 | box-shadow: none; 47 | background: transparent none; 48 | } 49 | table.wcp_input_table tr.is-focus td{ 50 | background-color: #fefbcc; 51 | } 52 | table.wcp_input_table td.sort{ 53 | cursor: move; 54 | font-size: 15px; 55 | background: #f9f9f9; 56 | text-align: center; 57 | vertical-align: middle; 58 | } 59 | .wcp-metabox-sortable-placeholder{ 60 | height: 55px; 61 | } 62 | .wcp-upload-image-wrapper{ 63 | position: relative; 64 | text-align: center; 65 | padding: 2px 0; 66 | } 67 | .wcp-image-preview{ 68 | width: 50px; 69 | height: 50px; 70 | margin: 0 auto; 71 | } 72 | .wcp-image-preview img{ 73 | width: 100%; 74 | height: 100%; 75 | } 76 | .wcp-upload-image-wrapper:hover .wcp-image-preview img{ 77 | opacity: .2; 78 | } 79 | .wcp-button-upload-image{ 80 | position: absolute; 81 | top: 50%; 82 | left: 50%; 83 | color: #23282d; 84 | transform: translate(-50%,-50%); 85 | -webkit-transform: translate(-50%,-50%); 86 | display: none; 87 | opacity: 0; 88 | } 89 | .wcp-button-remove-image{ 90 | position: absolute; 91 | top: 0; 92 | right: 0; 93 | font-size: 1em; 94 | height: 1em; 95 | width: 1em; 96 | text-align: center; 97 | line-height: 1; 98 | color: #fff !important; 99 | text-decoration: none; 100 | font-weight: normal; 101 | border: 0; 102 | background: #000; 103 | opacity: 0; 104 | } 105 | .account-item:not(.ui-sortable-helper) .wcp-upload-image-wrapper.has-logo:hover .wcp-button-remove-image{ 106 | opacity: .8; 107 | } 108 | .wcp-upload-image-wrapper.has-logo:hover .wcp-button-remove-image:hover{ 109 | opacity: 1; 110 | } 111 | .wcp-upload-image-wrapper:not(.has-logo) .wcp-button-upload-image{ 112 | opacity: 1; 113 | display: block; 114 | } 115 | .wcp-upload-image-wrapper.has-logo .wcp-button-remove-image{ 116 | display: block; 117 | } 118 | 119 | 120 | .column-wcp_slip{ 121 | position: relative; 122 | width: 52px; 123 | white-space: nowrap; 124 | text-align: center !important; 125 | } 126 | td.wcp_slip img{ 127 | margin: 0; 128 | width: auto; 129 | height: auto; 130 | max-width: 40px; 131 | max-height: 40px; 132 | vertical-align: middle; 133 | border: 1px solid #e5e5e5; 134 | border: 1px solid rgba(0,0,0,.07); 135 | } 136 | .wcp_slip span{ 137 | position: absolute; 138 | top: 10px; 139 | left: 0; 140 | right: 0; 141 | font-size: 16px; 142 | } 143 | .wcp-note h4{ 144 | margin: 0 0 5px; 145 | } 146 | .wcp-note img{ 147 | max-width: 100%; 148 | height: auto; 149 | margin-top: 10px; 150 | } 151 | 152 | .order-status.status-checking_payment { 153 | background: #c1e8ee; 154 | color: #45929f; 155 | } 156 | .payment-status{ 157 | display: -webkit-inline-box; 158 | display: inline-flex; 159 | line-height: 2.5em; 160 | color: #777; 161 | background: #e5e5e5; 162 | border-radius: 4px; 163 | border-bottom: 1px solid rgba(0,0,0,.05); 164 | margin: -.25em 0; 165 | cursor: inherit!important; 166 | white-space: nowrap; 167 | max-width: 100%; 168 | } 169 | .payment-status > span { 170 | margin: 0 1em; 171 | overflow: hidden; 172 | text-overflow: ellipsis; 173 | } 174 | .payment-status.status-wcp-pending_confirm{ 175 | color: #45929f; 176 | background: #c1e8ee; 177 | } 178 | .payment-status.status-wcp-success{ 179 | background: #c6e1c6; 180 | color: #5b841b; 181 | } 182 | .column-wcp_action{ 183 | width: 70px; 184 | } 185 | .widefat .column-wcp_action, 186 | .widefat #wcp_action{ 187 | text-align: right; 188 | } 189 | .widefat .column-wcp_action a.button{ 190 | display: block; 191 | position: relative; 192 | display: inline-block; 193 | margin: 2px 0 2px 4px; 194 | padding: 0 !important; 195 | height: 2em !important; 196 | width: 2em !important; 197 | overflow: hidden; 198 | text-align: center; 199 | vertical-align: middle; 200 | } 201 | .widefat .column-wcp_action a.button i{ 202 | line-height: 2em; 203 | font-size: 13px; 204 | } 205 | .widefat .column-wc_actions a.payment_detail::after{ 206 | content: "\f546"; 207 | } 208 | @media only screen and (max-width: 782px){ 209 | .wcp-wrap table.form-table input[type=email], 210 | .wcp-wrap table.form-table input[type=text]{ 211 | width: 100%; 212 | } 213 | td.wcp_slip img { 214 | min-width: 32px; 215 | } 216 | .column-wcp_slip{ 217 | display: none; 218 | } 219 | .post-type-wcp_confirm_payment .wp-list-table .column-wcp_slip{ 220 | text-align: left !important; 221 | padding-bottom: 0; 222 | } 223 | .post-type-wcp_confirm_payment .wp-list-table .toggle-row{ 224 | top: -28px; 225 | } 226 | .post-type-wcp_confirm_payment .wp-list-table .is-expanded td:not(.hidden){ 227 | overflow: visible; 228 | } 229 | .post-type-wcp_confirm_payment #the-list td{ 230 | clear: both !important; 231 | display: block !important; 232 | width: auto!important; 233 | } 234 | .widefat .column-wcp_action, .widefat #wcp_action{ 235 | text-align: left; 236 | } 237 | } -------------------------------------------------------------------------------- /public/css/woocommerce-confirm-payment-public.css: -------------------------------------------------------------------------------- 1 | /** 2 | * All of the CSS for your public-facing functionality should be 3 | * included in this file. 4 | */ 5 | .wcp-form{ 6 | -webkit-transition: opacity .2s; 7 | transition: opacity .2s; 8 | } 9 | .wcp-form.is-loading{ 10 | opacity: .7; 11 | pointer-events: none; 12 | } 13 | .wcp-form-inner{ 14 | display: -webkit-box; 15 | display: -ms-flexbox; 16 | display: flex; 17 | -ms-flex-wrap: wrap; 18 | flex-wrap: wrap; 19 | margin-right: -15px; 20 | margin-left: -15px; 21 | } 22 | .wcp-form-group{ 23 | position: relative; 24 | width: 100%; 25 | min-height: 1px; 26 | padding-right: 15px; 27 | padding-left: 15px; 28 | margin-bottom: 15px; 29 | } 30 | .wcp-form-label{ 31 | font-weight: bold; 32 | display: block; 33 | margin-bottom: 5px; 34 | } 35 | .wcp-form-group .wcp-form-control{ 36 | min-width: 100%; 37 | line-height: 1; 38 | height: 40px; 39 | padding: 9px 8px; 40 | border: solid 1px #ddd; 41 | background: #fff; 42 | } 43 | .wcp-form-group.has-error .wcp-form-control{ 44 | 45 | } 46 | .wcp-button-confirm{ 47 | position: relative; 48 | } 49 | .wcp-form.is-loading .wcp-button-confirm span{ 50 | opacity: 0; 51 | } 52 | .wcp-form.is-loading .wcp-button-confirm:after{ 53 | position: absolute; 54 | top: 50%; 55 | left: 50%; 56 | margin: -10px 0 0 -10px; 57 | content: " "; 58 | width: 20px; 59 | height: 20px; 60 | display: inline-block; 61 | vertical-align: middle; 62 | border: 1px solid #fff; 63 | border-radius: 50%; 64 | z-index: 16; 65 | border-top-color: transparent !important; 66 | -webkit-animation: wcp-load-spin 450ms infinite linear; 67 | animation: wcp-load-spin 450ms infinite linear; 68 | } 69 | .wcp-alert{ 70 | padding: 5px 0; 71 | line-height: 1; 72 | } 73 | .has-error .wcp-alert{ 74 | color: red; 75 | } 76 | .wcp-form-success-message{ 77 | color: #73af55; 78 | line-height: 1; 79 | margin: 0 0 30px; 80 | padding: 8px 15px; 81 | background: #f8f8f8; 82 | display: -webkit-box; 83 | display: -webkit-flex; 84 | display: -ms-flexbox; 85 | display: flex; 86 | -webkit-flex-wrap: wrap; 87 | -ms-flex-wrap: wrap; 88 | flex-wrap: wrap; 89 | -ms-flex-align: center; 90 | align-items: center; 91 | } 92 | .wcp-form-success-message > *{ 93 | -webkit-flex-basis: 0; 94 | -ms-flex-preferred-size: 0; 95 | flex-basis: 0; 96 | -webkit-box-flex: 1; 97 | -webkit-flex-grow: 1; 98 | -ms-flex-positive: 1; 99 | flex-grow: 1; 100 | max-width: 100%; 101 | } 102 | .wcp-form-success-message a{ 103 | font-weight: bold; 104 | color: #73af55; 105 | } 106 | .wcp-form-success-message p{ 107 | margin: 0; 108 | } 109 | .checkmark{ 110 | width: 30px; 111 | height: 35px; 112 | margin-right: 10px; 113 | -webkit-box-flex: 0; 114 | -webkit-flex: 0 0 30px; 115 | -ms-flex: 0 0 30px; 116 | flex: 0 0 30px; 117 | max-width: 30px; 118 | } 119 | .checkmark-path { 120 | stroke-dasharray: 1000; 121 | stroke-dashoffset: 0; 122 | } 123 | .checkmark-path.circle { 124 | -webkit-animation: wcp-dash 0.9s ease-in-out; 125 | animation: wcp-dash 0.9s ease-in-out; 126 | } 127 | .checkmark-path.line { 128 | stroke-dashoffset: 1000; 129 | -webkit-animation: wcp-dash 0.9s 0.35s ease-in-out forwards; 130 | animation: wcp-dash 0.9s 0.35s ease-in-out forwards; 131 | } 132 | .checkmark-path.check { 133 | stroke-dashoffset: -100; 134 | -webkit-animation: wcp-dash-check 0.9s 0.35s ease-in-out forwards; 135 | animation: wcp-dash-check 0.9s 0.35s ease-in-out forwards; 136 | } 137 | .wcp-account-detail-item{ 138 | display: block; 139 | } 140 | .wcp-account-detail-item ul{ 141 | width: 100%; 142 | display: table; 143 | padding: 0; 144 | margin: 0; 145 | list-style: none; 146 | display: table; 147 | } 148 | .wcp-account-detail-item li{ 149 | display: table-cell; 150 | width: 35%; 151 | padding-bottom: 5px; 152 | } 153 | .wcp-account-detail-item li.wcp-account-bank{ 154 | width: 45%; 155 | } 156 | .wcp-account-detail-item li.wcp-account-bank input{ 157 | height: auto; 158 | margin: 0; 159 | } 160 | .wcp-account-detail-item li.wcp-account-number{ 161 | width: 20%; 162 | } 163 | li.wcp-account-bank img{ 164 | width: 40px; 165 | height: 40px; 166 | margin: 0 10px; 167 | display: inline-block !important; 168 | vertical-align: middle; 169 | } 170 | 171 | .wcp-our-bank-title{ 172 | margin: 15px 0 10px; 173 | } 174 | .wcp-our-bank{ 175 | padding: 0; 176 | margin: 0; 177 | list-style: none; 178 | } 179 | .wcp-our-bank-item{ 180 | display: inline-block; 181 | margin-right: 5px; 182 | } 183 | .wcp-our-bank-item img{ 184 | position: relative !important; 185 | right: 0 !important; 186 | left: 0 !important; 187 | float: none !important; 188 | margin: 0 !important; 189 | opacity: 1 !important; 190 | max-width: none !important; 191 | max-height: none !important; 192 | display: block !important; 193 | transform: translate(0,0); 194 | -webkit-transform: translate(0,0); 195 | } 196 | 197 | img.wcp-slip{ 198 | margin: 0 !important; 199 | } 200 | .wc-bacs-bank-details.bacs_details .bank_logo{ 201 | list-style: none !important; 202 | } 203 | @keyframes wcp-load-spin { 204 | 100% { 205 | transform: rotate(360deg); 206 | } 207 | } 208 | @-o-keyframes wcp-load-spin { 209 | 100% { 210 | -o-transform: rotate(360deg); 211 | transform: rotate(360deg); 212 | } 213 | } 214 | @-ms-keyframes wcp-load-spin { 215 | 100% { 216 | -ms-transform: rotate(360deg); 217 | transform: rotate(360deg); 218 | } 219 | } 220 | @-webkit-keyframes wcp-load-spin { 221 | 100% { 222 | -webkit-transform: rotate(360deg); 223 | transform: rotate(360deg); 224 | } 225 | } 226 | @-moz-keyframes wcp-load-spin { 227 | 100% { 228 | -moz-transform: rotate(360deg); 229 | transform: rotate(360deg); 230 | } 231 | } 232 | @media (min-width: 768px){ 233 | 234 | .wcp-col-2{ 235 | -webkit-box-flex: 0; 236 | -ms-flex: 0 0 50%; 237 | flex: 0 0 50%; 238 | max-width: 50%; 239 | } 240 | } 241 | @-webkit-keyframes wcp-dash { 242 | 0% { 243 | stroke-dashoffset: 1000; 244 | } 245 | 100% { 246 | stroke-dashoffset: 0; 247 | } 248 | } 249 | @keyframes wcp-dash { 250 | 0% { 251 | stroke-dashoffset: 1000; 252 | } 253 | 100% { 254 | stroke-dashoffset: 0; 255 | } 256 | } 257 | @-webkit-keyframes wcp-dash-check { 258 | 0% { 259 | stroke-dashoffset: -100; 260 | } 261 | 100% { 262 | stroke-dashoffset: 900; 263 | } 264 | } 265 | @keyframes wcp-dash-check { 266 | 0% { 267 | stroke-dashoffset: -100; 268 | } 269 | 100% { 270 | stroke-dashoffset: 900; 271 | } 272 | } 273 | -------------------------------------------------------------------------------- /admin/class-woocommerce-confirm-payment-email-new-payment.php: -------------------------------------------------------------------------------- 1 | id = 'wcp_new_payment'; 32 | $this->title = __( 'New confirm payment', 'woocommerce-confirm-payment' ); 33 | $this->description = __( 'This is a payment notification sent to admin containing payment details after customer confirm payment.', 'woocommerce-confirm-payment' ); 34 | $this->template_html = 'emails/admin-new-payment.php'; 35 | $this->template_plain = 'emails/plain/admin-new-payment.php'; 36 | $this->template_base = plugin_dir_path( dirname( __FILE__ ) ) . 'templates/'; 37 | $this->placeholders = array( 38 | '{site_title}' => $this->get_blogname(), 39 | '{order_date}' => '', 40 | '{order_number}' => '', 41 | ); 42 | 43 | // Triggers for this email. 44 | 45 | add_action( 'woocommerce_order_status_on-hold_to_checking_payment_notification', array( $this, 'trigger' ), 10, 2 ); 46 | 47 | // Call parent constructor. 48 | parent::__construct(); 49 | 50 | // Other settings. 51 | $this->recipient = $this->get_option( 'recipient', get_option( 'admin_email' ) ); 52 | 53 | } 54 | 55 | /** 56 | * Get email subject. 57 | * 58 | * @since 3.1.0 59 | * @return string 60 | */ 61 | public function get_default_subject() { 62 | return __( '[{site_title}] Confirm payment order {order_number}', 'woocommerce-confirm-payment' ); 63 | } 64 | 65 | /** 66 | * Get email heading. 67 | * 68 | * @since 3.1.0 69 | * @return string 70 | */ 71 | public function get_default_heading() { 72 | return __( 'Customer Confirm payment', 'woocommerce-confirm-payment' ); 73 | } 74 | 75 | /** 76 | * Trigger the sending of this email. 77 | * 78 | * @param int $order_id The order ID. 79 | * @param WC_Order|false $order Order object. 80 | */ 81 | public function trigger( $order_id, $order = false ) { 82 | $this->setup_locale(); 83 | 84 | if ( $order_id && ! is_a( $order, 'WC_Order' ) ) { 85 | $order = wc_get_order( $order_id ); 86 | } 87 | 88 | if ( is_a( $order, 'WC_Order' ) ) { 89 | $this->object = $order; 90 | $this->placeholders['{order_date}'] = wc_format_datetime( $this->object->get_date_created() ); 91 | $this->placeholders['{order_number}'] = $this->object->get_order_number(); 92 | } 93 | 94 | if ( $this->is_enabled() && $this->get_recipient() ) { 95 | $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() ); 96 | } 97 | 98 | $this->restore_locale(); 99 | } 100 | 101 | /** 102 | * Get content html. 103 | * 104 | * @access public 105 | * @return string 106 | */ 107 | public function get_content_html() { 108 | return wc_get_template_html( 109 | $this->template_html, array( 110 | 'order' => $this->object, 111 | 'email_heading' => $this->get_heading(), 112 | 'sent_to_admin' => true, 113 | 'plain_text' => false, 114 | 'email' => $this, 115 | ), '', $this->template_base 116 | 117 | ); 118 | } 119 | 120 | /** 121 | * Get content plain. 122 | * 123 | * @access public 124 | * @return string 125 | */ 126 | public function get_content_plain() { 127 | return wc_get_template_html( 128 | $this->template_plain, array( 129 | 'order' => $this->object, 130 | 'email_heading' => $this->get_heading(), 131 | 'sent_to_admin' => true, 132 | 'plain_text' => true, 133 | 'email' => $this, 134 | ), '', $this->template_base 135 | ); 136 | } 137 | 138 | /** 139 | * Initialise settings form fields. 140 | */ 141 | public function init_form_fields() { 142 | $this->form_fields = array( 143 | 'enabled' => array( 144 | 'title' => __( 'Enable/Disable', 'woocommerce' ), 145 | 'type' => 'checkbox', 146 | 'label' => __( 'Enable this email notification', 'woocommerce' ), 147 | 'default' => 'yes', 148 | ), 149 | 'recipient' => array( 150 | 'title' => __( 'Recipient(s)', 'woocommerce' ), 151 | 'type' => 'text', 152 | /* translators: %s: WP admin email */ 153 | 'description' => sprintf( __( 'Enter recipients (comma separated) for this email. Defaults to %s.', 'woocommerce' ), '' . esc_attr( get_option( 'admin_email' ) ) . '' ), 154 | 'placeholder' => '', 155 | 'default' => get_option( 'admin_email' ), 156 | 'desc_tip' => true, 157 | ), 158 | 'subject' => array( 159 | 'title' => __( 'Subject', 'woocommerce' ), 160 | 'type' => 'text', 161 | 'desc_tip' => true, 162 | /* translators: %s: list of placeholders */ 163 | 'description' => sprintf( __( 'Available placeholders: %s', 'woocommerce' ), '{site_title}, {order_date}, {order_number}' ), 164 | 'placeholder' => $this->get_default_subject(), 165 | 'default' => '', 166 | ), 167 | 'heading' => array( 168 | 'title' => __( 'Email heading', 'woocommerce' ), 169 | 'type' => 'text', 170 | 'desc_tip' => true, 171 | /* translators: %s: list of placeholders */ 172 | 'description' => sprintf( __( 'Available placeholders: %s', 'woocommerce' ), '{site_title}, {order_date}, {order_number}' ), 173 | 'placeholder' => $this->get_default_heading(), 174 | 'default' => '', 175 | ), 176 | 'email_type' => array( 177 | 'title' => __( 'Email type', 'woocommerce' ), 178 | 'type' => 'select', 179 | 'description' => __( 'Choose which format of email to send.', 'woocommerce' ), 180 | 'default' => 'html', 181 | 'class' => 'email_type wc-enhanced-select', 182 | 'options' => $this->get_email_type_options(), 183 | 'desc_tip' => true, 184 | ), 185 | ); 186 | } 187 | } 188 | 189 | endif; 190 | -------------------------------------------------------------------------------- /public/partials/woocommerce-confirm-payment-confirm-form.php: -------------------------------------------------------------------------------- 1 | first_name . ' ' .$user->last_name; 24 | $phone = get_user_meta( get_current_user_id(), 'billing_phone', true ); 25 | 26 | $customer_orders = get_posts( array( 27 | 'numberposts' => -1, 28 | 'meta_query' => array( 29 | 'relation' => 'AND', 30 | array( 31 | 'key' => '_customer_user', 32 | 'value' => get_current_user_id(), 33 | 'compare' => '==', 34 | ), 35 | array( 36 | 'key' => '_payment_method', 37 | 'value' => 'bacs', 38 | 'compare' => '==', 39 | ), 40 | ), 41 | 'post_type' => 'shop_order', 42 | 'post_status' => 'wc-on-hold' 43 | ) ); 44 | 45 | } ?> 46 | 47 |
48 | 49 | 50 |
51 | 52 |
53 | 54 |
55 | 56 |
57 |
58 | 59 |
60 | 61 |
62 | 63 |
64 |
65 | 66 |
67 | 68 |
69 | 70 | 83 | 84 | ', 86 | ! empty( $atts['order_id'] ) ? 'readonly' : '', 87 | $order_id 88 | ) ?> 89 | 90 |
91 |
92 | 93 |
94 | 95 | 96 | ', 98 | $orders ? $orders->get_total() : '' 99 | ) ?> 100 |
101 |
102 | 103 |
104 | bank_accounts ) ) : 105 | foreach ( $this->bank_accounts as $account ) : ?> 106 | 117 | 119 |
120 |
121 | 122 |
123 | 124 |
125 | 126 |
127 |
128 | 129 |
130 | 131 |
132 | 133 |
134 |
135 | 136 |
137 | 138 |
139 | 140 |
141 |
142 | 143 |
144 | 145 | 146 |
147 | 148 |
149 | 150 |
151 | 152 | 153 | 154 |
-------------------------------------------------------------------------------- /admin/class-woocommerce-confirm-payment-setting.php: -------------------------------------------------------------------------------- 1 | 22 | */ 23 | class Woocommerce_Confirm_Payment_Admin_Setting{ 24 | 25 | /** 26 | * The ID of this plugin. 27 | * 28 | * @since 0.9.0 29 | * @access private 30 | * @var string $plugin_name The ID of this plugin. 31 | */ 32 | private $plugin_name; 33 | 34 | /** 35 | * The version of this plugin. 36 | * 37 | * @since 0.9.0 38 | * @access private 39 | * @var string $version The current version of this plugin. 40 | */ 41 | private $version; 42 | 43 | /** 44 | * bank_accounts 45 | * 46 | * @var array 47 | */ 48 | private $bank_accounts = array(); 49 | 50 | /** 51 | * Holds the values to be used in the fields callbacks 52 | */ 53 | private $options; 54 | 55 | /** 56 | * Initialize the class and set its properties. 57 | * 58 | * @since 0.9.0 59 | * @param string $plugin_name The name of this plugin. 60 | * @param string $version The version of this plugin. 61 | */ 62 | public function __construct( $plugin_name, $version ) { 63 | 64 | $this->plugin_name = $plugin_name; 65 | $this->version = $version; 66 | $this->options = get_option( 'wcp_option' ); 67 | $this->bank_accounts = get_option( 'wcp_bank_accounts' ); 68 | 69 | } 70 | 71 | public function register_email($emails) { 72 | 73 | require_once( 'class-woocommerce-confirm-payment-email-new-payment.php' ); 74 | require_once( 'class-woocommerce-confirm-payment-customer-email-completed-payment.php' ); 75 | require_once( 'class-woocommerce-confirm-payment-customer-email-cancelled-payment.php' ); 76 | 77 | $emails['WCP_Email_New_Payment'] = new Woocommerce_Confirm_Payment_Email_New_Payment(); 78 | $emails['WCP_Customer_Email_Completed_Payment'] = new Woocommerce_Confirm_Payment_Customer_Email_Completed_Payment(); 79 | $emails['WCP_Customer_Email_Cancelled_Payment'] = new Woocommerce_Confirm_Payment_Customer_Email_Cancelled_Payment(); 80 | 81 | return $emails; 82 | 83 | } 84 | 85 | public function add_plugin_page() { 86 | 87 | // This page will be under "Settings" 88 | 89 | add_submenu_page( 90 | 'edit.php?post_type=wcp_confirm_payment', 91 | __( 'Woocommerce confirm payment settings', 'woocommerce-confirm-payment' ), 92 | __( 'Setting', 'woocommerce-confirm-payment' ), 93 | 'manage_options', 94 | 'wcp-setting-admin', 95 | array( $this, 'create_admin_page' ) 96 | ); 97 | } 98 | 99 | /** 100 | * Options page callback 101 | */ 102 | public function create_admin_page() { ?> 103 |
104 |

105 | 106 | 107 | 108 |
109 | 114 |
115 |
116 | 'transfer_slip_required', 174 | 'description' => __( 'Enable required field', 'woocommerce-confirm-payment' ) 175 | ) 176 | ); 177 | 178 | add_settings_field( 179 | 'show_form_on_thankyou_page', 180 | __( 'Payment form', 'woocommerce-confirm-payment' ), 181 | array( $this, 'checkbox_callback' ), 182 | 'wcp-setting-admin-general', 183 | 'setting_payment_form', 184 | array( 185 | 'name' => 'show_form_on_thankyou_page', 186 | 'description' => __( 'Show form on thank you page.', 'woocommerce-confirm-payment' ) 187 | ) 188 | ); 189 | 190 | add_settings_field( 191 | 'line_notification_enabled', 192 | __( 'LINE Notify', 'woocommerce-confirm-payment' ), 193 | array( $this, 'checkbox_callback' ), 194 | 'wcp-setting-admin-general', 195 | 'setting_notification', 196 | array( 197 | 'name' => 'line_notification_enabled', 198 | 'description' => __( 'Enable this line notification', 'woocommerce-confirm-payment' ) 199 | ) 200 | ); 201 | add_settings_field( 202 | 'line_notify_token', 203 | __( 'Line Notify Token', 'woocommerce-confirm-payment' ), 204 | array( $this, 'text_callback' ), 205 | 'wcp-setting-admin-general', 206 | 'setting_notification', 207 | array( 208 | 'name' => 'line_notify_token', 209 | 'description' => sprintf( 210 | __( 'Generate token Click here', 'woocommerce-confirm-payment' ), 211 | 'https://notify-bot.line.me/' 212 | ) 213 | ) 214 | ); 215 | 216 | } 217 | 218 | public function confirm_page_callback(){ 219 | 220 | $args = array( 221 | 'name' => 'wcp_option[confirm_page]', 222 | 'id' => 'confirm_page', 223 | 'sort_column' => 'menu_order', 224 | 'sort_order' => 'ASC', 225 | 'class' => '', 226 | 'echo' => true, 227 | 'selected' => absint( isset( $this->options['confirm_page'] ) ? $this->options['confirm_page'] : '' ), 228 | 'post_status' => 'publish,private,draft', 229 | ); 230 | 231 | wp_dropdown_pages( $args ); 232 | 233 | } 234 | 235 | public function bank_accounts_callback(){ 236 | 237 | include( 'partials/woocommerce-confirm-payment-admin-account-details-field.php' ); 238 | 239 | } 240 | 241 | public function checkbox_callback($args) { 242 | 243 | printf( 244 | '', 245 | $args['name'], 246 | $args['name'], 247 | isset( $this->options[$args['name']] ) ? checked( esc_attr( $this->options[$args['name']] ), 1, false ) : '', 248 | isset( $args['description'] ) ? $args['description'] : '' 249 | ); 250 | 251 | } 252 | 253 | public function text_callback($args) { 254 | 255 | printf( 256 | '%s', 257 | $args['name'], 258 | $args['name'], 259 | isset( $this->options[$args['name']] ) ? esc_attr( $this->options[$args['name']]) : '', 260 | isset( $args['placeholder'] ) ? $args['placeholder'] : '', 261 | isset( $args['description'] ) ? '

' . $args['description'] . '

' : '' 262 | ); 263 | 264 | } 265 | 266 | public function setting_payment_form_callback($args) { 267 | 268 | printf( 269 | __( 'For email notification settings, %sclick here to senting.%s', 'woocommerce-confirm-payment' ), 270 | '
', 271 | '' 272 | ); 273 | 274 | } 275 | 276 | public function setting_notification_callback($args) { 277 | 278 | printf( 279 | __( 'For email notification settings, %sclick here to senting.%s', 'woocommerce-confirm-payment' ), 280 | '', 281 | '' 282 | ); 283 | 284 | } 285 | 286 | /** 287 | * Sanitize each setting field as needed 288 | * 289 | * @param array $input Contains all settings fields as array keys 290 | */ 291 | public function save_option( $input ) { 292 | 293 | $accounts = array(); 294 | 295 | if ( isset( $_POST['bank_logo'] ) && isset( $_POST['bank_name'] ) && isset( $_POST['account_name'] ) && isset( $_POST['account_number'] ) ) { 296 | 297 | $bank_logos = wc_clean( wp_unslash( $_POST['bank_logo'] ) ); 298 | $bank_names = wc_clean( wp_unslash( $_POST['bank_name'] ) ); 299 | $account_names = wc_clean( wp_unslash( $_POST['account_name'] ) ); 300 | $account_numbers = wc_clean( wp_unslash( $_POST['account_number'] ) ); 301 | 302 | foreach ( $account_names as $i => $name ) { 303 | if ( ! isset( $account_names[ $i ] ) ) { 304 | continue; 305 | } 306 | 307 | $accounts[] = array( 308 | 'bank_logo' => $bank_logos[ $i ], 309 | 'bank_name' => $bank_names[ $i ], 310 | 'account_number' => $account_numbers[ $i ], 311 | 'account_name' => $account_names[ $i ], 312 | ); 313 | } 314 | } 315 | 316 | update_option( 'wcp_bank_accounts', $accounts ); 317 | 318 | return $input; 319 | 320 | } 321 | 322 | public function add_woocommerce_email_actions( $actions ){ 323 | 324 | $actions[] = 'woocommerce_order_status_on-hold_to_checking_payment'; 325 | $actions[] = 'woocommerce_order_status_checking_payment_to_processing'; 326 | $actions[] = 'woocommerce_order_status_checking_payment_to_on-hold'; 327 | 328 | return $actions; 329 | 330 | } 331 | 332 | } -------------------------------------------------------------------------------- /includes/class-woocommerce-confirm-payment.php: -------------------------------------------------------------------------------- 1 | 29 | */ 30 | class Woocommerce_Confirm_Payment { 31 | 32 | /** 33 | * The loader that's responsible for maintaining and registering all hooks that power 34 | * the plugin. 35 | * 36 | * @since 0.9.0 37 | * @access protected 38 | * @var Woocommerce_Confirm_Payment_Loader $loader Maintains and registers all hooks for the plugin. 39 | */ 40 | protected $loader; 41 | 42 | /** 43 | * The unique identifier of this plugin. 44 | * 45 | * @since 0.9.0 46 | * @access protected 47 | * @var string $plugin_name The string used to uniquely identify this plugin. 48 | */ 49 | protected $plugin_name; 50 | 51 | /** 52 | * The current version of the plugin. 53 | * 54 | * @since 0.9.0 55 | * @access protected 56 | * @var string $version The current version of the plugin. 57 | */ 58 | protected $version; 59 | 60 | /** 61 | * Define the core functionality of the plugin. 62 | * 63 | * Set the plugin name and the plugin version that can be used throughout the plugin. 64 | * Load the dependencies, define the locale, and set the hooks for the admin area and 65 | * the public-facing side of the site. 66 | * 67 | * @since 0.9.0 68 | */ 69 | public function __construct() { 70 | if ( defined( 'PLUGIN_WCP_VERSION' ) ) { 71 | $this->version = PLUGIN_WCP_VERSION; 72 | } else { 73 | $this->version = '1.0.0'; 74 | } 75 | $this->plugin_name = 'woocommerce-confirm-payment'; 76 | 77 | $this->load_dependencies(); 78 | $this->set_locale(); 79 | $this->define_admin_hooks(); 80 | $this->define_public_hooks(); 81 | 82 | } 83 | 84 | /** 85 | * Load the required dependencies for this plugin. 86 | * 87 | * Include the following files that make up the plugin: 88 | * 89 | * - Woocommerce_Confirm_Payment_Loader. Orchestrates the hooks of the plugin. 90 | * - Woocommerce_Confirm_Payment_i18n. Defines internationalization functionality. 91 | * - Woocommerce_Confirm_Payment_Admin. Defines all hooks for the admin area. 92 | * - Woocommerce_Confirm_Payment_Public. Defines all hooks for the public side of the site. 93 | * 94 | * Create an instance of the loader which will be used to register the hooks 95 | * with WordPress. 96 | * 97 | * @since 0.9.0 98 | * @access private 99 | */ 100 | private function load_dependencies() { 101 | 102 | /** 103 | * The class responsible for orchestrating the actions and filters of the 104 | * core plugin. 105 | */ 106 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-woocommerce-confirm-payment-loader.php'; 107 | 108 | /** 109 | * The class responsible for defining internationalization functionality 110 | * of the plugin. 111 | */ 112 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-woocommerce-confirm-payment-i18n.php'; 113 | 114 | /** 115 | * The class responsible for defining all actions that occur in the admin area. 116 | */ 117 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-woocommerce-confirm-payment-admin.php'; 118 | 119 | /** 120 | * The class responsible for defining all actions that occur in the public-facing 121 | * side of the site. 122 | */ 123 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-woocommerce-confirm-payment-public.php'; 124 | 125 | $this->loader = new Woocommerce_Confirm_Payment_Loader(); 126 | 127 | } 128 | 129 | /** 130 | * Define the locale for this plugin for internationalization. 131 | * 132 | * Uses the Woocommerce_Confirm_Payment_i18n class in order to set the domain and to register the hook 133 | * with WordPress. 134 | * 135 | * @since 0.9.0 136 | * @access private 137 | */ 138 | private function set_locale() { 139 | 140 | $plugin_i18n = new Woocommerce_Confirm_Payment_i18n(); 141 | 142 | $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); 143 | 144 | } 145 | 146 | /** 147 | * Register all of the hooks related to the admin area functionality 148 | * of the plugin. 149 | * 150 | * @since 0.9.0 151 | * @access private 152 | */ 153 | private function define_admin_hooks() { 154 | 155 | $plugin_admin = new Woocommerce_Confirm_Payment_Admin( $this->get_plugin_name(), $this->get_version() ); 156 | $plugin_settings = new Woocommerce_Confirm_Payment_Admin_Setting( $this->get_plugin_name(), $this->get_version() ); 157 | $email = new Woocommerce_Confirm_Payment_Email( $this->get_plugin_name(), $this->get_version() ); 158 | 159 | $this->loader->add_action( 'admin_menu', $plugin_settings, 'add_plugin_page' ); 160 | $this->loader->add_action( 'admin_init', $plugin_settings, 'page_init' ); 161 | $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); 162 | $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); 163 | $this->loader->add_action( 'init', $plugin_admin, 'register_post_type' ); 164 | $this->loader->add_filter( 'manage_wcp_confirm_payment_posts_columns', $plugin_admin, 'columns' ); 165 | $this->loader->add_action( 'manage_wcp_confirm_payment_posts_custom_column', $plugin_admin, 'columns_display', 10, 2 ); 166 | $this->loader->add_action( 'init', $plugin_admin, 'flush_rewrite_rules' ); 167 | $this->loader->add_action( 'display_post_states', $plugin_admin, 'post_states', 10, 2 ); 168 | $this->loader->add_action( 'init', $plugin_admin, 'register_order_status' ); 169 | $this->loader->add_filter( 'wc_order_statuses', $plugin_admin, 'add_order_statuses' ); 170 | $this->loader->add_filter( 'post_date_column_status', $plugin_admin, 'post_date_column_status' ); 171 | $this->loader->add_action( 'wp_ajax_wcp_mark_payment_status', $plugin_admin, 'mark_payment_status' ); 172 | $this->loader->add_action( 'admin_head', $plugin_admin, 'menu_payment_count' ); 173 | $this->loader->add_filter( 'wc_order_statuses', $plugin_admin, 'add_order_statuses' ); 174 | $this->loader->add_action( 'restrict_manage_posts', $plugin_admin, 'filter_payment_field' ); 175 | $this->loader->add_action( 'pre_get_posts', $plugin_admin, 'filter_payment' ); 176 | $this->loader->add_filter( 'post_row_actions', $plugin_admin, 'remove_row_actions', 10, 2 ); 177 | $this->loader->add_filter( 'bulk_actions-edit-wcp_confirm_payment', $plugin_admin, 'remove_edit_bulk_actions', 10, 2 ); 178 | $this->loader->add_action( 'woocommerce_order_status_checking_payment_to_processing', $plugin_admin, 'approve_payment' ); 179 | $this->loader->add_action( 'woocommerce_order_status_checking_payment_to_on-hold', $plugin_admin, 'cancel_payment' ); 180 | $this->loader->add_filter( 'woocommerce_admin_order_actions', $plugin_admin, 'woocommerce_admin_order_actions', 10, 2 ); 181 | $this->loader->add_filter( 'woocommerce_email_classes', $email, 'register_email', 90, 1 ); 182 | $this->loader->add_action( 'woocommerce_email_actions', $email, 'add_woocommerce_email_actions' ); 183 | $this->loader->add_action( 'wcp_email_payment_details', $email, 'payment_details', 10, 4 ); 184 | 185 | } 186 | 187 | /** 188 | * Register all of the hooks related to the public-facing functionality 189 | * of the plugin. 190 | * 191 | * @since 0.9.0 192 | * @access private 193 | */ 194 | private function define_public_hooks() { 195 | 196 | $plugin_public = new Woocommerce_Confirm_Payment_Public( $this->get_plugin_name(), $this->get_version() ); 197 | $payment_history = new Woocommerce_Confirm_Payment_History( $this->get_plugin_name(), $this->get_version() ); 198 | 199 | $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); 200 | $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); 201 | $this->loader->add_action( 'init', $plugin_public, 'add_shortcode' ); 202 | 203 | $this->loader->add_action( 'woocommerce_email_before_order_table', $plugin_public, 'email_instructions', 10, 3 ); 204 | $this->loader->add_action( 'init', $plugin_public, 'remove_bank_original', 100 ); 205 | $this->loader->add_action( 'woocommerce_thankyou_bacs', $plugin_public, 'thankyou_page' ); 206 | $this->loader->add_action( 'woocommerce_gateway_description', $plugin_public, 'gateway_description', 10, 2 ); 207 | $this->loader->add_action( 'template_redirect', $plugin_public, 'redirect_single_attachment' ); 208 | $this->loader->add_action( 'wp_ajax_wcp_confirm_payment', $plugin_public, 'confirm_payment' ); 209 | $this->loader->add_action( 'wp_ajax_nopriv_wcp_confirm_payment', $plugin_public, 'confirm_payment' ); 210 | $this->loader->add_action( 'wp_ajax_wcp_check_order', $plugin_public, 'ajax_check_order' ); 211 | $this->loader->add_action( 'wp_ajax_nopriv_wcp_check_order', $plugin_public, 'ajax_check_order' ); 212 | $this->loader->add_filter( 'woocommerce_my_account_my_orders_actions', $plugin_public, 'woocommerce_my_account_my_orders_actions', 10, 2 ); 213 | $this->loader->add_filter( 'query_vars', $plugin_public, 'add_query_vars' ); 214 | 215 | $this->loader->add_filter( 'woocommerce_get_query_vars', $payment_history, 'woocommerce_get_query_vars' ); 216 | $this->loader->add_filter( 'woocommerce_account_menu_items', $payment_history, 'woocommerce_menu_item', 40 ); 217 | $this->loader->add_action( 'init', $payment_history, 'woocommerce_add_endpoints' ); 218 | $this->loader->add_action( 'woocommerce_account_' . $this->plugin_name . '_endpoint', $payment_history, 'woocommerce_account_payment_history' ); 219 | $this->loader->add_filter( 'woocommerce_endpoint_' . $this->plugin_name . '_title', $payment_history, 'woocommerce_endpoints_title', $this->plugin_name ); 220 | 221 | } 222 | 223 | /** 224 | * Run the loader to execute all of the hooks with WordPress. 225 | * 226 | * @since 0.9.0 227 | */ 228 | public function run() { 229 | $this->loader->run(); 230 | } 231 | 232 | /** 233 | * The name of the plugin used to uniquely identify it within the context of 234 | * WordPress and to define internationalization functionality. 235 | * 236 | * @since 1.0.0 237 | * @return string The name of the plugin. 238 | */ 239 | public function get_plugin_name() { 240 | return $this->plugin_name; 241 | } 242 | 243 | /** 244 | * The reference to the class that orchestrates the hooks with the plugin. 245 | * 246 | * @since 1.0.0 247 | * @return Woocommerce_Confirm_Payment_Loader Orchestrates the hooks of the plugin. 248 | */ 249 | public function get_loader() { 250 | return $this->loader; 251 | } 252 | 253 | /** 254 | * Retrieve the version number of the plugin. 255 | * 256 | * @since 1.0.0 257 | * @return string The version number of the plugin. 258 | */ 259 | public function get_version() { 260 | return $this->version; 261 | } 262 | 263 | } 264 | -------------------------------------------------------------------------------- /public/js/cleave.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * cleave.js - 1.4.4 3 | * https://github.com/nosir/cleave.js 4 | * Apache License Version 2.0 5 | * 6 | * Copyright (C) 2012-2018 Max Huang https://github.com/nosir/ 7 | */ 8 | !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Cleave=t():e.Cleave=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){(function(t){"use strict";var n=function(e,t){var r=this;if("string"==typeof e?r.element=document.querySelector(e):r.element="undefined"!=typeof e.length&&e.length>0?e[0]:e,!r.element)throw new Error("[cleave.js] Please check the element");t.initValue=r.element.value,r.properties=n.DefaultProperties.assign({},t),r.init()};n.prototype={init:function(){var e=this,t=e.properties;return t.numeral||t.phone||t.creditCard||t.time||t.date||0!==t.blocksLength||t.prefix?(t.maxLength=n.Util.getMaxLength(t.blocks),e.isAndroid=n.Util.isAndroid(),e.lastInputValue="",e.onChangeListener=e.onChange.bind(e),e.onKeyDownListener=e.onKeyDown.bind(e),e.onFocusListener=e.onFocus.bind(e),e.onCutListener=e.onCut.bind(e),e.onCopyListener=e.onCopy.bind(e),e.element.addEventListener("input",e.onChangeListener),e.element.addEventListener("keydown",e.onKeyDownListener),e.element.addEventListener("focus",e.onFocusListener),e.element.addEventListener("cut",e.onCutListener),e.element.addEventListener("copy",e.onCopyListener),e.initPhoneFormatter(),e.initDateFormatter(),e.initTimeFormatter(),e.initNumeralFormatter(),void((t.initValue||t.prefix&&!t.noImmediatePrefix)&&e.onInput(t.initValue))):void e.onInput(t.initValue)},initNumeralFormatter:function(){var e=this,t=e.properties;t.numeral&&(t.numeralFormatter=new n.NumeralFormatter(t.numeralDecimalMark,t.numeralIntegerScale,t.numeralDecimalScale,t.numeralThousandsGroupStyle,t.numeralPositiveOnly,t.stripLeadingZeroes,t.delimiter))},initTimeFormatter:function(){var e=this,t=e.properties;t.time&&(t.timeFormatter=new n.TimeFormatter(t.timePattern),t.blocks=t.timeFormatter.getBlocks(),t.blocksLength=t.blocks.length,t.maxLength=n.Util.getMaxLength(t.blocks))},initDateFormatter:function(){var e=this,t=e.properties;t.date&&(t.dateFormatter=new n.DateFormatter(t.datePattern),t.blocks=t.dateFormatter.getBlocks(),t.blocksLength=t.blocks.length,t.maxLength=n.Util.getMaxLength(t.blocks))},initPhoneFormatter:function(){var e=this,t=e.properties;if(t.phone)try{t.phoneFormatter=new n.PhoneFormatter(new t.root.Cleave.AsYouTypeFormatter(t.phoneRegionCode),t.delimiter)}catch(r){throw new Error("[cleave.js] Please include phone-type-formatter.{country}.js lib")}},onKeyDown:function(e){var t=this,r=t.properties,i=e.which||e.keyCode,a=n.Util,o=t.element.value;return 229===i&&a.isAndroidBackspaceKeydown(t.lastInputValue,o)&&(i=8),t.lastInputValue=o,8===i&&a.isDelimiter(o.slice(-r.delimiterLength),r.delimiter,r.delimiters)?void(r.backspace=!0):void(r.backspace=!1)},onChange:function(){this.onInput(this.element.value)},onFocus:function(){var e=this,t=e.properties;n.Util.fixPrefixCursor(e.element,t.prefix,t.delimiter,t.delimiters)},onCut:function(e){this.copyClipboardData(e),this.onInput("")},onCopy:function(e){this.copyClipboardData(e)},copyClipboardData:function(e){var t=this,r=t.properties,i=n.Util,a=t.element.value,o="";o=r.copyDelimiter?a:i.stripDelimiters(a,r.delimiter,r.delimiters);try{e.clipboardData?e.clipboardData.setData("Text",o):window.clipboardData.setData("Text",o),e.preventDefault()}catch(l){}},onInput:function(e){var t=this,r=t.properties,i=n.Util;return r.numeral||!r.backspace||i.isDelimiter(e.slice(-r.delimiterLength),r.delimiter,r.delimiters)||(e=i.headStr(e,e.length-r.delimiterLength)),r.phone?(!r.prefix||r.noImmediatePrefix&&!e.length?r.result=r.phoneFormatter.format(e):r.result=r.prefix+r.phoneFormatter.format(e).slice(r.prefix.length),void t.updateValueState()):r.numeral?(!r.prefix||r.noImmediatePrefix&&!e.length?r.result=r.numeralFormatter.format(e):r.result=r.prefix+r.numeralFormatter.format(e),void t.updateValueState()):(r.date&&(e=r.dateFormatter.getValidatedDate(e)),r.time&&(e=r.timeFormatter.getValidatedTime(e)),e=i.stripDelimiters(e,r.delimiter,r.delimiters),e=i.getPrefixStrippedValue(e,r.prefix,r.prefixLength,r.result),e=r.numericOnly?i.strip(e,/[^\d]/g):e,e=r.uppercase?e.toUpperCase():e,e=r.lowercase?e.toLowerCase():e,!r.prefix||r.noImmediatePrefix&&!e.length||(e=r.prefix+e,0!==r.blocksLength)?(r.creditCard&&t.updateCreditCardPropsByValue(e),e=i.headStr(e,r.maxLength),r.result=i.getFormattedValue(e,r.blocks,r.blocksLength,r.delimiter,r.delimiters,r.delimiterLazyShow),void t.updateValueState()):(r.result=e,void t.updateValueState()))},updateCreditCardPropsByValue:function(e){var t,r=this,i=r.properties,a=n.Util;a.headStr(i.result,4)!==a.headStr(e,4)&&(t=n.CreditCardDetector.getInfo(e,i.creditCardStrictMode),i.blocks=t.blocks,i.blocksLength=i.blocks.length,i.maxLength=a.getMaxLength(i.blocks),i.creditCardType!==t.type&&(i.creditCardType=t.type,i.onCreditCardTypeChanged.call(r,i.creditCardType)))},updateValueState:function(){var e=this,t=n.Util,r=e.properties;if(e.element){var i=e.element.selectionEnd,a=e.element.value,o=r.result;if(i=t.getNextCursorPosition(i,a,o,r.delimiter,r.delimiters),e.isAndroid)return void window.setTimeout(function(){e.element.value=o,t.setSelection(e.element,i,r.document,!1),e.callOnValueChanged()},1);e.element.value=o,t.setSelection(e.element,i,r.document,!1),e.callOnValueChanged()}},callOnValueChanged:function(){var e=this,t=e.properties;t.onValueChanged.call(e,{target:{value:t.result,rawValue:e.getRawValue()}})},setPhoneRegionCode:function(e){var t=this,r=t.properties;r.phoneRegionCode=e,t.initPhoneFormatter(),t.onChange()},setRawValue:function(e){var t=this,r=t.properties;e=void 0!==e&&null!==e?e.toString():"",r.numeral&&(e=e.replace(".",r.numeralDecimalMark)),r.backspace=!1,t.element.value=e,t.onInput(e)},getRawValue:function(){var e=this,t=e.properties,r=n.Util,i=e.element.value;return t.rawValueTrimPrefix&&(i=r.getPrefixStrippedValue(i,t.prefix,t.prefixLength,t.result)),i=t.numeral?t.numeralFormatter.getRawValue(i):r.stripDelimiters(i,t.delimiter,t.delimiters)},getISOFormatDate:function(){var e=this,t=e.properties;return t.date?t.dateFormatter.getISOFormatDate():""},getFormattedValue:function(){return this.element.value},destroy:function(){var e=this;e.element.removeEventListener("input",e.onChangeListener),e.element.removeEventListener("keydown",e.onKeyDownListener),e.element.removeEventListener("focus",e.onFocusListener),e.element.removeEventListener("cut",e.onCutListener),e.element.removeEventListener("copy",e.onCopyListener)},toString:function(){return"[Cleave Object]"}},n.NumeralFormatter=r(1),n.DateFormatter=r(2),n.TimeFormatter=r(3),n.PhoneFormatter=r(4),n.CreditCardDetector=r(5),n.Util=r(6),n.DefaultProperties=r(7),("object"==typeof t&&t?t:window).Cleave=n,e.exports=n}).call(t,function(){return this}())},function(e,t){"use strict";var r=function(e,t,n,i,a,o,l){var s=this;s.numeralDecimalMark=e||".",s.numeralIntegerScale=t>0?t:0,s.numeralDecimalScale=n>=0?n:2,s.numeralThousandsGroupStyle=i||r.groupStyle.thousand,s.numeralPositiveOnly=!!a,s.stripLeadingZeroes=o!==!1,s.delimiter=l||""===l?l:",",s.delimiterRE=l?new RegExp("\\"+l,"g"):""};r.groupStyle={thousand:"thousand",lakh:"lakh",wan:"wan",none:"none"},r.prototype={getRawValue:function(e){return e.replace(this.delimiterRE,"").replace(this.numeralDecimalMark,".")},format:function(e){var t,n,i=this,a="";switch(e=e.replace(/[A-Za-z]/g,"").replace(i.numeralDecimalMark,"M").replace(/[^\dM-]/g,"").replace(/^\-/,"N").replace(/\-/g,"").replace("N",i.numeralPositiveOnly?"":"-").replace("M",i.numeralDecimalMark),i.stripLeadingZeroes&&(e=e.replace(/^(-)?0+(?=\d)/,"$1")),n=e,e.indexOf(i.numeralDecimalMark)>=0&&(t=e.split(i.numeralDecimalMark),n=t[0],a=i.numeralDecimalMark+t[1].slice(0,i.numeralDecimalScale)),i.numeralIntegerScale>0&&(n=n.slice(0,i.numeralIntegerScale+("-"===e.slice(0,1)?1:0))),i.numeralThousandsGroupStyle){case r.groupStyle.lakh:n=n.replace(/(\d)(?=(\d\d)+\d$)/g,"$1"+i.delimiter);break;case r.groupStyle.wan:n=n.replace(/(\d)(?=(\d{4})+$)/g,"$1"+i.delimiter);break;case r.groupStyle.thousand:n=n.replace(/(\d)(?=(\d{3})+$)/g,"$1"+i.delimiter)}return n.toString()+(i.numeralDecimalScale>0?a.toString():"")}},e.exports=r},function(e,t){"use strict";var r=function(e){var t=this;t.date=[],t.blocks=[],t.datePattern=e,t.initBlocks()};r.prototype={initBlocks:function(){var e=this;e.datePattern.forEach(function(t){"Y"===t?e.blocks.push(4):e.blocks.push(2)})},getISOFormatDate:function(){var e=this,t=e.date;return t[2]?t[2]+"-"+e.addLeadingZero(t[1])+"-"+e.addLeadingZero(t[0]):""},getBlocks:function(){return this.blocks},getValidatedDate:function(e){var t=this,r="";return e=e.replace(/[^\d]/g,""),t.blocks.forEach(function(n,i){if(e.length>0){var a=e.slice(0,n),o=a.slice(0,1),l=e.slice(n);switch(t.datePattern[i]){case"d":"00"===a?a="01":parseInt(o,10)>3?a="0"+o:parseInt(a,10)>31&&(a="31");break;case"m":"00"===a?a="01":parseInt(o,10)>1?a="0"+o:parseInt(a,10)>12&&(a="12")}r+=a,e=l}}),this.getFixedDateString(r)},getFixedDateString:function(e){var t,r,n,i=this,a=i.datePattern,o=[],l=0,s=0,c=0,u=0,d=0,m=0,p=!1;return 4===e.length&&"y"!==a[0].toLowerCase()&&"y"!==a[1].toLowerCase()&&(u="d"===a[0]?0:2,d=2-u,t=parseInt(e.slice(u,u+2),10),r=parseInt(e.slice(d,d+2),10),o=this.getFixedDate(t,r,0)),8===e.length&&(a.forEach(function(e,t){switch(e){case"d":l=t;break;case"m":s=t;break;default:c=t}}),m=2*c,u=l<=c?2*l:2*l+2,d=s<=c?2*s:2*s+2,t=parseInt(e.slice(u,u+2),10),r=parseInt(e.slice(d,d+2),10),n=parseInt(e.slice(m,m+4),10),p=4===e.slice(m,m+4).length,o=this.getFixedDate(t,r,n)),i.date=o,0===o.length?e:a.reduce(function(e,t){switch(t){case"d":return e+i.addLeadingZero(o[0]);case"m":return e+i.addLeadingZero(o[1]);default:return e+(p?i.addLeadingZeroForYear(o[2]):"")}},"")},getFixedDate:function(e,t,r){return e=Math.min(e,31),t=Math.min(t,12),r=parseInt(r||0,10),(t<7&&t%2===0||t>8&&t%2===1)&&(e=Math.min(e,2===t?this.isLeapYear(r)?29:28:30)),[e,t,r]},isLeapYear:function(e){return e%4===0&&e%100!==0||e%400===0},addLeadingZero:function(e){return(e<10?"0":"")+e},addLeadingZeroForYear:function(e){return(e<10?"000":e<100?"00":e<1e3?"0":"")+e}},e.exports=r},function(e,t){"use strict";var r=function(e){var t=this;t.time=[],t.blocks=[],t.timePattern=e,t.initBlocks()};r.prototype={initBlocks:function(){var e=this;e.timePattern.forEach(function(){e.blocks.push(2)})},getISOFormatTime:function(){var e=this,t=e.time;return t[2]?e.addLeadingZero(t[0])+":"+e.addLeadingZero(t[1])+":"+e.addLeadingZero(t[2]):""},getBlocks:function(){return this.blocks},getValidatedTime:function(e){var t=this,r="";return e=e.replace(/[^\d]/g,""),t.blocks.forEach(function(n,i){if(e.length>0){var a=e.slice(0,n),o=a.slice(0,1),l=e.slice(n);switch(t.timePattern[i]){case"h":parseInt(o,10)>2?a="0"+o:parseInt(a,10)>23&&(a="23");break;case"m":case"s":parseInt(o,10)>5?a="0"+o:parseInt(a,10)>60&&(a="60")}r+=a,e=l}}),this.getFixedTimeString(r)},getFixedTimeString:function(e){var t,r,n,i=this,a=i.timePattern,o=[],l=0,s=0,c=0,u=0,d=0,m=0;return 6===e.length&&(a.forEach(function(e,t){switch(e){case"s":l=2*t;break;case"m":s=2*t;break;case"h":c=2*t}}),m=c,d=s,u=l,t=parseInt(e.slice(u,u+2),10),r=parseInt(e.slice(d,d+2),10),n=parseInt(e.slice(m,m+2),10),o=this.getFixedTime(n,r,t)),4===e.length&&i.timePattern.indexOf("s")<0&&(a.forEach(function(e,t){switch(e){case"m":s=2*t;break;case"h":c=2*t}}),m=c,d=s,t=0,r=parseInt(e.slice(d,d+2),10),n=parseInt(e.slice(m,m+2),10),o=this.getFixedTime(n,r,t)),i.time=o,0===o.length?e:a.reduce(function(e,t){switch(t){case"s":return e+i.addLeadingZero(o[2]);case"m":return e+i.addLeadingZero(o[1]);case"h":return e+i.addLeadingZero(o[0])}},"")},getFixedTime:function(e,t,r){return r=Math.min(parseInt(r||0,10),60),t=Math.min(t,60),e=Math.min(e,60),[e,t,r]},addLeadingZero:function(e){return(e<10?"0":"")+e}},e.exports=r},function(e,t){"use strict";var r=function(e,t){var r=this;r.delimiter=t||""===t?t:" ",r.delimiterRE=t?new RegExp("\\"+t,"g"):"",r.formatter=e};r.prototype={setFormatter:function(e){this.formatter=e},format:function(e){var t=this;t.formatter.clear(),e=e.replace(/[^\d+]/g,""),e=e.replace(/^\+/,"B").replace(/\+/g,"").replace("B","+"),e=e.replace(t.delimiterRE,"");for(var r,n="",i=!1,a=0,o=e.length;ar?n:t;else{var i=this.getFirstDiffIndex(t,e.slice(0,r));e=t+e.slice(i,i+1)+e.slice(r+1)}return e.slice(r)},getFirstDiffIndex:function(e,t){for(var r=0;e.charAt(r)===t.charAt(r);)if(""===e.charAt(r++))return-1;return r},getFormattedValue:function(e,t,r,n,i,a){var o,l="",s=i.length>0;return 0===r?e:(t.forEach(function(t,c){if(e.length>0){var u=e.slice(0,t),d=e.slice(t);o=s?i[a?c-1:c]||o:n,a?(c>0&&(l+=o),l+=u):(l+=u,u.length===t&&c0?r.numeralIntegerScale:0,e.numeralDecimalScale=r.numeralDecimalScale>=0?r.numeralDecimalScale:2,e.numeralDecimalMark=r.numeralDecimalMark||".",e.numeralThousandsGroupStyle=r.numeralThousandsGroupStyle||"thousand",e.numeralPositiveOnly=!!r.numeralPositiveOnly,e.stripLeadingZeroes=r.stripLeadingZeroes!==!1,e.numericOnly=e.creditCard||e.date||!!r.numericOnly,e.uppercase=!!r.uppercase,e.lowercase=!!r.lowercase,e.prefix=e.creditCard||e.date?"":r.prefix||"",e.noImmediatePrefix=!!r.noImmediatePrefix,e.prefixLength=e.prefix.length,e.rawValueTrimPrefix=!!r.rawValueTrimPrefix,e.copyDelimiter=!!r.copyDelimiter,e.initValue=void 0!==r.initValue&&null!==r.initValue?r.initValue.toString():"",e.delimiter=r.delimiter||""===r.delimiter?r.delimiter:r.date?"/":r.time?":":r.numeral?",":(r.phone," "),e.delimiterLength=e.delimiter.length,e.delimiterLazyShow=!!r.delimiterLazyShow,e.delimiters=r.delimiters||[],e.blocks=r.blocks||[],e.blocksLength=e.blocks.length,e.root="object"==typeof t&&t?t:window,e.document=r.document||e.root.document,e.maxLength=0,e.backspace=!1,e.result="",e.onValueChanged=r.onValueChanged||function(){},e}};e.exports=r}).call(t,function(){return this}())}])}); -------------------------------------------------------------------------------- /languages/woocommerce-confirm-payment-en_US.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: Woocommerce confirm payment\n" 4 | "POT-Creation-Date: 2018-09-07 08:57+0700\n" 5 | "PO-Revision-Date: 2018-09-07 08:57+0700\n" 6 | "Last-Translator: \n" 7 | "Language-Team: Surakrai\n" 8 | "Language: en_US\n" 9 | "MIME-Version: 1.0\n" 10 | "Content-Type: text/plain; charset=UTF-8\n" 11 | "Content-Transfer-Encoding: 8bit\n" 12 | "X-Generator: Poedit 2.1.1\n" 13 | "X-Poedit-Basepath: ..\n" 14 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 15 | "X-Poedit-KeywordsList: __;_e;esc_html_e;esc_html__;_n_noop;esc_attr_e\n" 16 | "X-Poedit-SourceCharset: UTF-8\n" 17 | "X-Poedit-SearchPath-0: .\n" 18 | 19 | #: admin/class-woocommerce-confirm-payment-admin.php:130 20 | msgid "Select" 21 | msgstr "" 22 | 23 | #: admin/class-woocommerce-confirm-payment-admin.php:131 24 | msgid "Select bank logo" 25 | msgstr "" 26 | 27 | #: admin/class-woocommerce-confirm-payment-admin.php:132 28 | msgid "Upload" 29 | msgstr "" 30 | 31 | #: admin/class-woocommerce-confirm-payment-admin.php:141 32 | #: admin/class-woocommerce-confirm-payment-admin.php:142 33 | #: admin/class-woocommerce-confirm-payment-admin.php:143 34 | #: public/class-woocommerce-confirm-payment-public.php:178 35 | #: public/class-woocommerce-confirm-payment-public.php:357 36 | #: public/class-woocommerce-confirm-payment-public.php:479 37 | msgid "Confirm payment" 38 | msgstr "" 39 | 40 | #: admin/class-woocommerce-confirm-payment-admin.php:144 41 | msgid "Search Confirm payment" 42 | msgstr "" 43 | 44 | #: admin/class-woocommerce-confirm-payment-admin.php:145 45 | #: admin/class-woocommerce-confirm-payment-admin.php:146 46 | msgid "No Confirm payment found." 47 | msgstr "" 48 | 49 | #: admin/class-woocommerce-confirm-payment-admin.php:188 50 | #: admin/class-woocommerce-confirm-payment-admin.php:232 51 | msgid "Checking payment" 52 | msgstr "" 53 | 54 | #: admin/class-woocommerce-confirm-payment-admin.php:193 55 | #, php-format 56 | msgid "Checking payment (%s)" 57 | msgstr "" 58 | 59 | #: admin/class-woocommerce-confirm-payment-admin.php:197 60 | msgid "Pending confirm" 61 | msgstr "" 62 | 63 | #: admin/class-woocommerce-confirm-payment-admin.php:202 64 | #, php-format 65 | msgid "Pending confirm (%s)" 66 | msgstr "" 67 | 68 | #: admin/class-woocommerce-confirm-payment-admin.php:206 69 | msgid "Success" 70 | msgstr "" 71 | 72 | #: admin/class-woocommerce-confirm-payment-admin.php:211 73 | #, php-format 74 | msgid "Success (%s)" 75 | msgstr "" 76 | 77 | #: admin/class-woocommerce-confirm-payment-admin.php:215 78 | #: admin/class-woocommerce-confirm-payment-admin.php:332 79 | msgid "Cancel" 80 | msgstr "" 81 | 82 | #: admin/class-woocommerce-confirm-payment-admin.php:220 83 | #, php-format 84 | msgid "Cancel (%s)" 85 | msgstr "" 86 | 87 | #: admin/class-woocommerce-confirm-payment-admin.php:244 88 | #: admin/class-woocommerce-confirm-payment-setting.php:145 89 | msgid "Confirm Payment Page" 90 | msgstr "" 91 | 92 | #: admin/class-woocommerce-confirm-payment-admin.php:257 93 | #: public/partials/woocommerce-confirm-payment-history.php:19 94 | #: public/partials/woocommerce-confirm-payment-history.php:37 95 | msgid "Slip" 96 | msgstr "" 97 | 98 | #: admin/class-woocommerce-confirm-payment-admin.php:258 99 | #: public/class-woocommerce-confirm-payment-public.php:342 100 | #: public/partials/woocommerce-confirm-payment-confirm-form.php:52 101 | #: public/partials/woocommerce-confirm-payment-email.php:21 102 | #: templates/emails/email-payment-detail.php:39 103 | msgid "Name" 104 | msgstr "" 105 | 106 | #: admin/class-woocommerce-confirm-payment-admin.php:259 107 | #: public/class-woocommerce-confirm-payment-public.php:347 108 | #: public/partials/woocommerce-confirm-payment-confirm-form.php:66 109 | #: public/partials/woocommerce-confirm-payment-email.php:45 110 | #: public/partials/woocommerce-confirm-payment-history.php:20 111 | #: public/partials/woocommerce-confirm-payment-history.php:46 112 | #: templates/emails/email-payment-detail.php:58 113 | msgid "Order" 114 | msgstr "" 115 | 116 | #: admin/class-woocommerce-confirm-payment-admin.php:260 117 | #: public/class-woocommerce-confirm-payment-public.php:346 118 | #: public/partials/woocommerce-confirm-payment-bank-details.php:25 119 | #: public/partials/woocommerce-confirm-payment-email.php:41 120 | #: templates/emails/email-payment-detail.php:54 121 | msgid "Bank" 122 | msgstr "" 123 | 124 | #: admin/class-woocommerce-confirm-payment-admin.php:261 125 | #: public/partials/woocommerce-confirm-payment-confirm-form.php:89 126 | #: public/partials/woocommerce-confirm-payment-email.php:37 127 | #: public/partials/woocommerce-confirm-payment-history.php:21 128 | #: public/partials/woocommerce-confirm-payment-history.php:49 129 | #: templates/emails/email-payment-detail.php:50 130 | msgid "Transfer amount" 131 | msgstr "" 132 | 133 | #: admin/class-woocommerce-confirm-payment-admin.php:262 134 | #: public/partials/woocommerce-confirm-payment-confirm-form.php:115 135 | #: public/partials/woocommerce-confirm-payment-history.php:22 136 | #: public/partials/woocommerce-confirm-payment-history.php:50 137 | msgid "Transfer date" 138 | msgstr "" 139 | 140 | #: admin/class-woocommerce-confirm-payment-admin.php:263 141 | #: public/class-woocommerce-confirm-payment-public.php:343 142 | #: public/partials/woocommerce-confirm-payment-confirm-form.php:59 143 | #: public/partials/woocommerce-confirm-payment-email.php:25 144 | #: templates/emails/email-payment-detail.php:43 145 | msgid "Phone" 146 | msgstr "" 147 | 148 | #: admin/class-woocommerce-confirm-payment-admin.php:264 149 | #: public/class-woocommerce-confirm-payment-public.php:344 150 | #: public/partials/woocommerce-confirm-payment-email.php:29 151 | #: templates/emails/email-payment-detail.php:47 152 | msgid "Date" 153 | msgstr "" 154 | 155 | #: admin/class-woocommerce-confirm-payment-admin.php:265 156 | #: public/partials/woocommerce-confirm-payment-history.php:23 157 | #: public/partials/woocommerce-confirm-payment-history.php:51 158 | msgid "Status" 159 | msgstr "" 160 | 161 | #: admin/class-woocommerce-confirm-payment-admin.php:266 162 | msgid "Action" 163 | msgstr "" 164 | 165 | #: admin/class-woocommerce-confirm-payment-admin.php:337 166 | msgid "Approve" 167 | msgstr "" 168 | 169 | #: admin/class-woocommerce-confirm-payment-admin.php:364 170 | msgid "Select an order" 171 | msgstr "" 172 | 173 | #: admin/class-woocommerce-confirm-payment-admin.php:431 174 | msgid "Processing" 175 | msgstr "" 176 | 177 | #: admin/class-woocommerce-confirm-payment-admin.php:439 178 | msgid "View payment detail" 179 | msgstr "" 180 | 181 | #: admin/class-woocommerce-confirm-payment-admin.php:458 182 | #: admin/class-woocommerce-confirm-payment-customer-email-completed-payment.php:34 183 | msgid "Completed payment" 184 | msgstr "" 185 | 186 | #: admin/class-woocommerce-confirm-payment-admin.php:468 187 | #: admin/class-woocommerce-confirm-payment-customer-email-cancelled-payment.php:34 188 | #: admin/class-woocommerce-confirm-payment-customer-email-cancelled-payment.php:70 189 | msgid "Cancelled payment" 190 | msgstr "" 191 | 192 | #: admin/class-woocommerce-confirm-payment-customer-email-cancelled-payment.php:35 193 | msgid "" 194 | "This is an order notification sent to customers containing order details " 195 | "after admin cancelled payment." 196 | msgstr "" 197 | 198 | #: admin/class-woocommerce-confirm-payment-customer-email-cancelled-payment.php:60 199 | msgid "[{site_title}] Cancelled payment order ({order_number})" 200 | msgstr "" 201 | 202 | #: admin/class-woocommerce-confirm-payment-customer-email-completed-payment.php:35 203 | msgid "" 204 | "This is an order notification sent to customers containing order details " 205 | "after admin approved payment." 206 | msgstr "" 207 | 208 | #: admin/class-woocommerce-confirm-payment-customer-email-completed-payment.php:59 209 | msgid "[{site_title}] Your payment order ({order_number}) is success" 210 | msgstr "" 211 | 212 | #: admin/class-woocommerce-confirm-payment-customer-email-completed-payment.php:69 213 | msgid "Thank you for your payment." 214 | msgstr "" 215 | 216 | #: admin/class-woocommerce-confirm-payment-email-new-payment.php:32 217 | msgid "New confirm payment" 218 | msgstr "" 219 | 220 | #: admin/class-woocommerce-confirm-payment-email-new-payment.php:33 221 | msgid "" 222 | "This is a payment notification sent to admin containing payment details " 223 | "after customer confirm payment." 224 | msgstr "" 225 | 226 | #: admin/class-woocommerce-confirm-payment-email-new-payment.php:62 227 | msgid "[{site_title}] Confirm payment order {order_number}" 228 | msgstr "" 229 | 230 | #: admin/class-woocommerce-confirm-payment-email-new-payment.php:72 231 | msgid "Customer Confirm payment" 232 | msgstr "" 233 | 234 | #: admin/class-woocommerce-confirm-payment-email-new-payment.php:144 235 | msgid "Enable/Disable" 236 | msgstr "" 237 | 238 | #: admin/class-woocommerce-confirm-payment-email-new-payment.php:146 239 | msgid "Enable this email notification" 240 | msgstr "" 241 | 242 | #: admin/class-woocommerce-confirm-payment-email-new-payment.php:150 243 | msgid "Recipient(s)" 244 | msgstr "" 245 | 246 | #: admin/class-woocommerce-confirm-payment-email-new-payment.php:153 247 | #, php-format 248 | msgid "Enter recipients (comma separated) for this email. Defaults to %s." 249 | msgstr "" 250 | 251 | #: admin/class-woocommerce-confirm-payment-email-new-payment.php:159 252 | msgid "Subject" 253 | msgstr "" 254 | 255 | #: admin/class-woocommerce-confirm-payment-email-new-payment.php:163 256 | #: admin/class-woocommerce-confirm-payment-email-new-payment.php:172 257 | #, php-format 258 | msgid "Available placeholders: %s" 259 | msgstr "" 260 | 261 | #: admin/class-woocommerce-confirm-payment-email-new-payment.php:168 262 | msgid "Email heading" 263 | msgstr "" 264 | 265 | #: admin/class-woocommerce-confirm-payment-email-new-payment.php:177 266 | msgid "Email type" 267 | msgstr "" 268 | 269 | #: admin/class-woocommerce-confirm-payment-email-new-payment.php:179 270 | msgid "Choose which format of email to send." 271 | msgstr "" 272 | 273 | #: admin/class-woocommerce-confirm-payment-setting.php:91 274 | msgid "Woocommerce confirm payment settings" 275 | msgstr "" 276 | 277 | #: admin/class-woocommerce-confirm-payment-setting.php:92 278 | msgid "Setting" 279 | msgstr "" 280 | 281 | #: admin/class-woocommerce-confirm-payment-setting.php:104 282 | msgid "Confirm Payment Settings" 283 | msgstr "" 284 | 285 | #: admin/class-woocommerce-confirm-payment-setting.php:138 286 | msgid "Notification" 287 | msgstr "" 288 | 289 | #: admin/class-woocommerce-confirm-payment-setting.php:153 290 | msgid "Bank account" 291 | msgstr "" 292 | 293 | #: admin/class-woocommerce-confirm-payment-setting.php:161 294 | msgid "LINE Notify" 295 | msgstr "" 296 | 297 | #: admin/class-woocommerce-confirm-payment-setting.php:167 298 | msgid "Enable this line notification" 299 | msgstr "" 300 | 301 | #: admin/class-woocommerce-confirm-payment-setting.php:172 302 | msgid "Line Notify Token" 303 | msgstr "" 304 | 305 | #: admin/class-woocommerce-confirm-payment-setting.php:179 306 | #, php-format 307 | msgid "Generate token Click here" 308 | msgstr "" 309 | 310 | #: admin/class-woocommerce-confirm-payment-setting.php:238 311 | #, php-format 312 | msgid "For email notification settings, %sclick here to senting.%s" 313 | msgstr "" 314 | 315 | #: admin/partials/woocommerce-confirm-payment-admin-account-details-field.php:22 316 | msgid "logo" 317 | msgstr "" 318 | 319 | #: admin/partials/woocommerce-confirm-payment-admin-account-details-field.php:23 320 | msgid "Bank name" 321 | msgstr "" 322 | 323 | #: admin/partials/woocommerce-confirm-payment-admin-account-details-field.php:24 324 | #: public/partials/woocommerce-confirm-payment-bank-details.php:28 325 | msgid "Account number" 326 | msgstr "" 327 | 328 | #: admin/partials/woocommerce-confirm-payment-admin-account-details-field.php:25 329 | #: public/partials/woocommerce-confirm-payment-bank-details.php:31 330 | msgid "Account name" 331 | msgstr "" 332 | 333 | #: admin/partials/woocommerce-confirm-payment-admin-account-details-field.php:40 334 | msgid "Uplpad" 335 | msgstr "" 336 | 337 | #: admin/partials/woocommerce-confirm-payment-admin-account-details-field.php:61 338 | msgid "+ Add account" 339 | msgstr "" 340 | 341 | #: admin/partials/woocommerce-confirm-payment-admin-account-details-field.php:62 342 | msgid "Remove selected account(s)" 343 | msgstr "" 344 | 345 | #: includes/class-woocommerce-confirm-payment-activator.php:39 346 | msgid "Confirm Payment" 347 | msgstr "" 348 | 349 | #: public/class-woocommerce-confirm-payment-history.php:76 350 | msgid "Payment History" 351 | msgstr "" 352 | 353 | #: public/class-woocommerce-confirm-payment-public.php:200 354 | msgid "Enter your name" 355 | msgstr "" 356 | 357 | #: public/class-woocommerce-confirm-payment-public.php:201 358 | msgid "Enter your phone." 359 | msgstr "" 360 | 361 | #: public/class-woocommerce-confirm-payment-public.php:202 362 | msgid "Enter transfer date" 363 | msgstr "" 364 | 365 | #: public/class-woocommerce-confirm-payment-public.php:203 366 | msgid "Enter transfer time" 367 | msgstr "" 368 | 369 | #: public/class-woocommerce-confirm-payment-public.php:204 370 | msgid "Select bank transfer" 371 | msgstr "" 372 | 373 | #: public/class-woocommerce-confirm-payment-public.php:205 374 | msgid "Enter amount transfer" 375 | msgstr "" 376 | 377 | #: public/class-woocommerce-confirm-payment-public.php:208 378 | msgid "Enter order number" 379 | msgstr "" 380 | 381 | #: public/class-woocommerce-confirm-payment-public.php:216 382 | msgid "Upload transfer slip" 383 | msgstr "" 384 | 385 | #: public/class-woocommerce-confirm-payment-public.php:219 386 | msgid "" 387 | "This file type is not supported. You can only upload jpg, png, gif, pdf " 388 | "files." 389 | msgstr "" 390 | 391 | #: public/class-woocommerce-confirm-payment-public.php:265 392 | msgid "Successfully payment confirmation!" 393 | msgstr "" 394 | 395 | #: public/class-woocommerce-confirm-payment-public.php:311 396 | msgid "" 397 | "This order has been paid. Please wait for the confirmation from the store." 398 | msgstr "" 399 | 400 | #: public/class-woocommerce-confirm-payment-public.php:313 401 | msgid "This order has been successfully paid." 402 | msgstr "" 403 | 404 | #: public/class-woocommerce-confirm-payment-public.php:315 405 | msgid "This order is not in any payment status." 406 | msgstr "" 407 | 408 | #: public/class-woocommerce-confirm-payment-public.php:319 409 | msgid "This order does not require an informed your payment." 410 | msgstr "" 411 | 412 | #: public/class-woocommerce-confirm-payment-public.php:322 413 | msgid "Order not found" 414 | msgstr "" 415 | 416 | #: public/class-woocommerce-confirm-payment-public.php:345 417 | msgid "Amount" 418 | msgstr "" 419 | 420 | #: public/partials/woocommerce-confirm-payment-bank-details.php:18 421 | msgid "Our bank details" 422 | msgstr "" 423 | 424 | #: public/partials/woocommerce-confirm-payment-bank-details.php:35 425 | #, php-format 426 | msgid "" 427 | "After bank transfer, Please confirm your payment here Confirm " 428 | "payment" 429 | msgstr "" 430 | 431 | #: public/partials/woocommerce-confirm-payment-confirm-form.php:78 432 | msgid "Total" 433 | msgstr "" 434 | 435 | #: public/partials/woocommerce-confirm-payment-confirm-form.php:94 436 | msgid "Bank transfer" 437 | msgstr "" 438 | 439 | #: public/partials/woocommerce-confirm-payment-confirm-form.php:117 440 | msgid "dd/mm/yyyy" 441 | msgstr "" 442 | 443 | #: public/partials/woocommerce-confirm-payment-confirm-form.php:122 444 | msgid "Transfer time" 445 | msgstr "" 446 | 447 | #: public/partials/woocommerce-confirm-payment-confirm-form.php:124 448 | msgid "hh:mm" 449 | msgstr "" 450 | 451 | #: public/partials/woocommerce-confirm-payment-confirm-form.php:129 452 | #: public/partials/woocommerce-confirm-payment-email.php:50 453 | #: templates/emails/email-payment-detail.php:63 454 | msgid "Transfer slip" 455 | msgstr "" 456 | 457 | #: public/partials/woocommerce-confirm-payment-confirm-form.php:139 458 | msgid "Submit" 459 | msgstr "" 460 | 461 | #: public/partials/woocommerce-confirm-payment-email.php:33 462 | msgid "Time" 463 | msgstr "" 464 | 465 | #: public/partials/woocommerce-confirm-payment-history.php:43 466 | msgid "no slip" 467 | msgstr "" 468 | 469 | #: public/partials/woocommerce-confirm-payment-history.php:59 470 | msgid "No payment found." 471 | msgstr "" 472 | 473 | #: public/partials/woocommerce-confirm-payment-history.php:67 474 | msgid "Previous" 475 | msgstr "" 476 | 477 | #: public/partials/woocommerce-confirm-payment-history.php:71 478 | msgid "Next" 479 | msgstr "" 480 | 481 | #: templates/emails/admin-cancelled-payment.php:29 482 | #, php-format 483 | msgid "" 484 | "Submitted payment. Order number #%s has been cancelled. Due to your payment " 485 | "is not correct.Please submit your payment again. Confirm payment" 487 | msgstr "" 488 | 489 | #: templates/emails/admin-new-payment.php:28 490 | #, php-format 491 | msgid "You have received a payment from %s. The payment is as follows:" 492 | msgstr "" 493 | 494 | #: templates/emails/email-payment-detail.php:72 495 | msgid "View details" 496 | msgstr "" 497 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. -------------------------------------------------------------------------------- /public/class-woocommerce-confirm-payment-public.php: -------------------------------------------------------------------------------- 1 | 22 | */ 23 | class Woocommerce_Confirm_Payment_Public { 24 | 25 | /** 26 | * The ID of this plugin. 27 | * 28 | * @since 0.9.0 29 | * @access private 30 | * @var string $plugin_name The ID of this plugin. 31 | */ 32 | private $plugin_name; 33 | 34 | /** 35 | * The version of this plugin. 36 | * 37 | * @since 0.9.0 38 | * @access private 39 | * @var string $version The current version of this plugin. 40 | */ 41 | private $version; 42 | 43 | 44 | /** 45 | * bank_accounts 46 | * 47 | * @var array 48 | */ 49 | private $bank_accounts = array(); 50 | 51 | /** 52 | * line api url 53 | * 54 | * @var string 55 | */ 56 | private $line_api; 57 | 58 | /** 59 | * Initialize the class and set its properties. 60 | * 61 | * @since 0.9.0 62 | * @param string $plugin_name The name of the plugin. 63 | * @param string $version The version of this plugin. 64 | */ 65 | public function __construct( $plugin_name, $version ) { 66 | 67 | $this->plugin_name = $plugin_name; 68 | $this->version = $version; 69 | $this->bank_accounts = get_option( 'wcp_bank_accounts' ); 70 | $this->options = get_option( 'wcp_option' ); 71 | $this->line_api = 'https://notify-api.line.me/api/notify'; 72 | 73 | $this->load_dependencies(); 74 | } 75 | 76 | 77 | /** 78 | * Load the required dependencies for the Admin facing functionality. 79 | * 80 | * Include the following files that make up the plugin: 81 | * 82 | * - Woocommerce_Confirm_Payment_History. 83 | * 84 | * 85 | * @since 0.9.0 86 | * @access private 87 | */ 88 | private function load_dependencies() { 89 | 90 | /** 91 | * The class responsible for orchestrating the actions and filters of the 92 | * core plugin. 93 | */ 94 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-woocommerce-confirm-payment-history.php'; 95 | 96 | } 97 | 98 | /** 99 | * Register the stylesheets for the public-facing side of the site. 100 | * 101 | * @since 0.9.0 102 | */ 103 | public function enqueue_styles() { 104 | 105 | /** 106 | * This function is provided for demonstration purposes only. 107 | * 108 | * An instance of this class should be passed to the run() function 109 | * defined in Woocommerce_Confirm_Payment_Loader as all of the hooks are defined 110 | * in that particular class. 111 | * 112 | * The Woocommerce_Confirm_Payment_Loader will then create the relationship 113 | * between the defined hooks and the functions defined in this 114 | * class. 115 | */ 116 | wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/woocommerce-confirm-payment-public.css', array(), $this->version, 'all' ); 117 | 118 | } 119 | 120 | /** 121 | * Register the JavaScript for the public-facing side of the site. 122 | * 123 | * @since 0.9.0 124 | */ 125 | public function enqueue_scripts() { 126 | 127 | /** 128 | * This function is provided for demonstration purposes only. 129 | * 130 | * An instance of this class should be passed to the run() function 131 | * defined in Woocommerce_Confirm_Payment_Loader as all of the hooks are defined 132 | * in that particular class. 133 | * 134 | * The Woocommerce_Confirm_Payment_Loader will then create the relationship 135 | * between the defined hooks and the functions defined in this 136 | * class. 137 | */ 138 | 139 | wp_enqueue_script( $this->plugin_name . '-modernizr', plugin_dir_url( __FILE__ ) . 'js/modernizr-custom.js', array( 'jquery' ), $this->version, false ); 140 | wp_enqueue_script( $this->plugin_name . '-jquery-form', plugin_dir_url( __FILE__ ) . 'js/jquery.form.js', array( 'jquery' ), $this->version, false ); 141 | wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/woocommerce-confirm-payment-public.js', array( 'jquery' ), $this->version, false ); 142 | 143 | wp_localize_script( $this->plugin_name, 'WCP', array( 144 | 'ajaxurl' => admin_url( 'admin-ajax.php' ), 145 | 'check_order_nonce' => wp_create_nonce( 'wcp_check_order_nonce' ), 146 | 'cleave' => plugin_dir_url( __FILE__ ) . 'js/cleave.min.js', 147 | 'current_date' => current_time( 'd-m-Y' ), 148 | 'i18n' => array( 149 | 'maximum_upload_file' => __( 'Maximum upload file size 2 MB.', 'woocommerce-confirm-payment' ) 150 | ) 151 | )); 152 | 153 | } 154 | 155 | public function add_shortcode() { 156 | 157 | add_shortcode( 'wcp_confirm_payment_form', array( $this, 'print_confirm_payment_form' ) ); 158 | add_shortcode( 'wcp_confirm_payment_button', array( $this, 'print_confirm_payment_button' ) ); 159 | 160 | } 161 | 162 | public function print_confirm_payment_form( $atts, $content = '' ) { 163 | 164 | ob_start(); 165 | 166 | include( 'partials/woocommerce-confirm-payment-confirm-form.php' ); 167 | 168 | $html = ob_get_contents(); 169 | ob_end_clean(); 170 | 171 | return $html; 172 | 173 | } 174 | 175 | public function print_confirm_payment_button( $atts, $content = '' ) { 176 | 177 | return sprintf( 178 | '%s', 179 | empty( $atts['order_id'] ) ? wcp_get_confirm_payment_url() : wcp_get_confirm_payment_url( $atts['order_id'] ), 180 | __( 'Confirm payment', 'woocommerce-confirm-payment' ) 181 | ); 182 | 183 | } 184 | 185 | 186 | public function confirm_payment() { 187 | 188 | check_ajax_referer( 'wcp_form_nonce_action', 'wcp_form_security_nonce' ); 189 | 190 | $errors = array(); 191 | $success = ''; 192 | $check_icon = ''; 193 | $allowed_slip = array( 'image/jpeg', 'image/gif', 'image/png', 'application/pdf' ); 194 | $name = sanitize_text_field( $_POST['name'] ); 195 | $phone = sanitize_text_field( $_POST['phone'] ); 196 | $date = sanitize_text_field( $_POST['date'] ); 197 | $time = sanitize_text_field( $_POST['time'] ); 198 | $bank = sanitize_text_field( $_POST['bank'] ); 199 | $amount = absint( $_POST['amount'] ); 200 | $slip = $_FILES['slip']; 201 | $order_id = absint( $_POST['order'] ); 202 | 203 | if ( ! $name ) $errors['name'] = __( 'Enter your name', 'woocommerce-confirm-payment' ); 204 | if ( ! $phone ) $errors['phone'] = __( 'Enter your phone.', 'woocommerce-confirm-payment' ); 205 | if ( ! $date ) $errors['date'] = __( 'Enter transfer date', 'woocommerce-confirm-payment' ); 206 | if ( ! $time ) $errors['time'] = __( 'Enter transfer time', 'woocommerce-confirm-payment' ); 207 | if ( ! $bank ) $errors['bank'] = __( 'Select bank transfer', 'woocommerce-confirm-payment' ); 208 | if ( ! $amount ) $errors['amount'] = __( 'Enter amount transfer', 'woocommerce-confirm-payment' ); 209 | 210 | if ( ! $order_id ){ 211 | $errors['order'] = __( 'Enter order number', 'woocommerce-confirm-payment' ); 212 | } else { 213 | if ( $this->check_order( $order_id ) ) { 214 | $errors['order'] = $this->check_order( $order_id ); 215 | } 216 | } 217 | 218 | if ( ! $slip && ! empty( $this->options['transfer_slip_required'] ) ){ 219 | $errors['slip'] = __( 'Upload transfer slip', 'woocommerce-confirm-payment' ); 220 | } 221 | 222 | if ( $slip && ! in_array( $slip['type'], $allowed_slip ) ) { 223 | $errors['slip'] = __( 'This file type is not supported. You can only upload jpg, png, gif, pdf files.', 'woocommerce-confirm-payment' ); 224 | } 225 | 226 | if ( empty( $errors ) ) { 227 | 228 | $post_id = wp_insert_post( array( 229 | 'post_type' => 'wcp_confirm_payment', 230 | 'post_title' => wp_strip_all_tags( $name ), 231 | 'post_status' => 'wcp-pending_confirm', 232 | 'post_author' => 1, 233 | ) ); 234 | 235 | update_post_meta( $post_id, '_wcp_payment_date', date_i18n( 'Y-m-d H:i', strtotime( str_replace( '/', '-', $date . ' ' . $time ) ) ) ); 236 | update_post_meta( $post_id, '_wcp_payment_phone', $phone ); 237 | update_post_meta( $post_id, '_wcp_payment_bank', $bank ); 238 | update_post_meta( $post_id, '_wcp_payment_amount', $amount ); 239 | update_post_meta( $post_id, '_wcp_payment_order_id', $order_id ); 240 | update_post_meta( $post_id, '_wcp_payment_user_id', ( is_user_logged_in() ? get_current_user_id() : 'guest' ) ); 241 | update_post_meta( $order_id,'_wcp_order_payment_id', $post_id ); 242 | 243 | if ( $post_id != 0 && $slip ){ 244 | 245 | if ( !function_exists('wp_generate_attachment_metadata') ){ 246 | require_once(ABSPATH . "wp-admin" . '/includes/image.php'); 247 | require_once(ABSPATH . "wp-admin" . '/includes/file.php'); 248 | require_once(ABSPATH . "wp-admin" . '/includes/media.php'); 249 | } 250 | 251 | $attachment_id = media_handle_upload( 'slip', $post_id, array( 'post_title' => 'Payment slip #' . $order_id ) ); 252 | 253 | if ( is_wp_error( $attachment_id ) ) { 254 | 255 | $errors['attachment'] = $attachment_id->get_error_message(); 256 | 257 | wp_delete_post( $post_id ); 258 | 259 | }else{ 260 | 261 | update_post_meta( $post_id,'_thumbnail_id', $attachment_id ); 262 | update_post_meta( $attachment_id,'_wcp_payment_slip', $post_id ); 263 | 264 | } 265 | 266 | } 267 | 268 | if ( empty( $errors ) ) { 269 | 270 | $this->payment_complete( $post_id ); 271 | 272 | $check_icon = ''; 273 | $success = sprintf( '

%s

', __( 'Successfully payment confirmation!', 'woocommerce-confirm-payment' ) ); 274 | 275 | } 276 | 277 | } 278 | 279 | $response = array( 280 | 'success' => apply_filters( 'wcp_confirm_payment_success_message', $check_icon . $success, $success, $check_icon ), 281 | 'errors' => $errors 282 | ); 283 | 284 | wp_send_json( $response ); 285 | 286 | } 287 | 288 | public function ajax_check_order() { 289 | 290 | check_ajax_referer( 'wcp_check_order_nonce', 'security' ); 291 | 292 | $order_id = absint( $_POST['order_id'] ); 293 | 294 | if( ! $order_id ) return; 295 | 296 | $orders = wc_get_order( $order_id ); 297 | 298 | $response = array( 299 | 'total' => $orders ? $orders->get_total() : '', 300 | 'errors' => $this->check_order( $order_id ), 301 | ); 302 | 303 | wp_send_json( $response ); 304 | 305 | } 306 | 307 | public function check_order( $order_id ){ 308 | 309 | $orders = wc_get_order( $order_id ); 310 | 311 | if ( $orders ) { 312 | 313 | if ( 'bacs' === $orders->get_payment_method() ) { 314 | if ( 'on-hold' === $orders->get_status() ) { 315 | return; 316 | }else{ 317 | if ( 'checking_payment' === $orders->get_status() ) { 318 | $errors = __( 'This order has been paid. Please wait for the confirmation from the store.', 'woocommerce-confirm-payment' ); 319 | } elseif ( 'processing' === $orders->get_status() ) { 320 | $errors = __( 'This order has been successfully paid.', 'woocommerce-confirm-payment' ); 321 | } else { 322 | $errors = __( 'This order is not in any payment status.', 'woocommerce-confirm-payment' ); 323 | } 324 | } 325 | } else { 326 | $errors = __( 'This order does not require an informed your payment.', 'woocommerce-confirm-payment' ); 327 | } 328 | }else{ 329 | $errors = __( 'Order not found', 'woocommerce-confirm-payment' ); 330 | } 331 | 332 | return $errors; 333 | 334 | } 335 | 336 | public function payment_complete( $payment_id ){ 337 | 338 | $name = get_the_title( $payment_id ); 339 | $date = get_post_meta( $payment_id, '_wcp_payment_date', true ); 340 | $phone = get_post_meta( $payment_id, '_wcp_payment_phone', true ); 341 | $bank = get_post_meta( $payment_id, '_wcp_payment_bank', true ); 342 | $amount = get_post_meta( $payment_id, '_wcp_payment_amount', true ); 343 | $order_id = get_post_meta( $payment_id, '_wcp_payment_order_id', true ); 344 | 345 | $slips = get_the_post_thumbnail_url( $payment_id, 'large' ); 346 | $slips_thumb = get_the_post_thumbnail_url( $payment_id, 'medium' ); 347 | 348 | $message .= '' . __( 'Name', 'woocommerce-confirm-payment' ) . ' : ' . $name . PHP_EOL; 349 | $message .= '' . __( 'Phone', 'woocommerce-confirm-payment' ) . ' : ' . $phone . PHP_EOL; 350 | $message .= '' . __( 'Date', 'woocommerce-confirm-payment' ) . ' : ' . date_i18n( get_option('date_format') . ' ' . get_option('time_format'), strtotime( $date ) ) . PHP_EOL; 351 | $message .= '' . __( 'Amount', 'woocommerce-confirm-payment' ) . ' : ' . number_format( $amount ) . PHP_EOL; 352 | $message .= '' . __( 'Bank', 'woocommerce-confirm-payment' ) . ' : ' . $bank . PHP_EOL; 353 | $message .= '' . __( 'Order', 'woocommerce-confirm-payment' ) . ' : #' . $order_id; 354 | 355 | if ( $this->options['line_notification_enabled'] && $line_notify_token = $this->options['line_notify_token'] ) { 356 | 357 | $this->line_notify( PHP_EOL . wp_strip_all_tags( $message ), $slips_thumb, $slips, $line_notify_token ); 358 | 359 | } 360 | 361 | $message = sprintf( 362 | '

%s

%s
', 363 | __( 'Confirm payment', 'woocommerce-confirm-payment' ), 364 | admin_url( 'edit.php?post_type=wcp_confirm_payment&action=-1&payment_id=' . $payment_id ), 365 | $slips_thumb, 366 | $message 367 | ); 368 | 369 | $orders = wc_get_order( $order_id ); 370 | $orders->update_status( 'checking_payment' ); 371 | $orders->add_order_note( $message ); 372 | 373 | } 374 | 375 | // https://medium.com/@nattaponsirikamonnet/มาลอง-line-notify-กันเถอะ-sticker-a2d25925d1a1 376 | 377 | public function line_notify( $message, $imageThumbnail, $imageFullsize, $token ){ 378 | 379 | $queryData = array( 380 | 'message' => $message 381 | ); 382 | 383 | if ( $imageThumbnail ) { 384 | $queryData['imageThumbnail'] = $imageThumbnail; 385 | $queryData['imageFullsize'] = $imageFullsize; 386 | } 387 | 388 | $queryData = http_build_query( $queryData, '', '&' ); 389 | 390 | $headerOptions = array( 391 | 'http' => array( 392 | 'method' => 'POST', 393 | 'header' => "Content-Type: application/x-www-form-urlencoded\r\n" 394 | ."Authorization: Bearer ". $token ."\r\n" 395 | ."Content-Length: ".strlen( $queryData )."\r\n", 396 | 'content' => $queryData 397 | ), 398 | ); 399 | 400 | $context = stream_context_create( $headerOptions ); 401 | $result = file_get_contents( $this->line_api, FALSE, $context ); 402 | $res = json_decode( $result ); 403 | 404 | return $res; 405 | 406 | } 407 | 408 | /** 409 | * Output for the order received page. 410 | * 411 | * @param int $order_id Order ID. 412 | */ 413 | public function thankyou_page( $order_id ) { 414 | 415 | if ( ! function_exists( 'WC' ) ) return; 416 | 417 | if ( wcp_get_gateway_bacs()->instructions ) { 418 | echo wp_kses_post( wpautop( wptexturize( wp_kses_post( wcp_get_gateway_bacs()->instructions ) ) ) ); 419 | } 420 | 421 | $this->bank_details( $order_id ); 422 | 423 | } 424 | 425 | /** 426 | * Add content to the WC emails. 427 | * 428 | * @param WC_Order $order Order object. 429 | * @param bool $sent_to_admin Sent to admin. 430 | * @param bool $plain_text Email format: plain text or HTML. 431 | */ 432 | public function email_instructions( $order, $sent_to_admin, $plain_text = false ) { 433 | 434 | // Add only the email instructions 435 | if ( ! $sent_to_admin && 'bacs' === $order->get_payment_method() && $order->has_status( 'on-hold' ) ) { 436 | if ( wcp_get_gateway_bacs()->instructions ) { 437 | echo wpautop( wptexturize( wcp_get_gateway_bacs()->instructions ) ) . PHP_EOL; 438 | } 439 | $this->bank_details( $order->get_id() ); 440 | } 441 | 442 | } 443 | 444 | /** 445 | * Get bank details and place into a list format. 446 | * 447 | * @param int $order_id Order ID. 448 | */ 449 | private function bank_details( $order_id = '' ) { 450 | 451 | include( 'partials/woocommerce-confirm-payment-bank-details.php' ); 452 | 453 | } 454 | 455 | public function gateway_description( $this_description, $this_id ) { 456 | 457 | if ( 'bacs' === $this_id ) { 458 | 459 | if ( ! empty( $this->bank_accounts ) ) { 460 | 461 | $this_description .= '
'. PHP_EOL; 462 | 463 | foreach ( $this->bank_accounts as $account ) { 464 | 465 | if ( $bank_logo = $account['bank_logo'] ) { 466 | $this_description .= '
'; 467 | $this_description .= wp_get_attachment_image( $bank_logo, array( 40, 40 ), '', array( 'title' => $account['bank_name'] ) ); 468 | $this_description .= '
' . PHP_EOL; 469 | } 470 | } 471 | $this_description .= '
'; 472 | 473 | } 474 | 475 | } 476 | 477 | return $this_description; 478 | 479 | } 480 | 481 | // define the woocommerce_my_account_my_orders_actions callback 482 | function woocommerce_my_account_my_orders_actions( $actions, $the_order ) { 483 | 484 | if ( 'on-hold' === $the_order->get_status() && 'bacs' === $the_order->get_payment_method() ) { 485 | 486 | $actions['confirm_payment'] = array( 487 | 'url' => wcp_get_confirm_payment_url( $the_order->get_id() ), 488 | 'name' => __( 'Confirm payment', 'woocommerce-confirm-payment' ), 489 | ); 490 | 491 | } 492 | 493 | return $actions; 494 | 495 | } 496 | 497 | 498 | public function remove_bank_original() { 499 | 500 | if ( ! wcp_get_gateway_bacs() ) return false; 501 | 502 | remove_action( 'woocommerce_thankyou_bacs', array( wcp_get_gateway_bacs(), 'thankyou_page' ) ); 503 | remove_action( 'woocommerce_email_before_order_table', array( wcp_get_gateway_bacs(), 'email_instructions' ), 10, 3 ); 504 | 505 | } 506 | 507 | public function redirect_single_attachment(){ 508 | 509 | global $post; 510 | 511 | if ( is_attachment() && get_post_meta( $post->ID, '_wcp_payment_slip', true ) ){ 512 | 513 | wp_redirect( home_url('/'), 301 ); 514 | 515 | exit; 516 | } 517 | 518 | } 519 | public function add_query_vars( $vars ){ 520 | 521 | $vars[] = "wcp_order_id"; 522 | 523 | return $vars; 524 | } 525 | 526 | } -------------------------------------------------------------------------------- /admin/class-woocommerce-confirm-payment-admin.php: -------------------------------------------------------------------------------- 1 | 22 | */ 23 | class Woocommerce_Confirm_Payment_Admin { 24 | 25 | /** 26 | * The ID of this plugin. 27 | * 28 | * @since 0.9.0 29 | * @access private 30 | * @var string $plugin_name The ID of this plugin. 31 | */ 32 | private $plugin_name; 33 | 34 | /** 35 | * The version of this plugin. 36 | * 37 | * @since 0.9.0 38 | * @access private 39 | * @var string $version The current version of this plugin. 40 | */ 41 | private $version; 42 | 43 | /** 44 | * Initialize the class and set its properties. 45 | * 46 | * @since 0.9.0 47 | * @param string $plugin_name The name of this plugin. 48 | * @param string $version The version of this plugin. 49 | */ 50 | public function __construct( $plugin_name, $version ) { 51 | 52 | $this->plugin_name = $plugin_name; 53 | $this->version = $version; 54 | $this->options = get_option( 'wcp_option' ); 55 | 56 | $this->load_dependencies(); 57 | 58 | } 59 | 60 | /** 61 | * Load the required dependencies for the Admin facing functionality. 62 | * 63 | * Include the following files that make up the plugin: 64 | * 65 | * - Woocommerce_Confirm_Payment_Admin_Setting. Registers the admin settings and page. 66 | * - Woocommerce_Confirm_Payment_Email 67 | * 68 | * @since 0.9.0 69 | * @access private 70 | */ 71 | private function load_dependencies() { 72 | 73 | /** 74 | * The class responsible for orchestrating the actions and filters of the 75 | * core plugin. 76 | */ 77 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-woocommerce-confirm-payment-setting.php'; 78 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-woocommerce-confirm-payment-email.php'; 79 | 80 | } 81 | 82 | /** 83 | * Register the stylesheets for the admin area. 84 | * 85 | * @since 0.9.0 86 | */ 87 | public function enqueue_styles() { 88 | 89 | /** 90 | * This function is provided for demonstration purposes only. 91 | * 92 | * An instance of this class should be passed to the run() function 93 | * defined in Woocommerce_Confirm_Payment_Loader as all of the hooks are defined 94 | * in that particular class. 95 | * 96 | * The Woocommerce_Confirm_Payment_Loader will then create the relationship 97 | * between the defined hooks and the functions defined in this 98 | * class. 99 | */ 100 | 101 | wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/woocommerce-confirm-payment-admin.css', array(), $this->version, 'all' ); 102 | 103 | } 104 | 105 | /** 106 | * Register the JavaScript for the admin area. 107 | * 108 | * @since 0.9.0 109 | */ 110 | public function enqueue_scripts() { 111 | 112 | /** 113 | * This function is provided for demonstration purposes only. 114 | * 115 | * An instance of this class should be passed to the run() function 116 | * defined in Woocommerce_Confirm_Payment_Loader as all of the hooks are defined 117 | * in that particular class. 118 | * 119 | * The Woocommerce_Confirm_Payment_Loader will then create the relationship 120 | * between the defined hooks and the functions defined in this 121 | * class. 122 | */ 123 | wp_enqueue_media(); 124 | wp_enqueue_script( 'jquery-ui-sortable' ); 125 | 126 | wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/woocommerce-confirm-payment-admin.js', array( 'jquery' ), $this->version, false ); 127 | 128 | wp_localize_script( $this->plugin_name, 'WCP', array( 129 | 'i18n' => array( 130 | 'select' => __( 'Select', 'woocommerce-confirm-payment' ), 131 | 'select_logo' => __( 'Select bank logo', 'woocommerce-confirm-payment' ), 132 | 'upload' => __( 'Upload', 'woocommerce-confirm-payment' ), 133 | ) 134 | )); 135 | 136 | } 137 | 138 | public function register_post_type() { 139 | 140 | $labels = array( 141 | 'name' => __( 'Confirm payment', 'woocommerce-confirm-payment' ), 142 | 'menu_name' => __( 'Confirm payment', 'woocommerce-confirm-payment' ), 143 | 'singular_name' => __( 'Confirm payment', 'woocommerce-confirm-payment' ), 144 | 'search_items' => __( 'Search Confirm payment', 'woocommerce-confirm-payment' ), 145 | 'not_found' => __( 'No Confirm payment found.', 'woocommerce-confirm-payment' ), 146 | 'not_found_in_trash' => __( 'No Confirm payment found.', 'woocommerce-confirm-payment' ), 147 | 'parent_item_colon' => '' 148 | ); 149 | 150 | $args = array( 151 | 'labels' => $labels, 152 | 'public' => false, 153 | 'publicly_queryable' => false, 154 | 'show_ui' => true, 155 | 'query_var' => false, 156 | 'capability_type' => 'post', 157 | 'capabilities' => array( 158 | 'create_posts' => 'do_not_allow', 159 | 'edit_post ' => 'do_not_allow', 160 | 'edit_posts ' => 'do_not_allow', 161 | ), 162 | 'map_meta_cap' => true, 163 | 'hierarchical' => false, 164 | 'menu_position' => 57, 165 | 'menu_icon' => 'dashicons-paperclip', 166 | 'supports' => array( 'title' ) 167 | ); 168 | 169 | register_post_type( 'wcp_confirm_payment', $args ); 170 | 171 | } 172 | 173 | public function flush_rewrite_rules() { 174 | 175 | if ( get_option('wcp_flush_rewrite_rules') ) { 176 | flush_rewrite_rules(); 177 | delete_option('wcp_flush_rewrite_rules'); 178 | } 179 | } 180 | 181 | /** 182 | * Register new status 183 | * Tutorial: http://www.sellwithwp.com/woocommerce-custom-order-status-2/ 184 | **/ 185 | public function register_order_status() { 186 | 187 | register_post_status( 'wc-checking_payment', array( 188 | 'label' => __( 'Checking payment', 'woocommerce-confirm-payment' ), 189 | 'public' => true, 190 | 'exclude_from_search' => false, 191 | 'show_in_admin_all_list' => true, 192 | 'show_in_admin_status_list' => true, 193 | 'label_count' => _n_noop( 'Checking payment (%s)', 'Checking payment (%s)' ) 194 | ) ); 195 | 196 | register_post_status( 'wcp-pending_confirm', array( 197 | 'label' => __( 'Pending confirm', 'woocommerce-confirm-payment' ), 198 | 'public' => true, 199 | 'exclude_from_search' => false, 200 | 'show_in_admin_all_list' => true, 201 | 'show_in_admin_status_list' => true, 202 | 'label_count' => _n_noop( 'Pending confirm (%s)', 'Checking Payment (%s)', 'woocommerce-confirm-payment' ) 203 | ) ); 204 | 205 | register_post_status( 'wcp-success', array( 206 | 'label' => __( 'Success', 'woocommerce-confirm-payment' ), 207 | 'public' => true, 208 | 'exclude_from_search' => false, 209 | 'show_in_admin_all_list' => true, 210 | 'show_in_admin_status_list' => true, 211 | 'label_count' => _n_noop( 'Success (%s)', 'Success (%s)', 'woocommerce-confirm-payment' ) 212 | ) ); 213 | 214 | register_post_status( 'wcp-cancelled', array( 215 | 'label' => __( 'Cancel', 'woocommerce-confirm-payment' ), 216 | 'public' => true, 217 | 'exclude_from_search' => false, 218 | 'show_in_admin_all_list' => true, 219 | 'show_in_admin_status_list' => true, 220 | 'label_count' => _n_noop( 'Cancel (%s)', 'cancelled (%s)', 'woocommerce-confirm-payment' ) 221 | ) ); 222 | 223 | } 224 | 225 | public function add_order_statuses( $order_statuses ) { 226 | 227 | $new_order_statuses = array(); 228 | 229 | foreach ( $order_statuses as $key => $status ) { 230 | $new_order_statuses[ $key ] = $status; 231 | if ( 'wc-pending' === $key ) { 232 | $new_order_statuses['wc-checking_payment'] = __( 'Checking payment', 'woocommerce-confirm-payment' ); 233 | } 234 | } 235 | return $new_order_statuses; 236 | 237 | } 238 | 239 | public function post_states( $post_states, $post ) { 240 | 241 | $confirm_page = isset( $this->options['confirm_page'] ) ? $this->options['confirm_page'] : ''; 242 | 243 | if ( $confirm_page == $post->ID ) { 244 | $post_states[] = __( 'Confirm Payment Page', 'woocommerce-confirm-payment' ); 245 | } 246 | 247 | return $post_states; 248 | 249 | } 250 | 251 | public function columns( $columns ) { 252 | 253 | //unset( $columns['cb'] ); 254 | unset( $columns['date'] ); 255 | unset( $columns['title'] ); 256 | 257 | $columns['wcp_slip'] = __( 'Slip', 'woocommerce-confirm-payment' ); 258 | $columns['wcp_name'] = __( 'Name', 'woocommerce-confirm-payment' ); 259 | $columns['wcp_order'] = __( 'Order', 'woocommerce-confirm-payment' ); 260 | $columns['wcp_bank'] = __( 'Bank', 'woocommerce-confirm-payment' ); 261 | $columns['wcp_amount'] = __( 'Transfer amount', 'woocommerce-confirm-payment' ); 262 | $columns['wcp_payment_date'] = __( 'Transfer date', 'woocommerce-confirm-payment' ); 263 | $columns['wcp_phone'] = __( 'Phone', 'woocommerce-confirm-payment' ); 264 | $columns['date'] = __( 'Date' ); 265 | $columns['wcp_status'] = __( 'Status', 'woocommerce-confirm-payment' ); 266 | $columns['wcp_action'] = __( 'Action', 'woocommerce-confirm-payment' ); 267 | 268 | return $columns; 269 | 270 | } 271 | 272 | public function columns_display( $columns, $post_id ) { 273 | 274 | switch ( $columns ) { 275 | 276 | case 'wcp_slip' : 277 | if ( has_post_thumbnail( $post_id ) ) { 278 | echo '' . get_the_post_thumbnail( $post_id, 'thumbnail') . ''; 279 | }else{ 280 | echo '-'; 281 | } 282 | break; 283 | 284 | case 'wcp_name' : 285 | echo '' . get_the_title( $post_id ) . ''; 286 | echo ''; 287 | break; 288 | 289 | case 'wcp_phone' : 290 | echo get_post_meta( $post_id, '_wcp_payment_phone', true ); 291 | break; 292 | 293 | case 'wcp_payment_date' : 294 | $date = get_post_meta( $post_id, '_wcp_payment_date', true ); 295 | echo date_i18n( get_option('date_format') . ' ' . get_option('time_format'), strtotime( $date ) ); 296 | break; 297 | 298 | case 'wcp_bank' : 299 | echo get_post_meta( $post_id, '_wcp_payment_bank', true ); 300 | break; 301 | 302 | case 'wcp_amount' : 303 | echo wc_price( get_post_meta( $post_id, '_wcp_payment_amount', true ) ); 304 | break; 305 | 306 | case 'wcp_order' : 307 | $order_id = get_post_meta( $post_id, '_wcp_payment_order_id', true ); 308 | if ( $order_id ) { 309 | $orders = wc_get_order( $order_id ); 310 | echo edit_post_link( '#' . $orders->get_order_number(), '', '', $orders->get_order_number() ) . ' (' . $orders->get_formatted_order_total() . ')'; 311 | } 312 | break; 313 | 314 | case 'wcp_status' : 315 | 316 | $status = get_post_status_object( get_post_status( $post_id ) ); 317 | printf( 318 | '%s', 319 | get_post_status( $post_id ), 320 | $status->label 321 | ); 322 | 323 | break; 324 | 325 | case 'wcp_action' : 326 | 327 | if ( 'wcp-pending_confirm' == get_post_status( $post_id ) ) { 328 | 329 | printf( 330 | '', 331 | wp_nonce_url( admin_url( 'admin-ajax.php?action=wcp_mark_payment_status&status=cancelled&payment_id=' . $post_id ), 'wcp-mark-payment-status' ), 332 | __( 'Cancel', 'woocommerce-confirm-payment' ) 333 | ); 334 | printf( 335 | '', 336 | wp_nonce_url( admin_url( 'admin-ajax.php?action=wcp_mark_payment_status&status=success&payment_id=' . $post_id ), 'wcp-mark-payment-status' ), 337 | __( 'Approve', 'woocommerce-confirm-payment' ) 338 | ); 339 | 340 | } 341 | 342 | break; 343 | } 344 | 345 | } 346 | 347 | /** 348 | * Adds the order pending confirm count to the menu. 349 | */ 350 | public function menu_payment_count() { 351 | 352 | global $submenu; 353 | 354 | if ( isset( $submenu['edit.php?post_type=wcp_confirm_payment'] ) ) { 355 | 356 | $counts = (array) wp_count_posts('wcp_confirm_payment'); 357 | 358 | $counts = isset( $counts['wcp-pending_confirm'] ) ? $counts['wcp-pending_confirm'] : 0; 359 | 360 | if ( $counts ) { 361 | 362 | foreach ( $submenu['edit.php?post_type=wcp_confirm_payment'] as $key => $menu_item ) { 363 | if ( 0 === strpos( $menu_item[0], __( 'Confirm payment', 'woocommerce-confirm-payment' ) ) ) { 364 | $submenu['edit.php?post_type=wcp_confirm_payment'][ $key ][0] .= ' ' . number_format_i18n( $counts ) . ''; 365 | break; 366 | } 367 | } 368 | 369 | } 370 | 371 | } 372 | } 373 | 374 | //defining the filter that will be used so we can select posts by 'author' 375 | public function filter_payment_field() { 376 | 377 | if( 'wcp_confirm_payment' == get_current_screen()->post_type ){ 378 | 379 | $order_id = sanitize_text_field( ( isset( $_GET['order_id'] ) ? $_GET['order_id'] : '' ) ); 380 | 381 | $posts = get_posts( array( 382 | 'numberposts' => -1, 383 | 'meta_key' => '_payment_method', 384 | 'meta_value' => 'bacs', 385 | 'post_type' => 'shop_order', 386 | 'post_status' => 'any' 387 | ) ); 388 | 389 | if ( !empty( $posts ) ) { 390 | echo ''; 397 | } 398 | } 399 | 400 | } 401 | 402 | public function filter_payment($query) { 403 | 404 | global $post_type, $pagenow; 405 | 406 | if( 'edit.php' == $pagenow && 'wcp_confirm_payment' == $post_type && $query->is_main_query() ){ 407 | 408 | if( isset( $_GET['order_id'] ) ) { 409 | $order_id = absint($_GET['order_id']); 410 | if( $order_id ){ 411 | $query->set( 'meta_key', '_wcp_payment_order_id' ); 412 | $query->set( 'meta_value', $order_id ); 413 | } 414 | } 415 | 416 | if( isset( $_GET['payment_id'] ) ) { 417 | $payment_id = absint($_GET['payment_id']); 418 | if( $payment_id ){ 419 | $query->set( 'post__in', array( $payment_id ) ); 420 | } 421 | } 422 | 423 | } 424 | } 425 | 426 | 427 | public function post_date_column_status( $status ) { 428 | 429 | if ( is_admin() && 'wcp_confirm_payment' == get_current_screen()->post_type ) return; 430 | 431 | return $status; 432 | 433 | } 434 | 435 | public function remove_row_actions( $actions, $post ) { 436 | 437 | if ( 'wcp_confirm_payment' == $post->post_type ) { return array(); } 438 | 439 | return $actions; 440 | 441 | } 442 | 443 | public function remove_edit_bulk_actions($actions) { 444 | 445 | unset( $actions['edit'] ); 446 | return $actions; 447 | 448 | } 449 | 450 | // define the woocommerce_admin_order_actions callback 451 | 452 | public function woocommerce_admin_order_actions( $actions, $the_order ) { 453 | 454 | if ( $the_order->has_status( array( 'checking_payment' ) ) ) { 455 | 456 | $actions['processing'] = array( 457 | 'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce_mark_order_status&status=processing&order_id=' . $the_order->get_id() ), 'woocommerce-mark-order-status' ), 458 | 'name' => __( 'Processing', 'woocommerce' ), 459 | 'action' => 'processing', 460 | ); 461 | 462 | $payment_id = get_post_meta( $the_order->get_id(), '_wcp_order_payment_id', true ); 463 | 464 | $actions['payment_detail'] = array( 465 | 'url' => admin_url( 'edit.php?post_type=wcp_confirm_payment&action=-1&payment_id=' . $payment_id ), 466 | 'name' => __( 'View payment detail', 'woocommerce-confirm-payment' ), 467 | 'action' => 'payment_detail', 468 | ); 469 | 470 | } 471 | return $actions; 472 | 473 | } 474 | 475 | public function approve_payment( $order_id ) { 476 | 477 | $payment_id = get_post_meta( $order_id, '_wcp_order_payment_id', true ); 478 | 479 | if ( $payment_id ) { 480 | wp_update_post( array( 'ID' => $payment_id, 'post_status' => 'wcp-success' ) ); 481 | } 482 | 483 | $orders = wc_get_order( $order_id ); 484 | 485 | $message = __( 'Completed payment', 'woocommerce-confirm-payment' ); 486 | 487 | $orders->add_order_note( $message, 0, get_current_user_id() ); 488 | 489 | } 490 | 491 | public function cancel_payment( $order_id ) { 492 | 493 | $orders = wc_get_order( $order_id ); 494 | 495 | $message = __( 'Cancelled payment', 'woocommerce-confirm-payment' ); 496 | 497 | $orders->add_order_note( $message, 0, get_current_user_id() ); 498 | 499 | } 500 | 501 | public function mark_payment_status(){ 502 | 503 | if ( check_admin_referer( 'wcp-mark-payment-status' ) ) { 504 | 505 | global $wpdb; 506 | 507 | $status = sanitize_text_field( $_GET['status'] ); 508 | 509 | $payment_id = absint( $_GET['payment_id'] ); 510 | 511 | wp_update_post( array( 'ID' => $payment_id, 'post_status' => 'wcp-' . $status ) ); 512 | 513 | $order_id = get_post_meta( $payment_id, '_wcp_payment_order_id', true ); 514 | 515 | $orders = wc_get_order( $order_id ); 516 | 517 | if ( 'success' == $status && $orders ) { 518 | 519 | $orders->update_status( 'processing' ); 520 | 521 | }else{ 522 | 523 | $orders->update_status( 'on-hold' ); 524 | 525 | } 526 | 527 | } 528 | 529 | wp_safe_redirect( wp_get_referer() ? wp_get_referer() : admin_url( 'edit.php?post_type=wcp_confirm_payment' ) ); 530 | 531 | exit; 532 | 533 | } 534 | 535 | } --------------------------------------------------------------------------------