| 1 |
<?php |
| 2 |
/** |
| 3 |
* Settlement Class. |
| 4 |
* WelcartPay based on e-SCOTT |
| 5 |
* |
| 6 |
* @package Welcart |
| 7 |
* @author Collne Inc. |
| 8 |
* @version 1.2.0 |
| 9 |
* @since 1.4.14 |
| 10 |
*/ |
| 11 |
class WELCARTPAY_SETTLEMENT extends ESCOTT_MAIN { |
| 12 |
/** |
| 13 |
* Instance of this class. |
| 14 |
* |
| 15 |
* @var object |
| 16 |
*/ |
| 17 |
protected static $instance = null; |
| 18 |
|
| 19 |
/** |
| 20 |
* 継続課金結果通知メール |
| 21 |
* |
| 22 |
* @var string |
| 23 |
*/ |
| 24 |
protected $continuation_charging_mail; |
| 25 |
|
| 26 |
/** |
| 27 |
* 処理ステータス |
| 28 |
* |
| 29 |
* @var array |
| 30 |
*/ |
| 31 |
protected $latest_status = array( |
| 32 |
'1Auth', |
| 33 |
'1Capture', |
| 34 |
'1Gathering', |
| 35 |
'1Delete', |
| 36 |
'2Add', |
| 37 |
'2Chg', |
| 38 |
'2Del', |
| 39 |
'5Auth', |
| 40 |
'5Gathering', |
| 41 |
'5Capture', |
| 42 |
'5Delete', |
| 43 |
'receipted', |
| 44 |
'11Gathering', |
| 45 |
'11Delete', |
| 46 |
); |
| 47 |
|
| 48 |
/** |
| 49 |
* 処理ステータス(取消以外) |
| 50 |
* |
| 51 |
* @var array |
| 52 |
*/ |
| 53 |
protected $primarily_status = array( |
| 54 |
'1Auth', |
| 55 |
'1Gathering', |
| 56 |
'2Add', |
| 57 |
'5Auth', |
| 58 |
'5Gathering', |
| 59 |
'5Capture', |
| 60 |
'receipted', |
| 61 |
); |
| 62 |
|
| 63 |
/** |
| 64 |
* 処理ステータス(再オーソリ) |
| 65 |
* |
| 66 |
* @var array |
| 67 |
*/ |
| 68 |
protected $reauth_status = array( |
| 69 |
'1ReAuth', |
| 70 |
); |
| 71 |
|
| 72 |
/** |
| 73 |
* Construct. |
| 74 |
*/ |
| 75 |
public function __construct() { |
| 76 |
$this->acting_name = 'WelcartPay'; |
| 77 |
$this->acting_formal_name = 'WelcartPay based on e-SCOTT'; |
| 78 |
|
| 79 |
$this->acting_card = 'welcart_card'; |
| 80 |
$this->acting_conv = 'welcart_conv'; |
| 81 |
$this->acting_atodene = 'welcart_atodene'; |
| 82 |
$this->acting_applepay = 'welcart_applepay'; |
| 83 |
$this->acting_unionpay = 'welcart_unionpay'; |
| 84 |
|
| 85 |
$this->acting_flg_card = 'acting_welcart_card'; |
| 86 |
$this->acting_flg_conv = 'acting_welcart_conv'; |
| 87 |
$this->acting_flg_atodene = 'acting_welcart_atodene'; |
| 88 |
$this->acting_flg_applepay = 'acting_welcart_applepay'; |
| 89 |
$this->acting_flg_unionpay = 'acting_welcart_unionpay'; |
| 90 |
|
| 91 |
$this->pay_method = array( |
| 92 |
'acting_welcart_card', |
| 93 |
'acting_welcart_conv', |
| 94 |
'acting_welcart_applepay', |
| 95 |
'acting_welcart_unionpay', |
| 96 |
); |
| 97 |
$this->merchantfree3 = 'wc2collne'; |
| 98 |
$this->quick_key_pre = 'wcpay'; |
| 99 |
|
| 100 |
parent::__construct( 'welcart' ); |
| 101 |
|
| 102 |
if ( $this->is_activate_card() || $this->is_activate_conv() || $this->is_activate_applepay() || $this->is_activate_unionpay() ) { |
| 103 |
if ( is_admin() ) { |
| 104 |
add_action( 'usces_action_admin_ajax', array( $this, 'admin_ajax' ) ); |
| 105 |
add_filter( 'usces_filter_orderlist_detail_value', array( $this, 'orderlist_settlement_status' ), 10, 4 ); |
| 106 |
add_action( 'usces_action_order_edit_form_status_block_middle', array( $this, 'settlement_status' ), 10, 3 ); |
| 107 |
add_action( 'usces_action_order_edit_form_settle_info', array( $this, 'settlement_information' ), 10, 2 ); |
| 108 |
add_action( 'usces_action_endof_order_edit_form', array( $this, 'settlement_dialog' ), 10, 2 ); |
| 109 |
} |
| 110 |
} |
| 111 |
|
| 112 |
if ( $this->is_validity_acting( 'card' ) ) { |
| 113 |
add_filter( 'usces_fiter_the_payment_method_explanation', array( $this, 'set_payment_method_explanation' ), 10, 3 ); |
| 114 |
add_filter( 'usces_filter_available_payment_method', array( $this, 'set_available_payment_method' ) ); |
| 115 |
add_filter( 'usces_filter_delivery_secure_form_howpay', array( $this, 'delivery_secure_form_howpay' ) ); |
| 116 |
add_filter( 'usces_filter_template_redirect', array( $this, 'member_update_settlement' ), 1 ); |
| 117 |
add_action( 'usces_action_member_submenu_list', array( $this, 'e_update_settlement' ) ); |
| 118 |
add_filter( 'usces_filter_member_submenu_list', array( $this, 'update_settlement' ), 10, 2 ); |
| 119 |
add_filter( 'usces_filter_save_order_acting_data', array( $this, 'save_order_acting_data' ) ); |
| 120 |
|
| 121 |
/* WCEX DL Seller */ |
| 122 |
if ( defined( 'WCEX_DLSELLER' ) ) { |
| 123 |
if ( defined( 'WCEX_DLSELLER_VERSION' ) && version_compare( WCEX_DLSELLER_VERSION, '2.2-beta', '<=' ) ) { |
| 124 |
add_filter( 'usces_filter_the_continue_payment_method', array( $this, 'continuation_payment_method' ) ); |
| 125 |
} |
| 126 |
add_filter( 'dlseller_filter_first_charging', array( $this, 'first_charging_date' ), 9, 5 ); |
| 127 |
add_filter( 'dlseller_filter_the_payment_method_restriction', array( $this, 'payment_method_restriction' ), 10, 2 ); |
| 128 |
add_filter( 'dlseller_filter_continue_member_list_limitofcard', array( $this, 'continue_member_list_limitofcard' ), 10, 4 ); |
| 129 |
add_filter( 'dlseller_filter_continue_member_list_condition', array( $this, 'continue_member_list_condition' ), 10, 4 ); |
| 130 |
add_action( 'dlseller_action_continue_member_list_page', array( $this, 'continue_member_list_page' ) ); |
| 131 |
add_filter( 'dlseller_filter_card_update_mail', array( $this, 'continue_member_card_update_mail' ), 10, 3 ); |
| 132 |
add_action( 'dlseller_action_do_continuation_charging', array( $this, 'auto_continuation_charging' ), 10, 4 ); |
| 133 |
add_action( 'dlseller_action_do_continuation', array( $this, 'do_auto_continuation' ), 10, 2 ); |
| 134 |
add_filter( 'dlseller_filter_reminder_mail_body', array( $this, 'reminder_mail_body' ), 10, 3 ); |
| 135 |
add_filter( 'dlseller_filter_contract_renewal_mail_body', array( $this, 'contract_renewal_mail_body' ), 10, 3 ); |
| 136 |
} |
| 137 |
|
| 138 |
/* WCEX Auto Delivery */ |
| 139 |
if ( defined( 'WCEX_AUTO_DELIVERY' ) ) { |
| 140 |
add_filter( 'wcad_filter_shippinglist_acting', array( $this, 'set_shippinglist_acting' ) ); |
| 141 |
add_filter( 'wcad_filter_available_regular_payment_method', array( $this, 'available_regular_payment_method' ) ); |
| 142 |
add_filter( 'wcad_filter_the_payment_method_restriction', array( $this, 'payment_method_restriction' ), 10, 2 ); |
| 143 |
add_action( 'wcad_action_reg_auto_orderdata', array( $this, 'register_auto_orderdata' ) ); |
| 144 |
} |
| 145 |
} |
| 146 |
|
| 147 |
if ( $this->is_activate_atodene() ) { |
| 148 |
if ( is_admin() ) { |
| 149 |
add_action( 'usces_after_cart_instant', array( $this, 'atodene_upload' ), 9 ); |
| 150 |
add_action( 'usces_action_order_list_page', array( $this, 'output_atodene_csv' ) ); |
| 151 |
add_action( 'usces_action_order_list_searchbox_bottom', array( $this, 'action_atodene_button' ) ); |
| 152 |
add_action( 'usces_action_order_list_footer', array( $this, 'order_list_footer' ) ); |
| 153 |
add_filter( 'usces_filter_order_list_page_js', array( $this, 'order_list_page_js' ) ); |
| 154 |
add_filter( 'usces_order_list_action_status', array( $this, 'order_list_action_status' ) ); |
| 155 |
add_filter( 'usces_order_list_action_message', array( $this, 'order_list_action_message' ) ); |
| 156 |
add_filter( 'usces_filter_deli_comps', array( $this, 'delivery_company_name' ) ); |
| 157 |
|
| 158 |
$acting_opts = $this->get_acting_settings(); |
| 159 |
if ( isset( $acting_opts['atodene_byitem'] ) && 'on' === $acting_opts['atodene_byitem'] ) { |
| 160 |
add_filter( 'usces_item_master_second_section', array( $this, 'edit_item_atodene_byitem' ), 10, 2 ); |
| 161 |
add_action( 'usces_action_save_product', array( $this, 'save_item_atodene_byitem' ), 10, 2 ); |
| 162 |
} |
| 163 |
} |
| 164 |
} |
| 165 |
|
| 166 |
if ( $this->is_validity_acting( 'atodene' ) ) { |
| 167 |
add_filter( 'usces_filter_nonacting_settlements', array( $this, 'nonacting_settlements' ) ); |
| 168 |
|
| 169 |
/* WCEX Auto Delivery */ |
| 170 |
if ( defined( 'WCEX_AUTO_DELIVERY' ) ) { |
| 171 |
add_filter( 'wcad_filter_the_payment_method_restriction', array( $this, 'payment_method_restriction_atodene' ), 11, 2 ); |
| 172 |
} |
| 173 |
} |
| 174 |
|
| 175 |
if ( $this->is_validity_acting( 'unionpay' ) ) { |
| 176 |
add_filter( 'usces_filter_save_order_acting_data', array( $this, 'save_order_acting_data' ) ); |
| 177 |
} |
| 178 |
|
| 179 |
$this->initialize_data(); |
| 180 |
} |
| 181 |
|
| 182 |
/** |
| 183 |
* Return an instance of this class. |
| 184 |
*/ |
| 185 |
public static function get_instance() { |
| 186 |
if ( is_null( self::$instance ) ) { |
| 187 |
self::$instance = new self(); |
| 188 |
} |
| 189 |
return self::$instance; |
| 190 |
} |
| 191 |
|
| 192 |
/** |
| 193 |
* Initialize. |
| 194 |
*/ |
| 195 |
public function initialize_data() { |
| 196 |
$options = get_option( 'usces', array() ); |
| 197 |
|
| 198 |
$options['acting_settings']['welcart']['merchant_id'] = ( isset( $options['acting_settings']['welcart']['merchant_id'] ) ) ? $options['acting_settings']['welcart']['merchant_id'] : ''; |
| 199 |
$options['acting_settings']['welcart']['merchant_pass'] = ( isset( $options['acting_settings']['welcart']['merchant_pass'] ) ) ? $options['acting_settings']['welcart']['merchant_pass'] : ''; |
| 200 |
$options['acting_settings']['welcart']['tenant_id'] = ( isset( $options['acting_settings']['welcart']['tenant_id'] ) ) ? $options['acting_settings']['welcart']['tenant_id'] : '0001'; |
| 201 |
$options['acting_settings']['welcart']['auth_key'] = ( isset( $options['acting_settings']['welcart']['auth_key'] ) ) ? $options['acting_settings']['welcart']['auth_key'] : ''; |
| 202 |
$options['acting_settings']['welcart']['ope'] = ( isset( $options['acting_settings']['welcart']['ope'] ) ) ? $options['acting_settings']['welcart']['ope'] : 'test'; |
| 203 |
$options['acting_settings']['welcart']['card_activate'] = ( isset( $options['acting_settings']['welcart']['card_activate'] ) ) ? $options['acting_settings']['welcart']['card_activate'] : 'off'; |
| 204 |
$options['acting_settings']['welcart']['card_key_aes'] = ( isset( $options['acting_settings']['welcart']['card_key_aes'] ) ) ? $options['acting_settings']['welcart']['card_key_aes'] : ''; |
| 205 |
$options['acting_settings']['welcart']['card_key_iv'] = ( isset( $options['acting_settings']['welcart']['card_key_iv'] ) ) ? $options['acting_settings']['welcart']['card_key_iv'] : ''; |
| 206 |
$options['acting_settings']['welcart']['foreign_activate'] = ( isset( $options['acting_settings']['welcart']['foreign_activate'] ) ) ? $options['acting_settings']['welcart']['foreign_activate'] : 'off'; |
| 207 |
$options['acting_settings']['welcart']['seccd'] = ( isset( $options['acting_settings']['welcart']['seccd'] ) ) ? $options['acting_settings']['welcart']['seccd'] : 'on'; |
| 208 |
$options['acting_settings']['welcart']['sec3d_activate'] = ( isset( $options['acting_settings']['welcart']['sec3d_activate'] ) ) ? $options['acting_settings']['welcart']['sec3d_activate'] : 'off'; |
| 209 |
$options['acting_settings']['welcart']['token_code'] = ( isset( $options['acting_settings']['welcart']['token_code'] ) ) ? $options['acting_settings']['welcart']['token_code'] : ''; |
| 210 |
$options['acting_settings']['welcart']['quickpay'] = ( isset( $options['acting_settings']['welcart']['quickpay'] ) ) ? $options['acting_settings']['welcart']['quickpay'] : 'off'; |
| 211 |
$options['acting_settings']['welcart']['chooseable_quickpay'] = ( isset( $options['acting_settings']['welcart']['chooseable_quickpay'] ) ) ? $options['acting_settings']['welcart']['chooseable_quickpay'] : 'on'; |
| 212 |
$options['acting_settings']['welcart']['operateid'] = ( isset( $options['acting_settings']['welcart']['operateid'] ) ) ? $options['acting_settings']['welcart']['operateid'] : '1Gathering'; |
| 213 |
$options['acting_settings']['welcart']['operateid_dlseller'] = ( isset( $options['acting_settings']['welcart']['operateid_dlseller'] ) ) ? $options['acting_settings']['welcart']['operateid_dlseller'] : '1Gathering'; |
| 214 |
$options['acting_settings']['welcart']['auto_settlement_mail'] = ( isset( $options['acting_settings']['welcart']['auto_settlement_mail'] ) ) ? $options['acting_settings']['welcart']['auto_settlement_mail'] : 'off'; |
| 215 |
$options['acting_settings']['welcart']['howtopay'] = ( isset( $options['acting_settings']['welcart']['howtopay'] ) ) ? $options['acting_settings']['welcart']['howtopay'] : '1'; |
| 216 |
$options['acting_settings']['welcart']['conv_activate'] = ( isset( $options['acting_settings']['welcart']['conv_activate'] ) ) ? $options['acting_settings']['welcart']['conv_activate'] : 'off'; |
| 217 |
$options['acting_settings']['welcart']['conv_limit'] = ( ! empty( $options['acting_settings']['welcart']['conv_limit'] ) ) ? $options['acting_settings']['welcart']['conv_limit'] : '7'; |
| 218 |
$options['acting_settings']['welcart']['conv_fee_type'] = ( isset( $options['acting_settings']['welcart']['conv_fee_type'] ) ) ? $options['acting_settings']['welcart']['conv_fee_type'] : ''; |
| 219 |
$options['acting_settings']['welcart']['conv_fee'] = ( isset( $options['acting_settings']['welcart']['conv_fee'] ) ) ? $options['acting_settings']['welcart']['conv_fee'] : ''; |
| 220 |
$options['acting_settings']['welcart']['conv_fee_limit_amount'] = ( isset( $options['acting_settings']['welcart']['conv_fee_limit_amount'] ) ) ? $options['acting_settings']['welcart']['conv_fee_limit_amount'] : ''; |
| 221 |
$options['acting_settings']['welcart']['conv_fee_first_amount'] = ( isset( $options['acting_settings']['welcart']['conv_fee_first_amount'] ) ) ? $options['acting_settings']['welcart']['conv_fee_first_amount'] : ''; |
| 222 |
$options['acting_settings']['welcart']['conv_fee_first_fee'] = ( isset( $options['acting_settings']['welcart']['conv_fee_first_fee'] ) ) ? $options['acting_settings']['welcart']['conv_fee_first_fee'] : ''; |
| 223 |
$options['acting_settings']['welcart']['conv_fee_amounts'] = ( isset( $options['acting_settings']['welcart']['conv_fee_amounts'] ) ) ? $options['acting_settings']['welcart']['conv_fee_amounts'] : array(); |
| 224 |
$options['acting_settings']['welcart']['conv_fee_fees'] = ( isset( $options['acting_settings']['welcart']['conv_fee_fees'] ) ) ? $options['acting_settings']['welcart']['conv_fee_fees'] : array(); |
| 225 |
$options['acting_settings']['welcart']['conv_fee_end_fee'] = ( isset( $options['acting_settings']['welcart']['conv_fee_end_fee'] ) ) ? $options['acting_settings']['welcart']['conv_fee_end_fee'] : ''; |
| 226 |
$options['acting_settings']['welcart']['atodene_activate'] = ( isset( $options['acting_settings']['welcart']['atodene_activate'] ) ) ? $options['acting_settings']['welcart']['atodene_activate'] : 'off'; |
| 227 |
$options['acting_settings']['welcart']['atodene_byitem'] = ( isset( $options['acting_settings']['welcart']['atodene_byitem'] ) ) ? $options['acting_settings']['welcart']['atodene_byitem'] : 'off'; |
| 228 |
$options['acting_settings']['welcart']['atodene_billing_method'] = ( isset( $options['acting_settings']['welcart']['atodene_billing_method'] ) ) ? $options['acting_settings']['welcart']['atodene_billing_method'] : '2'; |
| 229 |
$options['acting_settings']['welcart']['atodene_fee_type'] = ( isset( $options['acting_settings']['welcart']['atodene_fee_type'] ) ) ? $options['acting_settings']['welcart']['atodene_fee_type'] : ''; |
| 230 |
$options['acting_settings']['welcart']['atodene_fee'] = ( isset( $options['acting_settings']['welcart']['atodene_fee'] ) ) ? $options['acting_settings']['welcart']['atodene_fee'] : ''; |
| 231 |
$options['acting_settings']['welcart']['atodene_fee_limit_amount'] = ( isset( $options['acting_settings']['welcart']['atodene_fee_limit_amount'] ) ) ? $options['acting_settings']['welcart']['atodene_fee_limit_amount'] : ''; |
| 232 |
$options['acting_settings']['welcart']['atodene_fee_first_amount'] = ( isset( $options['acting_settings']['welcart']['atodene_fee_first_amount'] ) ) ? $options['acting_settings']['welcart']['atodene_fee_first_amount'] : ''; |
| 233 |
$options['acting_settings']['welcart']['atodene_fee_first_fee'] = ( isset( $options['acting_settings']['welcart']['atodene_fee_first_fee'] ) ) ? $options['acting_settings']['welcart']['atodene_fee_first_fee'] : ''; |
| 234 |
$options['acting_settings']['welcart']['atodene_fee_amounts'] = ( isset( $options['acting_settings']['welcart']['atodene_fee_amounts'] ) ) ? $options['acting_settings']['welcart']['atodene_fee_amounts'] : array(); |
| 235 |
$options['acting_settings']['welcart']['atodene_fee_fees'] = ( isset( $options['acting_settings']['welcart']['atodene_fee_fees'] ) ) ? $options['acting_settings']['welcart']['atodene_fee_fees'] : array(); |
| 236 |
$options['acting_settings']['welcart']['atodene_fee_end_fee'] = ( isset( $options['acting_settings']['welcart']['atodene_fee_end_fee'] ) ) ? $options['acting_settings']['welcart']['atodene_fee_end_fee'] : ''; |
| 237 |
$options['acting_settings']['welcart']['applepay_activate'] = ( isset( $options['acting_settings']['welcart']['applepay_activate'] ) ) ? $options['acting_settings']['welcart']['applepay_activate'] : 'off'; |
| 238 |
$options['acting_settings']['welcart']['applepay_tenant_id'] = ( isset( $options['acting_settings']['welcart']['applepay_tenant_id'] ) ) ? $options['acting_settings']['welcart']['applepay_tenant_id'] : ''; |
| 239 |
$options['acting_settings']['welcart']['applepay_quickpay'] = ( isset( $options['acting_settings']['welcart']['applepay_quickpay'] ) ) ? $options['acting_settings']['welcart']['applepay_quickpay'] : 'off'; |
| 240 |
$options['acting_settings']['welcart']['applepay_operateid'] = ( isset( $options['acting_settings']['welcart']['applepay_operateid'] ) ) ? $options['acting_settings']['welcart']['applepay_operateid'] : '1Gathering'; |
| 241 |
$options['acting_settings']['welcart']['applepay_key_aes'] = ( isset( $options['acting_settings']['welcart']['applepay_key_aes'] ) ) ? $options['acting_settings']['welcart']['applepay_key_aes'] : ''; |
| 242 |
$options['acting_settings']['welcart']['applepay_key_iv'] = ( isset( $options['acting_settings']['welcart']['applepay_key_iv'] ) ) ? $options['acting_settings']['welcart']['applepay_key_iv'] : ''; |
| 243 |
$options['acting_settings']['welcart']['applepay_certificate_path'] = ( isset( $options['acting_settings']['welcart']['applepay_certificate_path'] ) ) ? $options['acting_settings']['welcart']['applepay_certificate_path'] : ''; |
| 244 |
$options['acting_settings']['welcart']['applepay_certificate_key_pass'] = ( isset( $options['acting_settings']['welcart']['applepay_certificate_key_pass'] ) ) ? $options['acting_settings']['welcart']['applepay_certificate_key_pass'] : ''; |
| 245 |
$options['acting_settings']['welcart']['applepay_merchantidentifier'] = ( isset( $options['acting_settings']['welcart']['applepay_merchantidentifier'] ) ) ? $options['acting_settings']['welcart']['applepay_merchantidentifier'] : ''; |
| 246 |
$options['acting_settings']['welcart']['unionpay_activate'] = ( isset( $options['acting_settings']['welcart']['unionpay_activate'] ) ) ? $options['acting_settings']['welcart']['unionpay_activate'] : 'off'; |
| 247 |
$options['acting_settings']['welcart']['unionpay_key_aes'] = ( isset( $options['acting_settings']['welcart']['unionpay_key_aes'] ) ) ? $options['acting_settings']['welcart']['unionpay_key_aes'] : ''; |
| 248 |
$options['acting_settings']['welcart']['unionpay_key_iv'] = ( isset( $options['acting_settings']['welcart']['unionpay_key_iv'] ) ) ? $options['acting_settings']['welcart']['unionpay_key_iv'] : ''; |
| 249 |
$options['acting_settings']['welcart']['unionpay_pagelanguage'] = ( isset( $options['acting_settings']['welcart']['unionpay_pagelanguage'] ) ) ? $options['acting_settings']['welcart']['unionpay_pagelanguage'] : ''; |
| 250 |
$options['acting_settings']['welcart']['activate'] = ( isset( $options['acting_settings']['welcart']['activate'] ) ) ? $options['acting_settings']['welcart']['activate'] : 'off'; |
| 251 |
update_option( 'usces', $options ); |
| 252 |
|
| 253 |
$welcartpay_keys = get_option( 'usces_welcartpay_keys', array() ); |
| 254 |
if ( empty( $welcartpay_keys ) ) { |
| 255 |
$welcartpay_keys = array( |
| 256 |
'c0778c9aefe850d5ac8efed5d62ed281', |
| 257 |
'd0771e4b42ef683223df03f9558c23fd', |
| 258 |
'dfef8e46f7231e7e8271f906582a4e1d', |
| 259 |
'ad6dbb5e26cc9db1fe5d876a75764559', |
| 260 |
'4fc1738fffa5aa33792ddf8e5c183f72', |
| 261 |
'd255b1cb2c4d20959e3c80e457e5274c', |
| 262 |
'479ffcfe47db920e972a8c7932e581d9', |
| 263 |
'43c7f4782379b05cf69bbbfb547e3312', |
| 264 |
'524047b0e0ad64d4f7b42c14c77758e2', |
| 265 |
'b848aed9c05cbf2c85d2889b274c18ec', |
| 266 |
); |
| 267 |
update_option( 'usces_welcartpay_keys', $welcartpay_keys ); |
| 268 |
} |
| 269 |
|
| 270 |
$available_settlement = get_option( 'usces_available_settlement', array() ); |
| 271 |
if ( ! in_array( 'welcart', $available_settlement, true ) ) { |
| 272 |
$settlement = array( |
| 273 |
'welcart' => $this->acting_name, |
| 274 |
); |
| 275 |
$available_settlement = array_merge( $settlement, $available_settlement ); |
| 276 |
update_option( 'usces_available_settlement', $available_settlement ); |
| 277 |
} |
| 278 |
|
| 279 |
$noreceipt_status = get_option( 'usces_noreceipt_status', array() ); |
| 280 |
if ( ! in_array( 'acting_welcart_conv', $noreceipt_status, true ) || ! in_array( 'acting_welcart_atodene', $noreceipt_status, true ) ) { |
| 281 |
$noreceipt_status[] = 'acting_welcart_conv'; |
| 282 |
$noreceipt_status[] = 'acting_welcart_atodene'; |
| 283 |
update_option( 'usces_noreceipt_status', $noreceipt_status ); |
| 284 |
} |
| 285 |
|
| 286 |
$this->unavailable_method = array( |
| 287 |
'acting_escott_card', |
| 288 |
'acting_zeus_card', |
| 289 |
'acting_zeus_conv', |
| 290 |
'acting_sbps_card', |
| 291 |
); |
| 292 |
} |
| 293 |
|
| 294 |
/** |
| 295 |
* Admin scripts. |
| 296 |
* admin_print_footer_scripts |
| 297 |
*/ |
| 298 |
public function admin_scripts() { |
| 299 |
global $usces; |
| 300 |
|
| 301 |
$admin_page = filter_input( INPUT_GET, 'page', FILTER_DEFAULT ); |
| 302 |
switch ( $admin_page ) : |
| 303 |
case 'usces_settlement': |
| 304 |
$settlement_selected = get_option( 'usces_settlement_selected', array() ); |
| 305 |
if ( in_array( 'welcart', $settlement_selected, true ) ) : |
| 306 |
$acting_opts = $this->get_acting_settings(); |
| 307 |
?> |
| 308 |
<script type="text/javascript"> |
| 309 |
jQuery(document).ready( function($) { |
| 310 |
var card_activate = "<?php echo esc_attr( $acting_opts['card_activate'] ); ?>"; |
| 311 |
var conv_activate = "<?php echo esc_attr( $acting_opts['conv_activate'] ); ?>"; |
| 312 |
var atodene_activate = "<?php echo esc_attr( $acting_opts['atodene_activate'] ); ?>"; |
| 313 |
var applepay_activate = "<?php echo esc_attr( $acting_opts['applepay_activate'] ); ?>"; |
| 314 |
var unionpay_activate = "<?php echo esc_attr( $acting_opts['unionpay_activate'] ); ?>"; |
| 315 |
|
| 316 |
if( "on" == card_activate || "token" == card_activate ) { |
| 317 |
$(".card_welcart").css("display",""); |
| 318 |
$(".card_token_code_welcart").css("display",""); |
| 319 |
$(".card_howtopay_welcart").css("display",""); |
| 320 |
$(".card_sec3d_welcart").css("display",""); |
| 321 |
var sec3d_activate = "<?php echo esc_attr( $acting_opts['sec3d_activate'] ); ?>"; |
| 322 |
if( "on" == sec3d_activate ) { |
| 323 |
$(".card_key_welcart").css("display",""); |
| 324 |
} else { |
| 325 |
$(".card_key_welcart").css("display","none"); |
| 326 |
} |
| 327 |
var quickpay_welcart = "<?php echo esc_attr( $acting_opts['quickpay'] ); ?>"; |
| 328 |
if( "on" == quickpay_welcart ) { |
| 329 |
$(".card_chooseable_quickpay_welcart").css("display",""); |
| 330 |
} else { |
| 331 |
$(".card_chooseable_quickpay_welcart").css("display","none"); |
| 332 |
} |
| 333 |
} else if( "link" == card_activate ) { |
| 334 |
$(".card_welcart").css("display",""); |
| 335 |
$(".card_key_welcart").css("display",""); |
| 336 |
$(".card_token_code_welcart").css("display","none"); |
| 337 |
$(".card_howtopay_welcart").css("display","none"); |
| 338 |
$(".card_sec3d_welcart").css("display","none"); |
| 339 |
var quickpay_welcart = "<?php echo esc_attr( $acting_opts['quickpay'] ); ?>"; |
| 340 |
if( "on" == quickpay_welcart ) { |
| 341 |
$(".card_chooseable_quickpay_welcart").css("display",""); |
| 342 |
} else { |
| 343 |
$(".card_chooseable_quickpay_welcart").css("display","none"); |
| 344 |
} |
| 345 |
} else { |
| 346 |
$(".card_welcart").css("display","none"); |
| 347 |
$(".card_key_welcart").css("display","none"); |
| 348 |
$(".card_token_code_welcart").css("display","none"); |
| 349 |
$(".card_howtopay_welcart").css("display","none"); |
| 350 |
$(".card_sec3d_welcart").css("display","none"); |
| 351 |
$(".card_chooseable_quickpay_welcart").css("display","none"); |
| 352 |
} |
| 353 |
|
| 354 |
if( "on" == conv_activate ) { |
| 355 |
$(".conv_welcart").css("display",""); |
| 356 |
} else { |
| 357 |
$(".conv_welcart").css("display","none"); |
| 358 |
} |
| 359 |
|
| 360 |
if( "on" == atodene_activate ) { |
| 361 |
$(".atodene_welcart").css("display",""); |
| 362 |
} else { |
| 363 |
$(".atodene_welcart").css("display","none"); |
| 364 |
} |
| 365 |
|
| 366 |
if( "on" == applepay_activate ) { |
| 367 |
$(".applepay_welcart").css( "display",""); |
| 368 |
} else { |
| 369 |
$(".applepay_welcart").css("display","none"); |
| 370 |
} |
| 371 |
|
| 372 |
if( "on" == unionpay_activate ) { |
| 373 |
$(".unionpay_welcart").css("display",""); |
| 374 |
} else { |
| 375 |
$(".unionpay_welcart").css("display","none"); |
| 376 |
} |
| 377 |
|
| 378 |
$(document).on( "change", ".card_activate_welcart", function() { |
| 379 |
if( "on" == $(this).val() || "token" == $(this).val() ) { |
| 380 |
$(".card_welcart").css("display",""); |
| 381 |
$(".card_token_code_welcart").css("display",""); |
| 382 |
$(".card_howtopay_welcart").css("display",""); |
| 383 |
$(".card_sec3d_welcart").css("display",""); |
| 384 |
if( "on" == $("input[name='sec3d_activate']:checked").val() ) { |
| 385 |
$(".card_key_welcart").css("display",""); |
| 386 |
} else { |
| 387 |
$(".card_key_welcart").css("display","none"); |
| 388 |
} |
| 389 |
if( "on" == $("input[name='quickpay']:checked").val() ) { |
| 390 |
$(".card_chooseable_quickpay_welcart").css("display",""); |
| 391 |
} else { |
| 392 |
$(".card_chooseable_quickpay_welcart").css("display","none"); |
| 393 |
} |
| 394 |
} else if( "link" == $(this).val() ) { |
| 395 |
$(".card_welcart").css("display",""); |
| 396 |
$(".card_key_welcart").css("display",""); |
| 397 |
$(".card_token_code_welcart").css("display","none"); |
| 398 |
$(".card_howtopay_welcart").css("display","none"); |
| 399 |
$(".card_sec3d_welcart").css("display","none"); |
| 400 |
if( "on" == $("input[name='quickpay']:checked").val() ) { |
| 401 |
$(".card_chooseable_quickpay_welcart").css("display",""); |
| 402 |
} else { |
| 403 |
$(".card_chooseable_quickpay_welcart").css("display","none"); |
| 404 |
} |
| 405 |
} else { |
| 406 |
$(".card_welcart").css("display","none"); |
| 407 |
$(".card_key_welcart").css("display","none"); |
| 408 |
$(".card_token_code_welcart").css("display","none"); |
| 409 |
$(".card_howtopay_welcart").css("display","none"); |
| 410 |
$(".card_sec3d_welcart").css("display","none"); |
| 411 |
$(".card_chooseable_quickpay_welcart").css("display","none"); |
| 412 |
} |
| 413 |
}); |
| 414 |
|
| 415 |
$(document).on( "change", ".sec3d_activate_welcart", function() { |
| 416 |
if( "on" == $(this).val() ) { |
| 417 |
$(".card_key_welcart").css("display",""); |
| 418 |
} else { |
| 419 |
$(".card_key_welcart").css("display","none"); |
| 420 |
} |
| 421 |
}); |
| 422 |
|
| 423 |
$(document).on( "change", ".quickpay_welcart", function() { |
| 424 |
if( "on" == $(this).val() ) { |
| 425 |
$(".card_chooseable_quickpay_welcart").css("display",""); |
| 426 |
} else { |
| 427 |
$(".card_chooseable_quickpay_welcart").css("display","none"); |
| 428 |
} |
| 429 |
}); |
| 430 |
|
| 431 |
$(document).on( "change", ".conv_activate_welcart", function() { |
| 432 |
if( "on" == $(this).val() ) { |
| 433 |
$(".conv_welcart").css("display",""); |
| 434 |
} else { |
| 435 |
$(".conv_welcart").css("display","none"); |
| 436 |
} |
| 437 |
}); |
| 438 |
|
| 439 |
$(document).on( "change", ".atodene_activate_welcart", function() { |
| 440 |
if( "on" == $(this).val() ) { |
| 441 |
$(".atodene_welcart").css("display",""); |
| 442 |
} else { |
| 443 |
$(".atodene_welcart").css("display","none"); |
| 444 |
} |
| 445 |
}); |
| 446 |
|
| 447 |
$(document).on( "change", ".applepay_activate_welcart", function() { |
| 448 |
if( "on" == $(this).val() ) { |
| 449 |
$(".applepay_welcart").css("display",""); |
| 450 |
} else { |
| 451 |
$(".applepay_welcart").css("display","none"); |
| 452 |
} |
| 453 |
}); |
| 454 |
|
| 455 |
$(document).on( "change", ".unionpay_activate_welcart", function() { |
| 456 |
if( "on" == $(this).val() ) { |
| 457 |
$(".unionpay_welcart").css("display",""); |
| 458 |
} else { |
| 459 |
$(".unionpay_welcart").css("display","none"); |
| 460 |
} |
| 461 |
}); |
| 462 |
|
| 463 |
adminSettlementWelcartPay = { |
| 464 |
openFee : function(mode) { |
| 465 |
$("#fee_change_field").html(""); |
| 466 |
$("#fee_fix").val($("#"+mode+"_fee").val()); |
| 467 |
$("#fee_limit_amount_fix").val($("#"+mode+"_fee_limit_amount_fix").val()); |
| 468 |
$("#fee_first_amount").val($("#"+mode+"_fee_first_amount").val()); |
| 469 |
$("#fee_first_fee").val($("#"+mode+"_fee_first_fee").val()); |
| 470 |
$("#fee_limit_amount_change").val($("#"+mode+"_fee_limit_amount_change").val()); |
| 471 |
var fee_amounts = new Array(); |
| 472 |
var fee_fees = new Array(); |
| 473 |
if( 0 < $("#"+mode+"_fee_amounts").val().length ) { |
| 474 |
fee_amounts = $("#"+mode+"_fee_amounts").val().split("|"); |
| 475 |
} |
| 476 |
if( 0 < $("#"+mode+"_fee_fees").val().length ) { |
| 477 |
fee_fees = $("#"+mode+"_fee_fees").val().split("|"); |
| 478 |
} |
| 479 |
if( 0 < fee_amounts.length ) { |
| 480 |
var amount = parseInt($("#fee_first_amount").val()) + 1; |
| 481 |
for( var i = 0; i < fee_amounts.length; i++ ) { |
| 482 |
html = '<tr id="row_'+i+'"><td class="cod_f"><span id="amount_'+i+'">'+amount+'</span></td><td class="cod_m"><?php esc_html_e( ' - ', 'usces' ); ?></td><td class="cod_e"><input name="fee_amounts['+i+']" type="text" class="short_str num" value="'+fee_amounts[i]+'" /></td><td class="cod_cod"><input name="fee_fees['+i+']" type="text" class="short_str num" value="'+fee_fees[i]+'" /></td></tr>'; |
| 483 |
$("#fee_change_field").append(html); |
| 484 |
amount = parseInt(fee_amounts[i]) + 1; |
| 485 |
} |
| 486 |
$("#end_amount").html(amount); |
| 487 |
} else { |
| 488 |
$("#end_amount").html(parseInt($("#"+mode+"_fee_first_amount").val()) + 1); |
| 489 |
} |
| 490 |
$("#fee_end_fee").val($("#"+mode+"_fee_end_fee").val()); |
| 491 |
|
| 492 |
var fee_type = $("#"+mode+"_fee_type").val(); |
| 493 |
if( "change" == fee_type ) { |
| 494 |
$("#fee_type_change").prop("checked",true); |
| 495 |
$("#welcartpay_fee_fix_table").css("display","none"); |
| 496 |
$("#welcartpay_fee_change_table").css("display",""); |
| 497 |
} else { |
| 498 |
$("#fee_type_fix").prop("checked",true); |
| 499 |
$("#welcartpay_fee_fix_table").css("display",""); |
| 500 |
$("#welcartpay_fee_change_table").css("display","none"); |
| 501 |
} |
| 502 |
}, |
| 503 |
|
| 504 |
updateFee : function(mode) { |
| 505 |
var fee_type = $("input[name='fee_type']:checked").val(); |
| 506 |
$("#"+mode+"_fee_type").val(fee_type); |
| 507 |
$("#"+mode+"_fee").val($("#fee_fix").val()); |
| 508 |
$("#"+mode+"_fee_limit_amount_"+fee_type).val($("#fee_limit_amount_"+fee_type).val()); |
| 509 |
$("#"+mode+"_fee_first_amount").val($("#fee_first_amount").val()); |
| 510 |
$("#"+mode+"_fee_first_fee").val($("#fee_first_fee").val()); |
| 511 |
var fee_amounts = ""; |
| 512 |
var fee_fees = ""; |
| 513 |
var sp = ""; |
| 514 |
var fee_amounts_length = $("input[name^='fee_amounts']").length; |
| 515 |
for( var i = 0; i < fee_amounts_length; i++ ) { |
| 516 |
fee_amounts += sp + $("input[name='fee_amounts\["+i+"\]']").val(); |
| 517 |
fee_fees += sp + $("input[name='fee_fees\["+i+"\]']").val(); |
| 518 |
sp = "|"; |
| 519 |
} |
| 520 |
$("#"+mode+"_fee_amounts").val(fee_amounts); |
| 521 |
$("#"+mode+"_fee_fees").val(fee_fees); |
| 522 |
$("#"+mode+"_fee_end_fee").val($("#fee_end_fee").val()); |
| 523 |
}, |
| 524 |
|
| 525 |
setFeeType : function( mode, closed ) { |
| 526 |
var fee_type = $("input[name='fee_type']:checked").val(); |
| 527 |
if( "change" == fee_type ) { |
| 528 |
$("#"+mode+"_fee_type_field").html("<?php esc_attr_e( 'Variable', 'usces' ); ?>"); |
| 529 |
if( !closed ) { |
| 530 |
$("#welcartpay_fee_fix_table").css("display","none"); |
| 531 |
$("#welcartpay_fee_change_table").css("display",""); |
| 532 |
} |
| 533 |
} else if( "fix" == fee_type ) { |
| 534 |
$("#"+mode+"_fee_type_field").html("<?php esc_attr_e( 'Fixation', 'usces' ); ?>"); |
| 535 |
if( !closed ) { |
| 536 |
$("#welcartpay_fee_fix_table").css("display",""); |
| 537 |
$("#welcartpay_fee_change_table").css("display","none"); |
| 538 |
} |
| 539 |
} |
| 540 |
} |
| 541 |
}; |
| 542 |
|
| 543 |
$("#welcartpay_fee_dialog").dialog({ |
| 544 |
autoOpen: false, |
| 545 |
height: 500, |
| 546 |
width: 450, |
| 547 |
modal: true, |
| 548 |
open: function() { |
| 549 |
adminSettlementWelcartPay.openFee($("#welcartpay_fee_mode").val()); |
| 550 |
}, |
| 551 |
buttons: { |
| 552 |
"<?php esc_attr_e( 'Settings' ); ?>": function() { |
| 553 |
adminSettlementWelcartPay.updateFee($("#welcartpay_fee_mode").val()); |
| 554 |
}, |
| 555 |
"<?php esc_attr_e( 'Close' ); ?>": function() { |
| 556 |
$(this).dialog('close'); |
| 557 |
} |
| 558 |
}, |
| 559 |
close: function() { |
| 560 |
adminSettlementWelcartPay.setFeeType($("#welcartpay_fee_mode").val(),true); |
| 561 |
} |
| 562 |
}); |
| 563 |
|
| 564 |
$(document).on( "click", "#conv_fee_setting", function() { |
| 565 |
$("#welcartpay_fee_mode").val("conv"); |
| 566 |
$("#welcartpay_fee_dialog").dialog("option","title","<?php esc_attr_e( 'Online storage agency settlement fee setting', 'usces' ); ?>"); |
| 567 |
$("#welcartpay_fee_dialog").dialog("open"); |
| 568 |
}); |
| 569 |
|
| 570 |
$(document).on( "click", "#atodene_fee_setting", function() { |
| 571 |
$("#welcartpay_fee_mode").val("atodene"); |
| 572 |
$("#welcartpay_fee_dialog").dialog("option","title","<?php esc_attr_e( 'Postpay settlement fee setting', 'usces' ); ?>"); |
| 573 |
$("#welcartpay_fee_dialog").dialog("open"); |
| 574 |
}); |
| 575 |
|
| 576 |
$(document).on( "click", ".fee_type", function() { |
| 577 |
if( "change" == $(this).val() ) { |
| 578 |
$("#welcartpay_fee_fix_table").css("display","none"); |
| 579 |
$("#welcartpay_fee_change_table").css("display",""); |
| 580 |
} else { |
| 581 |
$("#welcartpay_fee_fix_table").css("display",""); |
| 582 |
$("#welcartpay_fee_change_table").css("display","none"); |
| 583 |
} |
| 584 |
}); |
| 585 |
|
| 586 |
$(document).on( "change", "input[name='fee_first_amount']", function() { |
| 587 |
var rows = $("input[name^='fee_amounts']"); |
| 588 |
var first_amount = $("input[name='fee_first_amount']"); |
| 589 |
if( 0 == rows.length && $(first_amount).val() != '' ) { |
| 590 |
$("#end_amount").html(parseInt($(first_amount).val()) + 1); |
| 591 |
} else if( 0 < rows.length && $(first_amount).val() != '' ) { |
| 592 |
$('#amount_0').html(parseInt($(first_amount).val()) + 1); |
| 593 |
} |
| 594 |
}); |
| 595 |
|
| 596 |
$(document).on( "change", "#fee_limit_amount_change", function() { |
| 597 |
if( "change" == $("input[name='fee_type']:checked").val() ) { |
| 598 |
var amount = parseInt($("#end_amount").html()); |
| 599 |
var limit = parseInt($("#fee_limit_amount_change").val()); |
| 600 |
if( amount >= limit ) { |
| 601 |
alert("<?php esc_attr_e( 'A value of the amount of upper limit is incorrect.', 'usces' ); ?>"+amount+' : '+limit); |
| 602 |
} |
| 603 |
} |
| 604 |
}); |
| 605 |
|
| 606 |
$(document).on( "change", "input[name^='fee_amounts']", function() { |
| 607 |
var rows = $("input[name^='fee_amounts']"); |
| 608 |
var cnt = $(rows).length; |
| 609 |
var end_amount = $("#end_amount"); |
| 610 |
var id = $(rows).index(this); |
| 611 |
if( id >= cnt-1 ) { |
| 612 |
$( end_amount ).html(parseInt($(rows).eq(id).val()) + 1); |
| 613 |
} else if( id < cnt - 1 ) { |
| 614 |
$("#amount_"+(id + 1)).html(parseInt($(rows).eq(id).val()) + 1); |
| 615 |
} |
| 616 |
}); |
| 617 |
|
| 618 |
$(document).on( "click", "#fee_add_row", function() { |
| 619 |
var rows = $("input[name^='fee_amounts']"); |
| 620 |
$(rows).unbind("change"); |
| 621 |
var first_amount = $("input[name='fee_first_amount']"); |
| 622 |
var first_fee = $("input[name='fee_first_fee']"); |
| 623 |
var end_amount = $("#end_amount"); |
| 624 |
var enf_fee = $("input[name='fee_end_fee']"); |
| 625 |
if( 0 == rows.length ) { |
| 626 |
amount = ( $(first_amount).val() == '' ) ? '' : parseInt($(first_amount).val()) + 1; |
| 627 |
} else if( 0 < rows.length ) { |
| 628 |
amount = ( $(rows).eq(rows.length-1).val() == '' ) ? '' : parseInt($(rows).eq(rows.length-1).val()) + 1; |
| 629 |
} |
| 630 |
html = '<tr id="row_'+rows.length+'"><td class="cod_f"><span id="amount_'+rows.length+'">'+amount+'</span></td><td class="cod_m"><?php esc_html_e( ' - ', 'usces' ); ?></td><td class="cod_e"><input name="fee_amounts['+rows.length+']" type="text" class="short_str num" /></td><td class="cod_cod"><input name="fee_fees['+rows.length+']" type="text" class="short_str num" /></td></tr>'; |
| 631 |
$("#fee_change_field").append(html); |
| 632 |
rows = $("input[name^='fee_amounts']"); |
| 633 |
$(rows).bind( "change", function() { |
| 634 |
var cnt = $(rows).length - 1; |
| 635 |
var id = $(rows).index(this); |
| 636 |
if( id >= cnt ) { |
| 637 |
$(end_amount).html(parseInt($(rows).eq(id).val()) + 1); |
| 638 |
} else if( id < cnt ) { |
| 639 |
$("#amount_"+(id + 1)).html(parseInt($(rows).eq(id).val()) + 1); |
| 640 |
} |
| 641 |
}); |
| 642 |
}); |
| 643 |
|
| 644 |
$(document).on( "click", "#fee_del_row", function() { |
| 645 |
var rows = $("input[name^='fee_amounts']"); |
| 646 |
var first_amount = $("input[name='fee_first_amount']"); |
| 647 |
var end_amount = $("#end_amount"); |
| 648 |
var del_id = rows.length - 1; |
| 649 |
if( 0 < rows.length ) { |
| 650 |
$("#row_"+del_id).remove(); |
| 651 |
} |
| 652 |
rows = $("input[name^='fee_amounts']"); |
| 653 |
if( 0 == rows.length && $(first_amount).val() != "" ) { |
| 654 |
$(end_amount).html(parseInt($(first_amount).val()) + 1); |
| 655 |
} else if( 0 < rows.length && $(rows).eq(rows.length - 1).val() != "" ) { |
| 656 |
$(end_amount).html(parseInt($(rows).eq(rows.length - 1).val()) + 1); |
| 657 |
} |
| 658 |
}); |
| 659 |
|
| 660 |
adminSettlementWelcartPay.setFeeType("conv",false); |
| 661 |
adminSettlementWelcartPay.setFeeType("atodene",false); |
| 662 |
}); |
| 663 |
</script> |
| 664 |
<?php |
| 665 |
endif; |
| 666 |
break; |
| 667 |
|
| 668 |
case 'usces_orderlist': |
| 669 |
case 'usces_continue': |
| 670 |
$acting_flg = ''; |
| 671 |
$dialog_title = ''; |
| 672 |
$order_id = ''; |
| 673 |
$order_data = array(); |
| 674 |
|
| 675 |
$order_action = filter_input( INPUT_GET, 'order_action', FILTER_DEFAULT ); |
| 676 |
$continue_action = filter_input( INPUT_GET, 'continue_action', FILTER_DEFAULT ); |
| 677 |
|
| 678 |
/* 受注編集画面・継続課金会員詳細画面 */ |
| 679 |
if ( ( 'usces_orderlist' === $admin_page && ( 'edit' === $order_action || 'editpost' === $order_action || 'newpost' === $order_action ) ) || |
| 680 |
( 'usces_continue' === $admin_page && 'settlement' === $continue_action ) ) { |
| 681 |
$order_id = filter_input( INPUT_GET, 'order_id', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ); |
| 682 |
if ( ! $order_id && isset( $_POST['order_id'] ) ) { |
| 683 |
$order_id = filter_input( INPUT_POST, 'order_id', FILTER_DEFAULT, FILTER_NULL_ON_FAILURE ); |
| 684 |
} |
| 685 |
if ( $order_id ) { |
| 686 |
$order_data = $usces->get_order_data( $order_id, 'direct' ); |
| 687 |
$payment = usces_get_payments_by_name( $order_data['order_payment_name'] ); |
| 688 |
if ( isset( $payment['settlement'] ) ) { |
| 689 |
$acting_flg = $payment['settlement']; |
| 690 |
} |
| 691 |
if ( isset( $payment['name'] ) ) { |
| 692 |
$dialog_title = $payment['name']; |
| 693 |
} |
| 694 |
} |
| 695 |
} |
| 696 |
$args = compact( 'order_id', 'acting_flg', 'admin_page', 'order_data' ); |
| 697 |
|
| 698 |
if ( in_array( $acting_flg, $this->pay_method, true ) ) : |
| 699 |
?> |
| 700 |
<script type="text/javascript"> |
| 701 |
jQuery(document).ready( function( $ ) { |
| 702 |
adminOrderEdit = { |
| 703 |
<?php |
| 704 |
if ( 'acting_welcart_card' === $acting_flg ) : |
| 705 |
?> |
| 706 |
getSettlementInfoCard : function() { |
| 707 |
$("#settlement-response").html(""); |
| 708 |
$("#settlement-response-loading").html('<img src="'+uscesL10n.USCES_PLUGIN_URL+'/images/loading.gif" />'); |
| 709 |
var mode = ( "" != $("#error").val() ) ? "error_welcartpay_card" : "get_welcartpay_card"; |
| 710 |
$.ajax({ |
| 711 |
url: ajaxurl, |
| 712 |
type: "POST", |
| 713 |
cache: false, |
| 714 |
dataType: 'json', |
| 715 |
data: { |
| 716 |
action: "usces_admin_ajax", |
| 717 |
mode: mode, |
| 718 |
order_id: $("#order_id").val(), |
| 719 |
order_num: $("#order_num").val(), |
| 720 |
trans_id: $("#trans_id").val(), |
| 721 |
member_id: $("#member_id").val(), |
| 722 |
wc_nonce: $("#wc_nonce").val() |
| 723 |
} |
| 724 |
}).done( function(retVal,dataType) { |
| 725 |
$("#settlement-response").html(retVal.result); |
| 726 |
$("#settlement-response-loading").html(""); |
| 727 |
}).fail( function(retVal) { |
| 728 |
$("#settlement-response-loading").html(""); |
| 729 |
}); |
| 730 |
return false; |
| 731 |
}, |
| 732 |
captureSettlementCard : function(amount) { |
| 733 |
$("#settlement-response").html(""); |
| 734 |
$("#settlement-response-loading").html('<img src="'+uscesL10n.USCES_PLUGIN_URL+'/images/loading.gif" />'); |
| 735 |
$.ajax({ |
| 736 |
url: ajaxurl, |
| 737 |
type: "POST", |
| 738 |
cache: false, |
| 739 |
dataType: 'json', |
| 740 |
data: { |
| 741 |
action: "usces_admin_ajax", |
| 742 |
mode: "capture_welcartpay_card", |
| 743 |
order_id: $("#order_id").val(), |
| 744 |
order_num: $("#order_num").val(), |
| 745 |
trans_id: $("#trans_id").val(), |
| 746 |
member_id: $("#member_id").val(), |
| 747 |
amount: amount, |
| 748 |
wc_nonce: $("#wc_nonce").val() |
| 749 |
} |
| 750 |
}).done( function(retVal,dataType) { |
| 751 |
$("#settlement-response").html(retVal.result); |
| 752 |
if( retVal.status == "OK" ) { |
| 753 |
$("#settlement-status").html(retVal.acting_status); |
| 754 |
$("#responsecd-"+$("#trans_id").val()+"-"+$("#order_num").val()).val(""); |
| 755 |
} else { |
| 756 |
$("#responsecd-"+$("#trans_id").val()+"-"+$("#order_num").val()).val(retVal.status); |
| 757 |
} |
| 758 |
$("#settlement-response-loading").html(""); |
| 759 |
}).fail( function( retVal ) { |
| 760 |
$("#settlement-response-loading").html(""); |
| 761 |
}); |
| 762 |
return false; |
| 763 |
}, |
| 764 |
changeSettlementCard : function(amount) { |
| 765 |
$("#settlement-response").html(""); |
| 766 |
$("#settlement-response-loading").html('<img src="'+uscesL10n.USCES_PLUGIN_URL+'/images/loading.gif" />'); |
| 767 |
$.ajax({ |
| 768 |
url: ajaxurl, |
| 769 |
type: "POST", |
| 770 |
cache: false, |
| 771 |
dataType: 'json', |
| 772 |
data: { |
| 773 |
action: "usces_admin_ajax", |
| 774 |
mode: "change_welcartpay_card", |
| 775 |
order_id: $("#order_id").val(), |
| 776 |
order_num: $("#order_num").val(), |
| 777 |
trans_id: $("#trans_id").val(), |
| 778 |
member_id: $("#member_id").val(), |
| 779 |
amount: amount, |
| 780 |
wc_nonce: $("#wc_nonce").val() |
| 781 |
} |
| 782 |
}).done( function(retVal,dataType) { |
| 783 |
$("#settlement-response").html(retVal.result); |
| 784 |
$("#settlement-response-loading").html(""); |
| 785 |
}).fail( function(retVal) { |
| 786 |
$("#settlement-response-loading").html(""); |
| 787 |
}); |
| 788 |
return false; |
| 789 |
}, |
| 790 |
deleteSettlementCard : function(amount) { |
| 791 |
$("#settlement-response").html(""); |
| 792 |
$("#settlement-response-loading").html('<img src="'+uscesL10n.USCES_PLUGIN_URL+'/images/loading.gif" />'); |
| 793 |
$.ajax({ |
| 794 |
url: ajaxurl, |
| 795 |
type: "POST", |
| 796 |
cache: false, |
| 797 |
dataType: 'json', |
| 798 |
data: { |
| 799 |
action: "usces_admin_ajax", |
| 800 |
mode: "delete_welcartpay_card", |
| 801 |
order_id: $("#order_id").val(), |
| 802 |
order_num: $("#order_num").val(), |
| 803 |
trans_id: $("#trans_id").val(), |
| 804 |
member_id: $("#member_id").val(), |
| 805 |
amount: amount, |
| 806 |
wc_nonce: $("#wc_nonce").val() |
| 807 |
} |
| 808 |
}).done( function(retVal,dataType) { |
| 809 |
$("#settlement-response").html(retVal.result); |
| 810 |
if( retVal.status == "OK" ) { |
| 811 |
$("#settlement-status").html(retVal.acting_status); |
| 812 |
$("#responsecd-"+$("#trans_id").val()+"-"+$("#order_num").val()).val(""); |
| 813 |
} else { |
| 814 |
$("#responsecd-"+$("#trans_id").val()+"-"+$("#order_num").val()).val(retVal.status); |
| 815 |
} |
| 816 |
$("#settlement-response-loading").html(""); |
| 817 |
}).fail( function(retVal) { |
| 818 |
$("#settlement-response-loading").html(""); |
| 819 |
}); |
| 820 |
return false; |
| 821 |
}, |
| 822 |
authSettlementCard : function(mode,amount) { |
| 823 |
$("#settlement-response").html(""); |
| 824 |
$("#settlement-response-loading").html('<img src="'+uscesL10n.USCES_PLUGIN_URL+'/images/loading.gif" />'); |
| 825 |
$.ajax({ |
| 826 |
url: ajaxurl, |
| 827 |
type: "POST", |
| 828 |
cache: false, |
| 829 |
dataType: 'json', |
| 830 |
data: { |
| 831 |
action: "usces_admin_ajax", |
| 832 |
mode: mode+"_welcartpay_card", |
| 833 |
order_id: $("#order_id").val(), |
| 834 |
order_num: $("#order_num").val(), |
| 835 |
trans_id: $("#trans_id").val(), |
| 836 |
member_id: $("#member_id").val(), |
| 837 |
amount: amount, |
| 838 |
wc_nonce: $("#wc_nonce").val() |
| 839 |
} |
| 840 |
}).done( function(retVal,dataType) { |
| 841 |
$("#settlement-response").html(retVal.result); |
| 842 |
if( retVal.status == "OK" ) { |
| 843 |
$("#settlement-status").html(retVal.acting_status); |
| 844 |
$("#responsecd-"+$("#trans_id").val()+"-"+$("#order_num").val()).val(""); |
| 845 |
if( retVal.trans_id && $("#settlement-information-9999999999-1").length ) { |
| 846 |
$("[id=settlement-information-9999999999-1]").attr("id","settlement-information-"+retVal.trans_id+"-1"); |
| 847 |
$("#trans_id").val(retVal.trans_id); |
| 848 |
} |
| 849 |
} else { |
| 850 |
$("#responsecd-"+$("#trans_id").val()+"-"+$("#order_num").val()).val(retVal.status); |
| 851 |
} |
| 852 |
$("#settlement-response-loading").html(""); |
| 853 |
}).fail( function(retVal) { |
| 854 |
$("#settlement-response-loading").html(""); |
| 855 |
}); |
| 856 |
return false; |
| 857 |
} |
| 858 |
<?php |
| 859 |
elseif ( 'acting_welcart_conv' === $acting_flg ) : |
| 860 |
?> |
| 861 |
getSettlementInfoConv : function() { |
| 862 |
$("#settlement-response").html(""); |
| 863 |
$("#settlement-response-loading").html('<img src="'+uscesL10n.USCES_PLUGIN_URL+'/images/loading.gif" />'); |
| 864 |
$.ajax({ |
| 865 |
url: ajaxurl, |
| 866 |
type: "POST", |
| 867 |
cache: false, |
| 868 |
dataType: 'json', |
| 869 |
data: { |
| 870 |
action: "usces_admin_ajax", |
| 871 |
mode: "get_welcartpay_conv", |
| 872 |
order_id: $("#order_id").val(), |
| 873 |
trans_id: $("#trans_id").val(), |
| 874 |
wc_nonce: $("#wc_nonce").val() |
| 875 |
} |
| 876 |
}).done( function(retVal,dataType) { |
| 877 |
$("#settlement-response").html(retVal.result); |
| 878 |
$("#settlement-response-loading").html(""); |
| 879 |
}).fail( function(retVal) { |
| 880 |
$("#settlement-response-loading").html(""); |
| 881 |
}); |
| 882 |
return false; |
| 883 |
}, |
| 884 |
changeSettlementConv : function(paylimit,amount) { |
| 885 |
$("#settlement-response").html(""); |
| 886 |
$("#settlement-response-loading").html('<img src="'+uscesL10n.USCES_PLUGIN_URL+'/images/loading.gif" />'); |
| 887 |
|
| 888 |
$.ajax({ |
| 889 |
url: ajaxurl, |
| 890 |
type: "POST", |
| 891 |
cache: false, |
| 892 |
dataType: 'json', |
| 893 |
data: { |
| 894 |
action: "usces_admin_ajax", |
| 895 |
mode: "change_welcartpay_conv", |
| 896 |
order_id: $("#order_id").val(), |
| 897 |
trans_id: $("#trans_id").val(), |
| 898 |
paylimit: paylimit, |
| 899 |
amount: amount, |
| 900 |
wc_nonce: $("#wc_nonce").val() |
| 901 |
} |
| 902 |
}).done( function(retVal,dataType) { |
| 903 |
$("#settlement-response").html(retVal.result); |
| 904 |
$("#settlement-response-loading").html(""); |
| 905 |
}).fail( function(retVal) { |
| 906 |
$("#settlement-response-loading").html(""); |
| 907 |
}); |
| 908 |
return false; |
| 909 |
}, |
| 910 |
deleteSettlementConv : function(amount) { |
| 911 |
$("#settlement-response").html(""); |
| 912 |
$("#settlement-response-loading").html('<img src="'+uscesL10n.USCES_PLUGIN_URL+'/images/loading.gif" />'); |
| 913 |
$.ajax({ |
| 914 |
url: ajaxurl, |
| 915 |
type: "POST", |
| 916 |
cache: false, |
| 917 |
dataType: 'json', |
| 918 |
data: { |
| 919 |
action: "usces_admin_ajax", |
| 920 |
mode: "delete_welcartpay_conv", |
| 921 |
order_id: $("#order_id").val(), |
| 922 |
trans_id: $("#trans_id").val(), |
| 923 |
amount: amount, |
| 924 |
wc_nonce: $("#wc_nonce").val() |
| 925 |
} |
| 926 |
}).done( function(retVal,dataType) { |
| 927 |
$("#settlement-response").html(retVal.result); |
| 928 |
if( retVal.status == "OK" ) { |
| 929 |
$("#settlement-status").html(retVal.acting_status); |
| 930 |
} |
| 931 |
$("#settlement-response-loading").html(""); |
| 932 |
}).fail( function(retVal) { |
| 933 |
$("#settlement-response-loading").html(""); |
| 934 |
}); |
| 935 |
return false; |
| 936 |
}, |
| 937 |
addSettlementConv : function(paylimit,amount) { |
| 938 |
$("#settlement-response").html(""); |
| 939 |
$("#settlement-response-loading").html('<img src="'+uscesL10n.USCES_PLUGIN_URL+'/images/loading.gif" />'); |
| 940 |
$.ajax({ |
| 941 |
url: ajaxurl, |
| 942 |
type: "POST", |
| 943 |
cache: false, |
| 944 |
dataType: 'json', |
| 945 |
data: { |
| 946 |
action: "usces_admin_ajax", |
| 947 |
mode: "add_welcartpay_conv", |
| 948 |
order_id: $("#order_id").val(), |
| 949 |
trans_id: $("#trans_id").val(), |
| 950 |
paylimit: paylimit, |
| 951 |
amount: amount, |
| 952 |
wc_nonce: $("#wc_nonce").val() |
| 953 |
} |
| 954 |
}).done( function(retVal,dataType) { |
| 955 |
$("#settlement-response").html(retVal.result); |
| 956 |
if( retVal.status == "OK" ) { |
| 957 |
$("#settlement-status").html(retVal.acting_status); |
| 958 |
} |
| 959 |
$("#settlement-response-loading").html(""); |
| 960 |
}).fail( function(retVal) { |
| 961 |
$("#settlement-response-loading").html(""); |
| 962 |
}); |
| 963 |
return false; |
| 964 |
} |
| 965 |
<?php |
| 966 |
elseif ( 'acting_welcart_unionpay' === $acting_flg ) : |
| 967 |
?> |
| 968 |
getSettlementInfoUnionPay : function() { |
| 969 |
$("#settlement-response").html(""); |
| 970 |
$("#settlement-response-loading").html('<img src="'+uscesL10n.USCES_PLUGIN_URL+'/images/loading.gif" />'); |
| 971 |
var mode = ( "" != $("#error").val() ) ? "error_welcartpay_unionpay" : "get_welcartpay_unionpay"; |
| 972 |
$.ajax({ |
| 973 |
url: ajaxurl, |
| 974 |
type: "POST", |
| 975 |
cache: false, |
| 976 |
dataType: 'json', |
| 977 |
data: { |
| 978 |
action: "usces_admin_ajax", |
| 979 |
mode: mode, |
| 980 |
order_id: $("#order_id").val(), |
| 981 |
order_num: $("#order_num").val(), |
| 982 |
trans_id: $("#trans_id").val(), |
| 983 |
member_id: $("#member_id").val(), |
| 984 |
wc_nonce: $("#wc_nonce").val() |
| 985 |
} |
| 986 |
}).done( function(retVal,dataType) { |
| 987 |
$("#settlement-response").html(retVal.result); |
| 988 |
$("#settlement-response-loading").html(""); |
| 989 |
}).fail( function(retVal) { |
| 990 |
$("#settlement-response-loading").html(""); |
| 991 |
}); |
| 992 |
return false; |
| 993 |
}, |
| 994 |
deleteSettlementUnionPay : function() { |
| 995 |
$("#settlement-response").html(""); |
| 996 |
$("#settlement-response-loading").html('<img src="'+uscesL10n.USCES_PLUGIN_URL+'/images/loading.gif" />'); |
| 997 |
$.ajax({ |
| 998 |
url: ajaxurl, |
| 999 |
type: "POST", |
| 1000 |
cache: false, |
| 1001 |
dataType: 'json', |
| 1002 |
data: { |
| 1003 |
action: "usces_admin_ajax", |
| 1004 |
mode: "delete_welcartpay_unionpay", |
| 1005 |
order_id: $("#order_id").val(), |
| 1006 |
order_num: $("#order_num").val(), |
| 1007 |
trans_id: $("#trans_id").val(), |
| 1008 |
member_id: $("#member_id").val(), |
| 1009 |
wc_nonce: $("#wc_nonce").val() |
| 1010 |
} |
| 1011 |
}).done( function(retVal,dataType) { |
| 1012 |
$("#settlement-response").html(retVal.result); |
| 1013 |
if( retVal.status == "OK" ) { |
| 1014 |
$("#settlement-status").html(retVal.acting_status); |
| 1015 |
$("#responsecd-"+$("#trans_id").val()+"-"+$("#order_num").val()).val(""); |
| 1016 |
} else { |
| 1017 |
$("#responsecd-"+$("#trans_id").val()+"-"+$("#order_num").val()).val(retVal.status); |
| 1018 |
} |
| 1019 |
$("#settlement-response-loading").html(""); |
| 1020 |
}).fail( function(retVal) { |
| 1021 |
$("#settlement-response-loading").html(""); |
| 1022 |
}); |
| 1023 |
return false; |
| 1024 |
} |
| 1025 |
<?php |
| 1026 |
endif; |
| 1027 |
?> |
| 1028 |
}; |
| 1029 |
|
| 1030 |
$("#settlement_dialog").dialog({ |
| 1031 |
bgiframe: true, |
| 1032 |
autoOpen: false, |
| 1033 |
height: "auto", |
| 1034 |
width: 800, |
| 1035 |
resizable: true, |
| 1036 |
modal: true, |
| 1037 |
buttons: { |
| 1038 |
"<?php esc_attr_e( 'Close' ); ?>": function() { |
| 1039 |
$(this).dialog("close"); |
| 1040 |
} |
| 1041 |
}, |
| 1042 |
open: function() { |
| 1043 |
<?php |
| 1044 |
if ( 'acting_welcart_card' === $acting_flg ) : |
| 1045 |
?> |
| 1046 |
adminOrderEdit.getSettlementInfoCard(); |
| 1047 |
<?php |
| 1048 |
elseif ( 'acting_welcart_conv' === $acting_flg ) : |
| 1049 |
?> |
| 1050 |
adminOrderEdit.getSettlementInfoConv(); |
| 1051 |
<?php |
| 1052 |
elseif ( 'acting_welcart_unionpay' === $acting_flg ) : |
| 1053 |
?> |
| 1054 |
adminOrderEdit.getSettlementInfoUnionPay(); |
| 1055 |
<?php |
| 1056 |
endif; |
| 1057 |
?> |
| 1058 |
}, |
| 1059 |
close: function() { |
| 1060 |
<?php do_action( 'usces_action_welcartpay_settlement_dialog_close', $args ); ?> |
| 1061 |
} |
| 1062 |
}); |
| 1063 |
|
| 1064 |
$(document).on( "click", ".settlement-information", function() { |
| 1065 |
var idname = $(this).attr("id"); |
| 1066 |
var ids = idname.split("-"); |
| 1067 |
$("#trans_id").val(ids[2]); |
| 1068 |
$("#order_num").val(ids[3]); |
| 1069 |
if( undefined != $("#responsecd-"+ids[2]+"-"+ids[3]) ) { |
| 1070 |
$("#error").val($("#responsecd-"+ids[2]+"-"+ids[3]).val()); |
| 1071 |
} else { |
| 1072 |
$("#error").val(""); |
| 1073 |
} |
| 1074 |
$("#settlement_dialog").dialog("option","title","<?php echo esc_attr( $dialog_title ); ?>"); |
| 1075 |
$("#settlement_dialog").dialog("open"); |
| 1076 |
}); |
| 1077 |
|
| 1078 |
<?php |
| 1079 |
if ( 'acting_welcart_card' === $acting_flg ) : |
| 1080 |
?> |
| 1081 |
$(document).on( "click", "#capture-settlement", function() { |
| 1082 |
if( !confirm("<?php esc_attr_e( 'Are you sure you want to execute sales accounting processing?', 'usces' ); ?>") ) { |
| 1083 |
return; |
| 1084 |
} |
| 1085 |
adminOrderEdit.captureSettlementCard($("#amount_change").val()); |
| 1086 |
}); |
| 1087 |
|
| 1088 |
$(document).on( "click", "#delete-settlement", function() { |
| 1089 |
if( !confirm("<?php esc_attr_e( 'Are you sure you want to cancellation processing?', 'usces' ); ?>") ) { |
| 1090 |
return; |
| 1091 |
} |
| 1092 |
adminOrderEdit.deleteSettlementCard($("#amount_change").val()); |
| 1093 |
}); |
| 1094 |
|
| 1095 |
$(document).on( "click", "#change-settlement", function() { |
| 1096 |
if( $("#amount_change").val() == $("#amount").val() ) { |
| 1097 |
return; |
| 1098 |
} |
| 1099 |
var amount = $("#amount_change").val(); |
| 1100 |
if( amount == "" || parseInt(amount) === 0 || !checkNum(amount) ) { |
| 1101 |
alert("<?php esc_attr_e( 'The spending amount format is incorrect. Please enter with numeric value.', 'usces' ); ?>"); |
| 1102 |
return; |
| 1103 |
} |
| 1104 |
if( !confirm("<?php esc_attr_e( 'Are you sure you want to change the spending amount?', 'usces' ); ?>") ) { |
| 1105 |
return; |
| 1106 |
} |
| 1107 |
adminOrderEdit.changeSettlementCard($("#amount_change").val()); |
| 1108 |
}); |
| 1109 |
|
| 1110 |
$(document).on( "click", "#auth-settlement", function() { |
| 1111 |
var amount = $("#amount_change").val(); |
| 1112 |
if( amount == "" || parseInt(amount) === 0 || !checkNum(amount) ) { |
| 1113 |
alert("<?php esc_attr_e( 'The spending amount format is incorrect. Please enter with numeric value.', 'usces' ); ?>"); |
| 1114 |
return; |
| 1115 |
} |
| 1116 |
if( !confirm("<?php esc_attr_e( 'Are you sure you want to execute credit processing?', 'usces' ); ?>") ) { |
| 1117 |
return; |
| 1118 |
} |
| 1119 |
adminOrderEdit.authSettlementCard("auth",$("#amount_change").val()); |
| 1120 |
}); |
| 1121 |
|
| 1122 |
$(document).on( "click", "#gathering-settlement", function() { |
| 1123 |
var amount = $("#amount_change").val(); |
| 1124 |
if( amount == "" || parseInt(amount) === 0 || !checkNum(amount) ) { |
| 1125 |
alert("<?php esc_attr_e( 'The spending amount format is incorrect. Please enter with numeric value.', 'usces' ); ?>"); |
| 1126 |
return; |
| 1127 |
} |
| 1128 |
if( !confirm("<?php esc_attr_e( 'Are you sure you want to execute credit sales processing?', 'usces' ); ?>") ) { |
| 1129 |
return; |
| 1130 |
} |
| 1131 |
adminOrderEdit.authSettlementCard("gathering",$("#amount_change").val()); |
| 1132 |
}); |
| 1133 |
|
| 1134 |
$(document).on( "click", "#reauth-settlement", function() { |
| 1135 |
var amount = $("#amount_change").val(); |
| 1136 |
if( amount == "" || parseInt(amount) === 0 || !checkNum(amount) ) { |
| 1137 |
alert("<?php esc_attr_e( 'The spending amount format is incorrect. Please enter with numeric value.', 'usces' ); ?>"); |
| 1138 |
return; |
| 1139 |
} |
| 1140 |
if( !confirm("<?php esc_attr_e( 'Are you sure you want to re-authorization?', 'usces' ); ?>") ) { |
| 1141 |
return; |
| 1142 |
} |
| 1143 |
adminOrderEdit.authSettlementCard("reauth",$("#amount_change").val()); |
| 1144 |
}); |
| 1145 |
|
| 1146 |
<?php |
| 1147 |
elseif ( 'acting_welcart_conv' === $acting_flg ) : |
| 1148 |
?> |
| 1149 |
$(document).on( "click", "#delete-settlement", function() { |
| 1150 |
if( !confirm("<?php esc_attr_e( 'Are you sure you want to cancellation processing?', 'usces' ); ?>") ) { |
| 1151 |
return; |
| 1152 |
} |
| 1153 |
adminOrderEdit.deleteSettlementConv($("#amount_change").val()); |
| 1154 |
}); |
| 1155 |
|
| 1156 |
$(document).on( "click", "#change-settlement", function() { |
| 1157 |
if( ( $("#paylimit_change").val() == $("#paylimit").val() ) && |
| 1158 |
( $("#amount_change").val() == $("#amount").val() ) ) { |
| 1159 |
return; |
| 1160 |
} |
| 1161 |
var paylimit = $("#paylimit_change").val(); |
| 1162 |
var amount = $("#amount_change").val(); |
| 1163 |
var today = "<?php echo esc_attr( $this->get_transaction_date() ); ?>"; |
| 1164 |
if( paylimit.length != 8 || !checkNum(paylimit) ) { |
| 1165 |
alert("<?php esc_attr_e( 'The payment due format is incorrect. Please enter with 8 digit number.', 'usces' ); ?>"); |
| 1166 |
return; |
| 1167 |
} |
| 1168 |
if( today > paylimit ) { |
| 1169 |
alert("<?php esc_attr_e( 'The payment due is incorrect. Date before today cannot be specified.', 'usces' ); ?>"); |
| 1170 |
return; |
| 1171 |
} |
| 1172 |
if( amount == "" || parseInt( amount ) === 0 || !checkNum( amount ) ) { |
| 1173 |
alert("<?php esc_attr_e( 'The payment amount format is incorrect. Please enter with numeric value.', 'usces' ); ?>"); |
| 1174 |
return; |
| 1175 |
} |
| 1176 |
if( !confirm("<?php esc_attr_e( 'Are you sure you want to change payment due and payment amount?', 'usces' ); ?>") ) { |
| 1177 |
return; |
| 1178 |
} |
| 1179 |
adminOrderEdit.changeSettlementConv($("#paylimit_change").val(),$("#amount_change").val()); |
| 1180 |
}); |
| 1181 |
|
| 1182 |
$(document).on( "click", "#add-settlement", function() { |
| 1183 |
var paylimit = $("#paylimit_change").val(); |
| 1184 |
var amount = $("#amount_change").val(); |
| 1185 |
var today = "<?php echo esc_attr( $this->get_transaction_date() ); ?>"; |
| 1186 |
if( paylimit.length != 8 || !checkNum(paylimit) ) { |
| 1187 |
alert("<?php esc_attr_e( 'The payment due format is incorrect. Please enter with 8 digit number.', 'usces' ); ?>"); |
| 1188 |
return; |
| 1189 |
} |
| 1190 |
if( today > paylimit ) { |
| 1191 |
alert("<?php esc_attr_e( 'The payment due is incorrect. Date before today cannot be specified.', 'usces' ); ?>"); |
| 1192 |
return; |
| 1193 |
} |
| 1194 |
if( amount == "" || parseInt(amount) === 0 || !checkNum(amount) ) { |
| 1195 |
alert("<?php esc_attr_e( 'The payment amount format is incorrect. Please enter with numeric value.', 'usces' ); ?>"); |
| 1196 |
return; |
| 1197 |
} |
| 1198 |
if( !confirm("<?php esc_attr_e( 'Are you sure you want to execute the registration processing?', 'usces' ); ?>") ) { |
| 1199 |
return; |
| 1200 |
} |
| 1201 |
adminOrderEdit.addSettlementConv($("#paylimit_change").val(),$("#amount_change").val()); |
| 1202 |
}); |
| 1203 |
|
| 1204 |
<?php |
| 1205 |
elseif ( 'acting_welcart_unionpay' === $acting_flg ) : |
| 1206 |
?> |
| 1207 |
$(document).on( "click", "#delete-settlement", function() { |
| 1208 |
if( !confirm("<?php esc_attr_e( 'Are you sure you want to cancellation processing?', 'usces' ); ?>") ) { |
| 1209 |
return; |
| 1210 |
} |
| 1211 |
adminOrderEdit.deleteSettlementUnionPay(); |
| 1212 |
}); |
| 1213 |
|
| 1214 |
<?php |
| 1215 |
endif; |
| 1216 |
if ( 'usces_continue' === $admin_page ) : |
| 1217 |
?> |
| 1218 |
adminContinuation = { |
| 1219 |
update : function() { |
| 1220 |
$.ajax({ |
| 1221 |
url: ajaxurl, |
| 1222 |
type: "POST", |
| 1223 |
cache: false, |
| 1224 |
dataType: 'json', |
| 1225 |
data: { |
| 1226 |
action: "usces_admin_ajax", |
| 1227 |
mode: "continuation_update", |
| 1228 |
member_id: $("#member_id").val(), |
| 1229 |
order_id: $("#order_id").val(), |
| 1230 |
contracted_year: $("#contracted-year option:selected").val(), |
| 1231 |
contracted_month: $("#contracted-month option:selected").val(), |
| 1232 |
contracted_day: $("#contracted-day option:selected").val(), |
| 1233 |
charged_year: $("#charged-year option:selected").val(), |
| 1234 |
charged_month: $("#charged-month option:selected").val(), |
| 1235 |
charged_day: $("#charged-day option:selected").val(), |
| 1236 |
price: $("#price").val(), |
| 1237 |
status: $("#dlseller-status").val(), |
| 1238 |
wc_nonce: $("#wc_nonce").val() |
| 1239 |
} |
| 1240 |
}).done( function(retVal,dataType) { |
| 1241 |
if( retVal.status == "OK" ) { |
| 1242 |
adminOperation.setActionStatus("success","<?php esc_attr_e( 'The update was completed.', 'usces' ); ?>"); |
| 1243 |
} else { |
| 1244 |
mes = ( retVal.message != "" ) ? retVal.message : "<?php esc_attr_e( 'failure in update', 'usces' ); ?>"; |
| 1245 |
adminOperation.setActionStatus("error",mes); |
| 1246 |
} |
| 1247 |
}).fail( function(retVal) { |
| 1248 |
adminOperation.setActionStatus("error","<?php esc_attr_e( 'failure in update', 'usces' ); ?>"); |
| 1249 |
}); |
| 1250 |
return false; |
| 1251 |
} |
| 1252 |
}; |
| 1253 |
|
| 1254 |
$("#price").bind( "change", function() { |
| 1255 |
usces_check_money($(this)); |
| 1256 |
}); |
| 1257 |
|
| 1258 |
$(document).on( "click", "#continuation-update", function() { |
| 1259 |
var status = $("#dlseller-status option:selected").val(); |
| 1260 |
if( status == "continuation" ) { |
| 1261 |
var year = $("#charged-year option:selected").val(); |
| 1262 |
var month = $("#charged-month option:selected").val(); |
| 1263 |
var day = $("#charged-day option:selected").val(); |
| 1264 |
if( year == 0 || month == 0 || day == 0 ) { |
| 1265 |
alert("<?php esc_attr_e( 'Data have deficiency.', 'usces' ); ?>"); |
| 1266 |
$("#charged-year").focus(); |
| 1267 |
return; |
| 1268 |
} |
| 1269 |
if( $("#price").val() == "" || parseInt($("#price").val()) == 0 ) { |
| 1270 |
alert("<?php printf( __( 'Input the %s', 'usces' ), esc_attr__( 'Amount', 'dlseller' ) ); ?>"); |
| 1271 |
$("#price").focus(); |
| 1272 |
return; |
| 1273 |
} |
| 1274 |
} |
| 1275 |
if( !confirm("<?php esc_attr_e( 'Are you sure you want to update the settings?', 'usces' ); ?>") ) { |
| 1276 |
return; |
| 1277 |
} |
| 1278 |
adminContinuation.update(); |
| 1279 |
}); |
| 1280 |
<?php |
| 1281 |
endif; |
| 1282 |
?> |
| 1283 |
}); |
| 1284 |
</script> |
| 1285 |
<?php |
| 1286 |
endif; |
| 1287 |
break; |
| 1288 |
endswitch; |
| 1289 |
} |
| 1290 |
|
| 1291 |
/** |
| 1292 |
* 決済オプション登録・更新 |
| 1293 |
* usces_action_admin_settlement_update |
| 1294 |
*/ |
| 1295 |
public function settlement_update() { |
| 1296 |
global $usces; |
| 1297 |
|
| 1298 |
if ( 'welcart' !== filter_input( INPUT_POST, 'acting', FILTER_DEFAULT ) ) { |
| 1299 |
return; |
| 1300 |
} |
| 1301 |
|
| 1302 |
$this->error_mes = ''; |
| 1303 |
$options = get_option( 'usces', array() ); |
| 1304 |
$payment_method = usces_get_system_option( 'usces_payment_method', 'settlement' ); |
| 1305 |
$post_data = wp_unslash( $_POST ); |
| 1306 |
|
| 1307 |
unset( $options['acting_settings']['welcart'] ); |
| 1308 |
$options['acting_settings']['welcart']['merchant_id'] = ( isset( $post_data['merchant_id'] ) ) ? trim( $post_data['merchant_id'] ) : ''; |
| 1309 |
$options['acting_settings']['welcart']['merchant_pass'] = ( isset( $post_data['merchant_pass'] ) ) ? trim( $post_data['merchant_pass'] ) : ''; |
| 1310 |
$options['acting_settings']['welcart']['tenant_id'] = ( isset( $post_data['tenant_id'] ) ) ? trim( $post_data['tenant_id'] ) : '0001'; |
| 1311 |
$options['acting_settings']['welcart']['auth_key'] = ( isset( $post_data['auth_key'] ) ) ? trim( $post_data['auth_key'] ) : ''; |
| 1312 |
$options['acting_settings']['welcart']['ope'] = ( isset( $post_data['ope'] ) ) ? $post_data['ope'] : ''; |
| 1313 |
$options['acting_settings']['welcart']['card_activate'] = ( isset( $post_data['card_activate'] ) ) ? $post_data['card_activate'] : 'off'; |
| 1314 |
$options['acting_settings']['welcart']['card_key_aes'] = ( isset( $post_data['card_key_aes'] ) ) ? $post_data['card_key_aes'] : ''; |
| 1315 |
$options['acting_settings']['welcart']['card_key_iv'] = ( isset( $post_data['card_key_iv'] ) ) ? $post_data['card_key_iv'] : ''; |
| 1316 |
$options['acting_settings']['welcart']['foreign_activate'] = ( isset( $post_data['foreign_activate'] ) ) ? $post_data['foreign_activate'] : ''; |
| 1317 |
$options['acting_settings']['welcart']['seccd'] = ( isset( $post_data['seccd'] ) ) ? $post_data['seccd'] : 'on'; |
| 1318 |
$options['acting_settings']['welcart']['sec3d_activate'] = ( isset( $post_data['sec3d_activate'] ) ) ? $post_data['sec3d_activate'] : 'off'; |
| 1319 |
$options['acting_settings']['welcart']['token_code'] = ( isset( $post_data['token_code'] ) ) ? trim( $post_data['token_code'] ) : ''; |
| 1320 |
$options['acting_settings']['welcart']['quickpay'] = ( isset( $post_data['quickpay'] ) ) ? $post_data['quickpay'] : ''; |
| 1321 |
$options['acting_settings']['welcart']['chooseable_quickpay'] = ( isset( $post_data['chooseable_quickpay'] ) ) ? $post_data['chooseable_quickpay'] : 'on'; |
| 1322 |
$options['acting_settings']['welcart']['operateid'] = ( isset( $post_data['operateid'] ) ) ? $post_data['operateid'] : '1Gathering'; |
| 1323 |
$options['acting_settings']['welcart']['operateid_dlseller'] = ( isset( $post_data['operateid_dlseller'] ) ) ? $post_data['operateid_dlseller'] : '1Gathering'; |
| 1324 |
$options['acting_settings']['welcart']['auto_settlement_mail'] = ( isset( $post_data['auto_settlement_mail'] ) ) ? $post_data['auto_settlement_mail'] : 'off'; |
| 1325 |
$options['acting_settings']['welcart']['howtopay'] = ( isset( $post_data['howtopay'] ) ) ? $post_data['howtopay'] : ''; |
| 1326 |
$options['acting_settings']['welcart']['conv_activate'] = ( isset( $post_data['conv_activate'] ) ) ? $post_data['conv_activate'] : 'off'; |
| 1327 |
$options['acting_settings']['welcart']['conv_limit'] = ( ! empty( $post_data['conv_limit'] ) ) ? $post_data['conv_limit'] : '7'; |
| 1328 |
$options['acting_settings']['welcart']['conv_fee_type'] = ( isset( $post_data['conv_fee_type'] ) ) ? $post_data['conv_fee_type'] : ''; |
| 1329 |
$options['acting_settings']['welcart']['conv_fee'] = ( isset( $post_data['conv_fee'] ) ) ? $post_data['conv_fee'] : ''; |
| 1330 |
$options['acting_settings']['welcart']['conv_fee_limit_amount'] = ( isset( $post_data[ 'conv_fee_limit_amount_' . $options['acting_settings']['welcart']['conv_fee_type'] ] ) ) ? $post_data[ 'conv_fee_limit_amount_' . $options['acting_settings']['welcart']['conv_fee_type'] ] : ''; |
| 1331 |
$options['acting_settings']['welcart']['conv_fee_first_amount'] = ( isset( $post_data['conv_fee_first_amount'] ) ) ? $post_data['conv_fee_first_amount'] : ''; |
| 1332 |
$options['acting_settings']['welcart']['conv_fee_first_fee'] = ( isset( $post_data['conv_fee_first_fee'] ) ) ? $post_data['conv_fee_first_fee'] : ''; |
| 1333 |
$options['acting_settings']['welcart']['conv_fee_amounts'] = ( isset( $post_data['conv_fee_amounts'] ) ) ? explode( '|', $post_data['conv_fee_amounts'] ) : array(); |
| 1334 |
$options['acting_settings']['welcart']['conv_fee_fees'] = ( isset( $post_data['conv_fee_fees'] ) ) ? explode( '|', $post_data['conv_fee_fees'] ) : array(); |
| 1335 |
$options['acting_settings']['welcart']['conv_fee_end_fee'] = ( isset( $post_data['conv_fee_end_fee'] ) ) ? $post_data['conv_fee_end_fee'] : ''; |
| 1336 |
$options['acting_settings']['welcart']['atodene_activate'] = ( isset( $post_data['atodene_activate'] ) ) ? $post_data['atodene_activate'] : 'off'; |
| 1337 |
$options['acting_settings']['welcart']['atodene_byitem'] = ( isset( $post_data['atodene_byitem'] ) ) ? $post_data['atodene_byitem'] : 'off'; |
| 1338 |
$options['acting_settings']['welcart']['atodene_billing_method'] = ( isset( $post_data['atodene_billing_method'] ) ) ? $post_data['atodene_billing_method'] : '2'; |
| 1339 |
$options['acting_settings']['welcart']['atodene_fee_type'] = ( isset( $post_data['atodene_fee_type'] ) ) ? $post_data['atodene_fee_type'] : ''; |
| 1340 |
$options['acting_settings']['welcart']['atodene_fee'] = ( isset( $post_data['atodene_fee'] ) ) ? $post_data['atodene_fee'] : ''; |
| 1341 |
$options['acting_settings']['welcart']['atodene_fee_limit_amount'] = ( isset( $post_data[ 'atodene_fee_limit_amount_' . $options['acting_settings']['welcart']['atodene_fee_type'] ] ) ) ? $post_data[ 'atodene_fee_limit_amount_' . $options['acting_settings']['welcart']['atodene_fee_type'] ] : ''; |
| 1342 |
$options['acting_settings']['welcart']['atodene_fee_first_amount'] = ( isset( $post_data['atodene_fee_first_amount'] ) ) ? $post_data['atodene_fee_first_amount'] : ''; |
| 1343 |
$options['acting_settings']['welcart']['atodene_fee_first_fee'] = ( isset( $post_data['atodene_fee_first_fee'] ) ) ? $post_data['atodene_fee_first_fee'] : ''; |
| 1344 |
$options['acting_settings']['welcart']['atodene_fee_amounts'] = ( isset( $post_data['atodene_fee_amounts'] ) ) ? explode( '|', $post_data['atodene_fee_amounts'] ) : array(); |
| 1345 |
$options['acting_settings']['welcart']['atodene_fee_fees'] = ( isset( $post_data['atodene_fee_fees'] ) ) ? explode( '|', $post_data['atodene_fee_fees'] ) : array(); |
| 1346 |
$options['acting_settings']['welcart']['atodene_fee_end_fee'] = ( isset( $post_data['atodene_fee_end_fee'] ) ) ? $post_data['atodene_fee_end_fee'] : ''; |
| 1347 |
$options['acting_settings']['welcart']['applepay_activate'] = ( isset( $post_data['applepay_activate'] ) ) ? $post_data['applepay_activate'] : 'off'; |
| 1348 |
$options['acting_settings']['welcart']['applepay_tenant_id'] = ( isset( $post_data['applepay_tenant_id'] ) ) ? $post_data['applepay_tenant_id'] : ''; |
| 1349 |
$options['acting_settings']['welcart']['applepay_quickpay'] = ( isset( $post_data['applepay_quickpay'] ) ) ? $post_data['applepay_quickpay'] : ''; |
| 1350 |
$options['acting_settings']['welcart']['applepay_operateid'] = ( isset( $post_data['applepay_operateid'] ) ) ? $post_data['applepay_operateid'] : '1Gathering'; |
| 1351 |
$options['acting_settings']['welcart']['applepay_key_aes'] = ( isset( $post_data['applepay_key_aes'] ) ) ? $post_data['applepay_key_aes'] : ''; |
| 1352 |
$options['acting_settings']['welcart']['applepay_key_iv'] = ( isset( $post_data['applepay_key_iv'] ) ) ? $post_data['applepay_key_iv'] : ''; |
| 1353 |
$options['acting_settings']['welcart']['applepay_certificate_path'] = ( isset( $post_data['applepay_certificate_path'] ) ) ? $post_data['applepay_certificate_path'] : ''; |
| 1354 |
$options['acting_settings']['welcart']['applepay_certificate_key_pass'] = ( isset( $post_data['applepay_certificate_key_pass'] ) ) ? $post_data['applepay_certificate_key_pass'] : ''; |
| 1355 |
$options['acting_settings']['welcart']['applepay_merchantidentifier'] = ( isset( $post_data['applepay_merchantidentifier'] ) ) ? $post_data['applepay_merchantidentifier'] : ''; |
| 1356 |
$options['acting_settings']['welcart']['unionpay_activate'] = ( isset( $post_data['unionpay_activate'] ) ) ? $post_data['unionpay_activate'] : 'off'; |
| 1357 |
$options['acting_settings']['welcart']['unionpay_key_aes'] = ( isset( $post_data['unionpay_key_aes'] ) ) ? $post_data['unionpay_key_aes'] : ''; |
| 1358 |
$options['acting_settings']['welcart']['unionpay_key_iv'] = ( isset( $post_data['unionpay_key_iv'] ) ) ? $post_data['unionpay_key_iv'] : ''; |
| 1359 |
$options['acting_settings']['welcart']['unionpay_pagelanguage'] = ( isset( $post_data['unionpay_pagelanguage'] ) ) ? $post_data['unionpay_pagelanguage'] : ''; |
| 1360 |
|
| 1361 |
if ( 'on' === $options['acting_settings']['welcart']['card_activate'] || 'on' === $options['acting_settings']['welcart']['conv_activate'] ) { |
| 1362 |
$unavailable_activate = false; |
| 1363 |
foreach ( $payment_method as $settlement => $payment ) { |
| 1364 |
if ( in_array( $settlement, $this->unavailable_method, true ) && 'activate' === $payment['use'] ) { |
| 1365 |
$unavailable_activate = true; |
| 1366 |
break; |
| 1367 |
} |
| 1368 |
} |
| 1369 |
if ( $unavailable_activate ) { |
| 1370 |
$this->error_mes .= __( '* Settlement that can not be used together is activated.', 'usces' ) . '<br />'; |
| 1371 |
} else { |
| 1372 |
if ( WCUtils::is_blank( $post_data['merchant_id'] ) ) { |
| 1373 |
$this->error_mes .= __( '* Please enter the Merchant ID.', 'usces' ) . '<br />'; |
| 1374 |
} |
| 1375 |
if ( WCUtils::is_blank( $post_data['merchant_pass'] ) ) { |
| 1376 |
$this->error_mes .= __( '* Please enter the Merchant Password.', 'usces' ) . '<br />'; |
| 1377 |
} |
| 1378 |
if ( WCUtils::is_blank( $post_data['tenant_id'] ) ) { |
| 1379 |
$this->error_mes .= __( '* Please enter the Tenant ID.', 'usces' ) . '<br />'; |
| 1380 |
} |
| 1381 |
if ( WCUtils::is_blank( $post_data['auth_key'] ) ) { |
| 1382 |
$this->error_mes .= __( '* Please enter the Settlement auth key.', 'usces' ) . '<br />'; |
| 1383 |
} else { |
| 1384 |
$auth_key = md5( $post_data['auth_key'] ); |
| 1385 |
$welcartpay_keys = get_option( 'usces_welcartpay_keys', array() ); |
| 1386 |
if ( ! in_array( $auth_key, $welcartpay_keys, true ) ) { |
| 1387 |
$this->error_mes .= __( '* The Settlement auth key is incorrect.', 'usces' ) . '<br />'; |
| 1388 |
} |
| 1389 |
} |
| 1390 |
if ( WCUtils::is_blank( $post_data['ope'] ) ) { |
| 1391 |
$this->error_mes .= __( '* Please select the operating environment.', 'usces' ) . '<br />'; |
| 1392 |
} |
| 1393 |
if ( WCUtils::is_blank( $post_data['operateid'] ) ) { |
| 1394 |
$this->error_mes .= __( '* Please select the processing classification.', 'usces' ) . '<br />'; |
| 1395 |
} |
| 1396 |
if ( 'on' === $options['acting_settings']['welcart']['card_activate'] ) { |
| 1397 |
if ( WCUtils::is_blank( $post_data['token_code'] ) ) { |
| 1398 |
$this->error_mes .= __( '* Please enter the Token auth code.', 'usces' ) . '<br />'; |
| 1399 |
} |
| 1400 |
} |
| 1401 |
} |
| 1402 |
} |
| 1403 |
if ( 'on' === $options['acting_settings']['welcart']['unionpay_activate'] ) { |
| 1404 |
if ( WCUtils::is_blank( $post_data['unionpay_key_aes'] ) ) { |
| 1405 |
$this->error_mes .= __( '* Please enter the UnionPay tripartite encryption key.', 'usces' ) . '<br />'; |
| 1406 |
} |
| 1407 |
if ( WCUtils::is_blank( $post_data['unionpay_key_iv'] ) ) { |
| 1408 |
$this->error_mes .= __( '* Please enter the UnionPay tripartite initialization vector.', 'usces' ) . '<br />'; |
| 1409 |
} |
| 1410 |
} |
| 1411 |
|
| 1412 |
if ( '' === $this->error_mes ) { |
| 1413 |
$usces->action_status = 'success'; |
| 1414 |
$usces->action_message = __( 'Options are updated.', 'usces' ); |
| 1415 |
if ( ( 'on' === $options['acting_settings']['welcart']['card_activate'] || 'link' === $options['acting_settings']['welcart']['card_activate'] || 'token' === $options['acting_settings']['welcart']['card_activate'] ) || |
| 1416 |
'on' === $options['acting_settings']['welcart']['conv_activate'] || |
| 1417 |
'on' === $options['acting_settings']['welcart']['atodene_activate'] || |
| 1418 |
'on' === $options['acting_settings']['welcart']['applepay_activate'] || |
| 1419 |
'on' === $options['acting_settings']['welcart']['unionpay_activate'] ) { |
| 1420 |
$options['acting_settings']['welcart']['activate'] = 'on'; |
| 1421 |
if ( 'public' === $options['acting_settings']['welcart']['ope'] ) { |
| 1422 |
$options['acting_settings']['welcart']['send_url'] = 'https://www.e-scott.jp/online/aut/OAUT002.do'; |
| 1423 |
$options['acting_settings']['welcart']['send_url_member'] = 'https://www.e-scott.jp/online/crp/OCRP005.do'; |
| 1424 |
$options['acting_settings']['welcart']['send_url_conv'] = 'https://www.e-scott.jp/online/cnv/OCNV005.do'; |
| 1425 |
$options['acting_settings']['welcart']['redirect_url_conv'] = 'https://link.kessai.info/JLP/JLPcon'; |
| 1426 |
$options['acting_settings']['welcart']['send_url_link'] = 'https://www.e-scott.jp/euser/snp/SSNP005ReferStart.do'; |
| 1427 |
$options['acting_settings']['welcart']['api_token'] = 'https://www.e-scott.jp/euser/stn/CdGetJavaScript.do'; |
| 1428 |
$options['acting_settings']['welcart']['send_url_token'] = 'https://www.e-scott.jp/online/atn/OATN005.do'; |
| 1429 |
$options['acting_settings']['welcart']['send_url_3dsecure'] = 'https://www.e-scott.jp/online/tds/OTDS010.do'; |
| 1430 |
$options['acting_settings']['welcart']['send_url_applepay'] = 'https://www.e-scott.jp/online/aut/OAUT002.do'; |
| 1431 |
$options['acting_settings']['welcart']['send_url_applepay_member'] = 'https://www.e-scott.jp/online/crp/OCRP005.do'; |
| 1432 |
$options['acting_settings']['welcart']['send_url_unionpay'] = 'https://www.e-scott.jp/online/agc/OAGC010.do'; |
| 1433 |
} else { |
| 1434 |
$options['acting_settings']['welcart']['send_url'] = 'https://www.test.e-scott.jp/online/aut/OAUT002.do'; |
| 1435 |
$options['acting_settings']['welcart']['send_url_member'] = 'https://www.test.e-scott.jp/online/crp/OCRP005.do'; |
| 1436 |
$options['acting_settings']['welcart']['send_url_conv'] = 'https://www.test.e-scott.jp/online/cnv/OCNV005.do'; |
| 1437 |
$options['acting_settings']['welcart']['redirect_url_conv'] = 'https://link.kessai.info/JLPCT/JLPcon'; |
| 1438 |
$options['acting_settings']['welcart']['send_url_link'] = 'https://www.test.e-scott.jp/euser/snp/SSNP005ReferStart.do'; |
| 1439 |
$options['acting_settings']['welcart']['api_token'] = 'https://www.test.e-scott.jp/euser/stn/CdGetJavaScript.do'; |
| 1440 |
$options['acting_settings']['welcart']['send_url_token'] = 'https://www.test.e-scott.jp/online/atn/OATN005.do'; |
| 1441 |
$options['acting_settings']['welcart']['send_url_3dsecure'] = 'https://www.test.e-scott.jp/online/tds/OTDS010.do'; |
| 1442 |
$options['acting_settings']['welcart']['send_url_applepay'] = 'https://www.test.e-scott.jp/online/aut/OAUT002.do'; |
| 1443 |
$options['acting_settings']['welcart']['send_url_applepay_member'] = 'https://www.test.e-scott.jp/online/crp/OCRP005.do'; |
| 1444 |
$options['acting_settings']['welcart']['send_url_unionpay'] = 'https://www.test.e-scott.jp/online/agc/OAGC010.do'; |
| 1445 |
$options['acting_settings']['welcart']['tenant_id'] = '0001'; |
| 1446 |
} |
| 1447 |
$toactive = array(); |
| 1448 |
if ( 'on' === $options['acting_settings']['welcart']['card_activate'] ) { |
| 1449 |
if ( ! empty( $options['acting_settings']['welcart']['token_code'] ) ) { |
| 1450 |
$options['acting_settings']['welcart']['card_activate'] = 'token'; |
| 1451 |
} |
| 1452 |
} |
| 1453 |
if ( 'on' === $options['acting_settings']['welcart']['card_activate'] || 'link' === $options['acting_settings']['welcart']['card_activate'] || 'token' === $options['acting_settings']['welcart']['card_activate'] ) { |
| 1454 |
$usces->payment_structure['acting_welcart_card'] = __( 'Credit card transaction (WelcartPay)', 'usces' ); |
| 1455 |
foreach ( $payment_method as $settlement => $payment ) { |
| 1456 |
if ( 'acting_welcart_card' === $settlement && 'deactivate' === $payment['use'] ) { |
| 1457 |
$toactive[] = $payment['name']; |
| 1458 |
} |
| 1459 |
} |
| 1460 |
} else { |
| 1461 |
unset( $usces->payment_structure['acting_welcart_card'] ); |
| 1462 |
} |
| 1463 |
if ( 'on' === $options['acting_settings']['welcart']['conv_activate'] ) { |
| 1464 |
$usces->payment_structure['acting_welcart_conv'] = __( 'Online storage agency (WelcartPay)', 'usces' ); |
| 1465 |
foreach ( $payment_method as $settlement => $payment ) { |
| 1466 |
if ( 'acting_welcart_conv' === $settlement && 'deactivate' === $payment['use'] ) { |
| 1467 |
$toactive[] = $payment['name']; |
| 1468 |
} |
| 1469 |
} |
| 1470 |
} else { |
| 1471 |
unset( $usces->payment_structure['acting_welcart_conv'] ); |
| 1472 |
} |
| 1473 |
if ( 'on' === $options['acting_settings']['welcart']['atodene_activate'] ) { |
| 1474 |
$usces->payment_structure['acting_welcart_atodene'] = __( 'Postpay settlement (WelcartPay/ATODENE)', 'usces' ); |
| 1475 |
foreach ( $payment_method as $settlement => $payment ) { |
| 1476 |
if ( 'acting_welcart_atodene' === $settlement && 'deactivate' === $payment['use'] ) { |
| 1477 |
$toactive[] = $payment['name']; |
| 1478 |
} |
| 1479 |
} |
| 1480 |
} else { |
| 1481 |
unset( $usces->payment_structure['acting_welcart_atodene'] ); |
| 1482 |
} |
| 1483 |
if ( 'on' === $options['acting_settings']['welcart']['unionpay_activate'] ) { |
| 1484 |
$usces->payment_structure['acting_welcart_unionpay'] = __( 'UnionPay (WelcartPay)', 'usces' ); |
| 1485 |
foreach ( $payment_method as $settlement => $payment ) { |
| 1486 |
if ( 'acting_welcart_unionpay' === $settlement && 'deactivate' === $payment['use'] ) { |
| 1487 |
$toactive[] = $payment['name']; |
| 1488 |
} |
| 1489 |
} |
| 1490 |
} else { |
| 1491 |
unset( $usces->payment_structure['acting_welcart_unionpay'] ); |
| 1492 |
} |
| 1493 |
usces_admin_orderlist_show_wc_trans_id(); |
| 1494 |
if ( 0 < count( $toactive ) ) { |
| 1495 |
$usces->action_message .= __( 'Please update the payment method to "Activate". <a href="admin.php?page=usces_initial#payment_method_setting">General Setting > Payment Methods</a>', 'usces' ); |
| 1496 |
} |
| 1497 |
} else { |
| 1498 |
$options['acting_settings']['welcart']['activate'] = 'off'; |
| 1499 |
unset( $usces->payment_structure['acting_welcart_card'] ); |
| 1500 |
unset( $usces->payment_structure['acting_welcart_conv'] ); |
| 1501 |
unset( $usces->payment_structure['acting_welcart_atodene'] ); |
| 1502 |
unset( $usces->payment_structure['acting_welcart_applepay'] ); |
| 1503 |
unset( $usces->payment_structure['acting_welcart_unionpay'] ); |
| 1504 |
} |
| 1505 |
$deactivate = array(); |
| 1506 |
foreach ( $payment_method as $settlement => $payment ) { |
| 1507 |
if ( ! array_key_exists( $settlement, $usces->payment_structure ) ) { |
| 1508 |
if ( 'deactivate' !== $payment['use'] ) { |
| 1509 |
$payment['use'] = 'deactivate'; |
| 1510 |
$deactivate[] = $payment['name']; |
| 1511 |
usces_update_system_option( 'usces_payment_method', $payment['id'], $payment ); |
| 1512 |
} |
| 1513 |
} |
| 1514 |
} |
| 1515 |
if ( 0 < count( $deactivate ) ) { |
| 1516 |
$deactivate_message = sprintf( __( '"Deactivate" %s of payment method.', 'usces' ), implode( ',', $deactivate ) ); |
| 1517 |
$usces->action_message .= $deactivate_message; |
| 1518 |
} |
| 1519 |
} else { |
| 1520 |
$usces->action_status = 'error'; |
| 1521 |
$usces->action_message = __( 'Data have deficiency.', 'usces' ); |
| 1522 |
$options['acting_settings']['welcart']['activate'] = 'off'; |
| 1523 |
unset( $usces->payment_structure['acting_welcart_card'] ); |
| 1524 |
unset( $usces->payment_structure['acting_welcart_conv'] ); |
| 1525 |
unset( $usces->payment_structure['acting_welcart_atodene'] ); |
| 1526 |
unset( $usces->payment_structure['acting_welcart_applepay'] ); |
| 1527 |
unset( $usces->payment_structure['acting_welcart_unionpay'] ); |
| 1528 |
$deactivate = array(); |
| 1529 |
foreach ( $payment_method as $settlement => $payment ) { |
| 1530 |
if ( in_array( $settlement, $this->pay_method, true ) ) { |
| 1531 |
if ( 'deactivate' !== $payment['use'] ) { |
| 1532 |
$payment['use'] = 'deactivate'; |
| 1533 |
$deactivate[] = $payment['name']; |
| 1534 |
usces_update_system_option( 'usces_payment_method', $payment['id'], $payment ); |
| 1535 |
} |
| 1536 |
} |
| 1537 |
} |
| 1538 |
if ( 0 < count( $deactivate ) ) { |
| 1539 |
$deactivate_message = sprintf( __( '"Deactivate" %s of payment method.', 'usces' ), implode( ',', $deactivate ) ); |
| 1540 |
$usces->action_message .= $deactivate_message . __( 'Please complete the setup and update the payment method to "Activate".', 'usces' ); |
| 1541 |
} |
| 1542 |
} |
| 1543 |
ksort( $usces->payment_structure ); |
| 1544 |
update_option( 'usces', $options ); |
| 1545 |
update_option( 'usces_payment_structure', $usces->payment_structure ); |
| 1546 |
} |
| 1547 |
|
| 1548 |
/** |
| 1549 |
* クレジット決済設定画面フォーム |
| 1550 |
* usces_action_settlement_tab_body |
| 1551 |
*/ |
| 1552 |
public function settlement_tab_body() { |
| 1553 |
$acting_opts = $this->get_acting_settings(); |
| 1554 |
$settlement_selected = get_option( 'usces_settlement_selected', array() ); |
| 1555 |
if ( in_array( 'welcart', $settlement_selected, true ) ) : |
| 1556 |
$ope = ( isset( $acting_opts['ope'] ) && 'public' === $acting_opts['ope'] ) ? 'public' : 'test'; |
| 1557 |
$card_activate = ( isset( $acting_opts['card_activate'] ) && ( 'on' === $acting_opts['card_activate'] || 'token' === $acting_opts['card_activate'] ) ) ? 'on' : $acting_opts['card_activate']; |
| 1558 |
$sec3d_activate = ( isset( $acting_opts['sec3d_activate'] ) && 'on' === $acting_opts['sec3d_activate'] ) ? 'on' : 'off'; |
| 1559 |
$seccd = ( isset( $acting_opts['seccd'] ) && 'on' === $acting_opts['seccd'] ) ? 'on' : 'off'; |
| 1560 |
$quickpay = ( isset( $acting_opts['quickpay'] ) && 'on' === $acting_opts['quickpay'] ) ? 'on' : 'off'; |
| 1561 |
$chooseable_quickpay = ( isset( $acting_opts['chooseable_quickpay'] ) && 'on' === $acting_opts['chooseable_quickpay'] ) ? 'on' : 'off'; |
| 1562 |
$operateid = ( isset( $acting_opts['operateid'] ) ) ? $acting_opts['operateid'] : '1Gathering'; |
| 1563 |
if ( defined( 'WCEX_DLSELLER' ) ) { |
| 1564 |
$operateid_dlseller = ( isset( $acting_opts['operateid_dlseller'] ) ) ? $acting_opts['operateid_dlseller'] : '1Gathering'; |
| 1565 |
$auto_settlement_mail = ( isset( $acting_opts['auto_settlement_mail'] ) && 'on' === $acting_opts['auto_settlement_mail'] ) ? 'on' : 'off'; |
| 1566 |
} |
| 1567 |
$howtopay = ( isset( $acting_opts['howtopay'] ) ) ? $acting_opts['howtopay'] : '1'; |
| 1568 |
$conv_activate = ( isset( $acting_opts['conv_activate'] ) && 'on' === $acting_opts['conv_activate'] ) ? 'on' : 'off'; |
| 1569 |
$atodene_activate = ( isset( $acting_opts['atodene_activate'] ) && 'on' === $acting_opts['atodene_activate'] ) ? 'on' : 'off'; |
| 1570 |
$atodene_byitem = ( isset( $acting_opts['atodene_byitem'] ) && 'on' === $acting_opts['atodene_byitem'] ) ? 'on' : 'off'; |
| 1571 |
$atodene_billing_method = ( isset( $acting_opts['atodene_billing_method'] ) ) ? $acting_opts['atodene_billing_method'] : '2'; |
| 1572 |
$unionpay_activate = ( isset( $acting_opts['unionpay_activate'] ) && 'on' === $acting_opts['unionpay_activate'] ) ? 'on' : 'off'; |
| 1573 |
?> |
| 1574 |
<div id="uscestabs_welcart"> |
| 1575 |
<div class="settlement_service"><span class="service_title"><?php esc_html_e( 'WelcartPay', 'usces' ); ?></span></div> |
| 1576 |
<?php |
| 1577 |
if ( 'welcart' === filter_input( INPUT_POST, 'acting', FILTER_DEFAULT ) ) : |
| 1578 |
if ( '' !== $this->error_mes ) : |
| 1579 |
?> |
| 1580 |
<div class="error_message"><?php echo wp_kses_post( $this->error_mes ); ?></div> |
| 1581 |
<?php |
| 1582 |
elseif ( isset( $acting_opts['activate'] ) && 'on' === $acting_opts['activate'] ) : |
| 1583 |
?> |
| 1584 |
<div class="message"><?php esc_html_e( 'Test thoroughly before use.', 'usces' ); ?></div> |
| 1585 |
<?php |
| 1586 |
endif; |
| 1587 |
endif; |
| 1588 |
?> |
| 1589 |
<form action="" method="post" name="welcart_form" id="welcart_form"> |
| 1590 |
<table class="settle_table"> |
| 1591 |
<tr> |
| 1592 |
<th><a class="explanation-label" id="label_ex_merchant_id_welcart"><?php esc_html_e( 'Merchant ID', 'usces' ); /* マーチャントID */ ?></a></th> |
| 1593 |
<td><input name="merchant_id" type="text" id="merchant_id_welcart" value="<?php echo esc_attr( $acting_opts['merchant_id'] ); ?>" class="regular-text" /></td> |
| 1594 |
</tr> |
| 1595 |
<tr id="ex_merchant_id_welcart" class="explanation"><td colspan="2"><?php esc_html_e( 'Merchant ID (single-byte numbers only) issued from e-SCOTT.', 'usces' ); ?></td></tr> |
| 1596 |
<tr> |
| 1597 |
<th><a class="explanation-label" id="label_ex_merchant_pass_welcart"><?php esc_html_e( 'Merchant Password', 'usces' ); /* マーチャントパスワード */ ?></a></th> |
| 1598 |
<td><input name="merchant_pass" type="text" id="merchant_pass_welcart" value="<?php echo esc_attr( $acting_opts['merchant_pass'] ); ?>" class="regular-text" /></td> |
| 1599 |
</tr> |
| 1600 |
<tr id="ex_merchant_pass_welcart" class="explanation"><td colspan="2"><?php esc_html_e( 'Merchant Password (single-byte alphanumeric characters only) issued from e-SCOTT.', 'usces' ); ?></td></tr> |
| 1601 |
<tr> |
| 1602 |
<th><a class="explanation-label" id="label_ex_tenant_id_welcart"><?php esc_html_e( 'Tenant ID', 'usces' ); /* 店舗コード */ ?></a></th> |
| 1603 |
<td><input name="tenant_id" type="text" id="tenant_id_welcart" value="<?php echo esc_attr( $acting_opts['tenant_id'] ); ?>" class="regular-text" /></td> |
| 1604 |
</tr> |
| 1605 |
<tr id="ex_tenant_id_welcart" class="explanation"><td colspan="2"><?php echo wp_kses_post( __( 'Tenant ID issued from e-SCOTT.<br />If you have only one shop to contract, enter 0001.', 'usces' ) ); ?></td></tr> |
| 1606 |
<tr> |
| 1607 |
<th><a class="explanation-label" id="label_ex_auth_key_welcart"><?php esc_html_e( 'Settlement auth key', 'usces' ); /* 決済認証キー */ ?></a></th> |
| 1608 |
<td><input name="auth_key" type="text" id="auth_key_welcart" value="<?php echo esc_attr( $acting_opts['auth_key'] ); ?>" class="regular-text" /></td> |
| 1609 |
</tr> |
| 1610 |
<tr id="ex_auth_key_welcart" class="explanation"><td colspan="2"><?php esc_html_e( 'Settlement auth key (single-byte numbers only) issued from e-SCOTT.', 'usces' ); ?></td></tr> |
| 1611 |
<tr> |
| 1612 |
<th><a class="explanation-label" id="label_ex_ope_welcart"><?php esc_html_e( 'Operation Environment', 'usces' ); /* 動作環境 */ ?></a></th> |
| 1613 |
<td><label><input name="ope" type="radio" id="ope_welcart_1" value="test"<?php checked( $ope, 'test' ); ?> /><span><?php esc_html_e( 'Testing environment', 'usces' ); ?></span></label><br /> |
| 1614 |
<label><input name="ope" type="radio" id="ope_welcart_2" value="public"<?php checked( $ope, 'public' ); ?> /><span><?php esc_html_e( 'Production environment', 'usces' ); ?></span></label> |
| 1615 |
</td> |
| 1616 |
</tr> |
| 1617 |
<tr id="ex_ope_welcart" class="explanation"><td colspan="2"><?php esc_html_e( 'Switch the operating environment.', 'usces' ); ?></td></tr> |
| 1618 |
</table> |
| 1619 |
<table class="settle_table"> |
| 1620 |
<tr> |
| 1621 |
<th><?php esc_html_e( 'Credit card settlement', 'usces' ); /* クレジットカード決済 */ ?></th> |
| 1622 |
<td><label><input name="card_activate" type="radio" class="card_activate_welcart" id="card_activate_welcart_1" value="on"<?php checked( $card_activate, 'on' ); ?> /><span><?php esc_html_e( 'Use with non-passage type', 'usces' ); ?></span></label><br /> |
| 1623 |
<label><input name="card_activate" type="radio" class="card_activate_welcart" id="card_activate_welcart_2" value="link"<?php checked( $card_activate, 'link' ); ?> /><span><?php esc_html_e( 'Use with external link type', 'usces' ); ?></span></label><br /> |
| 1624 |
<label><input name="card_activate" type="radio" class="card_activate_welcart" id="card_activate_welcart_0" value="off"<?php checked( $card_activate, 'off' ); ?> /><span><?php esc_html_e( 'Do not Use', 'usces' ); ?></span></label> |
| 1625 |
</td> |
| 1626 |
</tr> |
| 1627 |
<tr class="card_sec3d_welcart"> |
| 1628 |
<th><a class="explanation-label" id="label_ex_sec3d_activate"><?php esc_html_e( '3D Secure', 'usces' ); /* 3Dセキュア */ ?></a></th> |
| 1629 |
<td><label><input name="sec3d_activate" type="radio" class="sec3d_activate_welcart" id="sec3d_activate_1" value="on"<?php checked( $sec3d_activate, 'on' ); ?> /><span><?php esc_html_e( 'Use', 'usces' ); ?></span></label><br /> |
| 1630 |
<label><input name="sec3d_activate" type="radio" class="sec3d_activate_welcart" id="sec3d_activate_0" value="off"<?php checked( $sec3d_activate, 'off' ); ?> /><span><?php esc_html_e( 'Do not Use', 'usces' ); ?></span></label> |
| 1631 |
</td> |
| 1632 |
</tr> |
| 1633 |
<tr id="ex_sec3d_activate" class="explanation card_welcart card_sec3d_welcart"><td colspan="2"><?php esc_html_e( '3D secure authentication at the time of payment. If you want to use it, you need to apply to SP.LINKS Inc.', 'usces' ); ?></td></tr> |
| 1634 |
<tr class="card_welcart card_key_welcart"> |
| 1635 |
<th><a class="explanation-label" id="label_ex_card_key_aes_welcart"><?php esc_html_e( 'Encryption Key', 'usces' ); /* 暗号化キー */ ?></a></th> |
| 1636 |
<td><input name="card_key_aes" type="text" id="card_key_aes_welcart" value="<?php echo esc_attr( $acting_opts['card_key_aes'] ); ?>" class="regular-text" /></td> |
| 1637 |
</tr> |
| 1638 |
<tr id="ex_card_key_aes_welcart" class="explanation card_welcart card_key_welcart"><td colspan="2"><?php esc_html_e( 'Encryption key (single-byte alphanumeric characters only) issued by e-SCOTT.', 'usces' ); ?><?php esc_html_e( 'If you want to use 3D Secure Authentication or External Link Type Payment, please apply to SP.LINKS Inc.', 'usces' ); ?></td></tr> |
| 1639 |
<tr class="card_welcart card_key_welcart"> |
| 1640 |
<th><a class="explanation-label" id="label_ex_card_key_iv_welcart"><?php esc_html_e( 'Initialization Vector', 'usces' ); /* 初期化ベクトル */ ?></a></th> |
| 1641 |
<td><input name="card_key_iv" type="text" id="card_key_iv_welcart" value="<?php echo esc_attr( $acting_opts['card_key_iv'] ); ?>" class="regular-text" /></td> |
| 1642 |
</tr> |
| 1643 |
<tr id="ex_card_key_iv_welcart" class="explanation card_welcart card_key_welcart"><td colspan="2"><?php esc_html_e( 'Initialization vector (single-byte alphanumeric characters only) issued by e-SCOTT.', 'usces' ); ?><?php esc_html_e( 'If you want to use 3D Secure Authentication or External Link Type Payment, please apply to SP.LINKS Inc.', 'usces' ); ?></td></tr> |
| 1644 |
<tr class="card_token_code_welcart"> |
| 1645 |
<th><a class="explanation-label" id="label_ex_token_code_welcart"><?php esc_html_e( 'Token auth code', 'usces' ); /* トークン決済認証コード */ ?></a></th> |
| 1646 |
<td><input name="token_code" type="text" id="token_code_welcart" value="<?php echo esc_attr( $acting_opts['token_code'] ); ?>" class="regular-text" maxlength="32" /></td> |
| 1647 |
</tr> |
| 1648 |
<tr id="ex_token_code_welcart" class="explanation card_token_code_welcart"><td colspan="2"><?php esc_html_e( 'Token auth code (single-byte alphanumeric characters only) issued from e-SCOTT.', 'usces' ); ?></td></tr> |
| 1649 |
<tr class="card_welcart"> |
| 1650 |
<th><a class="explanation-label" id="label_ex_seccd_welcart"><?php echo wp_kses_post( __( 'Security code <br /> (authentication assist)', 'usces' ) ); /* セキュリティコード */ ?></a></th> |
| 1651 |
<td><label><input name="seccd" type="radio" id="seccd_welcart_1" value="on"<?php checked( $seccd, 'on' ); ?> /><span><?php esc_html_e( 'Use', 'usces' ); ?></span></label><br /> |
| 1652 |
<label><input name="seccd" type="radio" id="seccd_welcart_0" value="off"<?php checked( $seccd, 'off' ); ?> /><span><?php esc_html_e( 'Do not Use', 'usces' ); ?></span></label> |
| 1653 |
</td> |
| 1654 |
</tr> |
| 1655 |
<tr id="ex_seccd_welcart" class="explanation card_welcart"><td colspan="2"><?php esc_html_e( "Use 'Security code' of authentication assist matching. If you decide not to use, please also set 'Do not verify matching' on the e-SCOTT management screen.", 'usces' ); ?></td></tr> |
| 1656 |
<tr class="card_welcart"> |
| 1657 |
<th><a class="explanation-label" id="label_ex_quickpay_welcart"><?php esc_html_e( 'Quick payment', 'usces' ); /* クイック決済 */ ?></a></th> |
| 1658 |
<td><label><input name="quickpay" type="radio" class="quickpay_welcart" id="quickpay_welcart_1" value="on"<?php checked( $quickpay, 'on' ); ?> /><span><?php esc_html_e( 'Use', 'usces' ); ?></span></label><br /> |
| 1659 |
<label><input name="quickpay" type="radio" class="quickpay_welcart" id="quickpay_welcart_0" value="off"<?php checked( $quickpay, 'off' ); ?> /><span><?php esc_html_e( 'Do not Use', 'usces' ); ?></span></label> |
| 1660 |
</td> |
| 1661 |
</tr> |
| 1662 |
<tr id="ex_quickpay_welcart" class="explanation card_welcart"><td colspan="2"><?php esc_html_e( 'Members can pay with saved card. Card number will be registered in e-SCOTT Smart system.', 'usces' ); ?><?php esc_html_e( "When using automatic continuing charging (required WCEX DLSeller) or subscription (required WCEX Auto Delivery), please make 'Quick payment' of 'Use'.", 'usces' ); ?></td></tr> |
| 1663 |
<tr class="card_chooseable_quickpay_welcart"> |
| 1664 |
<th><a class="explanation-label" id="label_ex_chooseable_quickpay_welcart"><?php esc_html_e( 'Register credit card', 'usces' ); /* クレジットカードの登録 */ ?></a></th> |
| 1665 |
<td><label><input name="chooseable_quickpay" type="radio" class="chooseable_quickpay_welcart" id="chooseable_quickpay_welcart_1" value="on"<?php checked( $chooseable_quickpay, 'on' ); ?> /><span><?php esc_html_e( 'Member chooses', 'usces' ); ?></span></label><br /> |
| 1666 |
<label><input name="chooseable_quickpay" type="radio" class="chooseable_quickpay_welcart" id="chooseable_quickpay_welcart_0" value="off"<?php checked( $chooseable_quickpay, 'off' ); ?> /><span><?php esc_html_e( 'Always register', 'usces' ); ?></span></label> |
| 1667 |
</td> |
| 1668 |
</tr> |
| 1669 |
<tr id="ex_chooseable_quickpay_welcart" class="explanation card_chooseable_quickpay_welcart"><td colspan="2"><?php esc_html_e( "In case of 'Always register', 'Register and purchase credit card' will not be displayed when purchasing with credit card.", 'usces' ); ?></td></tr> |
| 1670 |
<tr class="card_welcart"> |
| 1671 |
<th><a class="explanation-label" id="label_ex_operateid_welcart"><?php esc_html_e( 'Processing classification', 'usces' ); /* 処理区分 */ ?></a></th> |
| 1672 |
<td><label><input name="operateid" type="radio" id="operateid_welcart_1" value="1Auth"<?php checked( $operateid, '1Auth' ); ?> /><span><?php esc_html_e( 'Credit', 'usces' ); /* 与信 */ ?></span></label><br /> |
| 1673 |
<label><input name="operateid" type="radio" id="operateid_welcart_2" value="1Gathering"<?php checked( $operateid, '1Gathering' ); ?> /><span><?php esc_html_e( 'Credit sales', 'usces' ); /* 与信売上計上 */ ?></span></label> |
| 1674 |
</td> |
| 1675 |
</tr> |
| 1676 |
<tr id="ex_operateid_welcart" class="explanation card_welcart"><td colspan="2"><?php esc_html_e( "In case of 'Credit' setting, it need to change to 'Sales recorded' manually in later. In case of 'Credit sales recorded' setting, sales will be recorded at the time of purchase.", 'usces' ); ?></td></tr> |
| 1677 |
<?php if ( defined( 'WCEX_DLSELLER' ) ) : ?> |
| 1678 |
<tr class="card_welcart"> |
| 1679 |
<th><a class="explanation-label" id="label_ex_operateid_dlseller_welcart"><?php esc_html_e( 'Automatic Continuing Charging Processing Classification', 'usces' ); /* 自動継続課金処理区分 */ ?></a></th> |
| 1680 |
<td><label><input name="operateid_dlseller" type="radio" id="operateid_dlseller_welcart_1" value="1Auth"<?php checked( $operateid_dlseller, '1Auth' ); ?> /><span><?php esc_html_e( 'Credit', 'usces' ); /* 与信 */ ?></span></label><br /> |
| 1681 |
<label><input name="operateid_dlseller" type="radio" id="operateid_dlseller_welcart_2" value="1Gathering"<?php checked( $operateid_dlseller, '1Gathering' ); ?> /><span><?php esc_html_e( 'Credit sales', 'usces' ); /* 与信売上計上 */ ?></span></label> |
| 1682 |
</td> |
| 1683 |
</tr> |
| 1684 |
<tr id="ex_operateid_dlseller_welcart" class="explanation card_welcart"><td colspan="2"><?php esc_html_e( 'Processing classification when automatic continuing charging (required WCEX DLSeller).', 'usces' ); ?></td></tr> |
| 1685 |
<tr class="card_welcart"> |
| 1686 |
<th><a class="explanation-label" id="label_ex_auto_settlement_mail_welcart"><?php esc_html_e( 'Automatic Continuing Charging Completion Mail', 'usces' ); /* 自動継続課金完了メール */ ?></a></th> |
| 1687 |
<td><label><input name="auto_settlement_mail" type="radio" id="auto_settlement_mail_welcart_1" value="on"<?php checked( $auto_settlement_mail, 'on' ); ?> /><span><?php esc_html_e( 'Send', 'usces' ); ?></span></label><br /> |
| 1688 |
<label><input name="auto_settlement_mail" type="radio" id="auto_settlement_mail_welcart_0" value="off"<?php checked( $auto_settlement_mail, 'off' ); ?> /><span><?php esc_html_e( "Don't send", 'usces' ); ?></span></label> |
| 1689 |
</td> |
| 1690 |
</tr> |
| 1691 |
<tr id="ex_auto_settlement_mail_welcart" class="explanation card_welcart"><td colspan="2"><?php esc_html_e( 'Send billing completion mail to the member on which automatic continuing charging processing (required WCEX DLSeller) is executed.', 'usces' ); ?></td></tr> |
| 1692 |
<?php endif; ?> |
| 1693 |
<tr class="card_howtopay_welcart"> |
| 1694 |
<th><a class="explanation-label" id="label_ex_howtopay_welcart"><?php esc_html_e( 'Number of payments', 'usces' ); /* 支払回数 */ ?></a></th> |
| 1695 |
<td><label><input name="howtopay" type="radio" id="howtopay_welcart_1" value="1"<?php checked( $howtopay, '1' ); ?> /><span><?php esc_html_e( 'Lump-sum payment only', 'usces' ); /* 一括払いのみ */ ?></span></label><br /> |
| 1696 |
<label><input name="howtopay" type="radio" id="howtopay_welcart_2" value="2"<?php checked( $howtopay, '2' ); ?> /><span><?php esc_html_e( 'Activate installment payment', 'usces' ); /* 分割払いを有効にする */ ?></span></label><br /> |
| 1697 |
<label><input name="howtopay" type="radio" id="howtopay_welcart_3" value="3"<?php checked( $howtopay, '3' ); ?> /><span><?php esc_html_e( 'Activate installment payments and bonus payments', 'usces' ); /* 分割払いとボーナス払いを有効にする */ ?></span></label> |
| 1698 |
</td> |
| 1699 |
</tr> |
| 1700 |
<tr id="ex_howtopay_welcart" class="explanation card_howtopay_welcart"><td colspan="2"><?php esc_html_e( 'It can be selected when using in non-passage type.', 'usces' ); ?></td></tr> |
| 1701 |
</table> |
| 1702 |
<table class="settle_table"> |
| 1703 |
<tr> |
| 1704 |
<th><?php esc_html_e( 'Online storage agency', 'usces' ); /* オンライン収納代行 */ ?></th> |
| 1705 |
<td><label><input name="conv_activate" type="radio" class="conv_activate_welcart" id="conv_activate_welcart_1" value="on"<?php checked( $conv_activate, 'on' ); ?> /><span><?php esc_html_e( 'Use', 'usces' ); ?></span></label><br /> |
| 1706 |
<label><input name="conv_activate" type="radio" class="conv_activate_welcart" id="conv_activate_welcart_0" value="off"<?php checked( $conv_activate, 'off' ); ?> /><span><?php esc_html_e( 'Do not Use', 'usces' ); ?></span></label> |
| 1707 |
</td> |
| 1708 |
</tr> |
| 1709 |
<tr class="conv_welcart"> |
| 1710 |
<th><?php esc_html_e( 'Payment due days', 'usces' ); /* 支払期限日数 */ ?></th> |
| 1711 |
<td><input name="conv_limit" type="text" id="conv_limit" value="<?php echo esc_attr( $acting_opts['conv_limit'] ); ?>" class="small-text" /><?php esc_html_e( 'days', 'usces' ); ?></td> |
| 1712 |
</tr> |
| 1713 |
<tr class="conv_welcart"> |
| 1714 |
<th><a class="explanation-label" id="label_ex_conv_fee_welcart"><?php esc_html_e( 'Fee', 'usces' ); /* 手数料 */ ?></a></th> |
| 1715 |
<td><span id="conv_fee_type_field" class="fee_type_field"><?php echo esc_html( $this->get_fee_name( $acting_opts['conv_fee_type'] ) ); ?></span><input type="button" class="button" value="<?php esc_attr_e( 'Detailed setting', 'usces' ); ?>" id="conv_fee_setting" /></td> |
| 1716 |
</tr> |
| 1717 |
<tr id="ex_conv_fee_welcart" class="explanation conv_welcart"><td colspan="2"><?php esc_html_e( 'Set the online storage agency commission and settlement upper limit. Leave it blank if you do not need it.', 'usces' ); ?></td></tr> |
| 1718 |
</table> |
| 1719 |
<table class="settle_table"> |
| 1720 |
<tr> |
| 1721 |
<th><?php esc_html_e( 'Postpay settlement (ATODENE)', 'usces' ); /* 後払い決済 */ ?></th> |
| 1722 |
<td><label><input name="atodene_activate" type="radio" class="atodene_activate_welcart" id="atodene_activate_welcart_1" value="on"<?php checked( $atodene_activate, 'on' ); ?> /><span><?php esc_html_e( 'Use', 'usces' ); ?></span></label><br /> |
| 1723 |
<label><input name="atodene_activate" type="radio" class="atodene_activate_welcart" id="atodene_activate_welcart_0" value="off"<?php checked( $atodene_activate, 'off' ); ?> /><span><?php esc_html_e( 'Do not Use', 'usces' ); ?></span></label> |
| 1724 |
</td> |
| 1725 |
</tr> |
| 1726 |
<tr class="atodene_welcart"> |
| 1727 |
<th><a class="explanation-label" id="label_ex_atodene_byitem_welcart"><?php esc_html_e( 'Possibility of each items', 'usces' ); /* 商品ごとの可否 */ ?></a></th> |
| 1728 |
<td><label><input name="atodene_byitem" type="radio" id="atodene_byitem_welcart_1" value="on"<?php checked( $atodene_byitem, 'on' ); ?> /><span><?php esc_html_e( 'Enabled', 'usces' ); ?></span></label><br /> |
| 1729 |
<label><input name="atodene_byitem" type="radio" id="atodene_byitem_welcart_0" value="off"<?php checked( $atodene_byitem, 'off' ); ?> /><span><?php esc_html_e( 'Disabled', 'usces' ); ?></span></label> |
| 1730 |
</td> |
| 1731 |
</tr> |
| 1732 |
<tr id="ex_atodene_byitem_welcart" class="explanation atodene_welcart"><td colspan="2"><?php echo wp_kses_post( __( 'It is effective when setting possibility of each items. Invalid when not distinguished in particular.<br />If enabled, a selection field will be added to determine whether postpay settlement is possible on the product registration screen. If there is a product in the cart that can not be postpaid settlement, we exclude postpaid settlement from the payment method options.<br />In addition, availability data is added to the product CSV as a custom field (welcartpay_atodene).', 'usces' ) ); ?></td></tr> |
| 1733 |
<tr class="atodene_welcart"> |
| 1734 |
<th><a class="explanation-label" id="label_ex_atodene_billing_method_welcart"><?php esc_html_e( 'Invoice delivery method', 'usces' ); /* 請求書送付方法 */ ?></a></th> |
| 1735 |
<td><label><input name="atodene_billing_method" type="radio" id="atodene_billing_method_welcart_2" value="2"<?php checked( $atodene_billing_method, '2' ); ?> /><span><?php esc_html_e( 'Separate shipment', 'usces' ); /* 別送 */ ?></span></label><br /> |
| 1736 |
<label><input name="atodene_billing_method" type="radio" id="atodene_billing_method_welcart_3" value="3"<?php checked( $atodene_billing_method, '3' ); ?> /><span><?php esc_html_e( 'Include shipment', 'usces' ); /* 同梱 */ ?></span></label> |
| 1737 |
</td> |
| 1738 |
</tr> |
| 1739 |
<tr id="ex_atodene_billing_method_welcart" class="explanation atodene_welcart"><td colspan="2"><?php esc_html_e( 'How to send invoices from ATODENE.', 'usces' ); ?></td></tr> |
| 1740 |
<tr class="atodene_welcart"> |
| 1741 |
<th><a class="explanation-label" id="label_ex_atodene_fee_welcart"><?php esc_html_e( 'Fee', 'usces' ); ?></a></th> |
| 1742 |
<td><span id="atodene_fee_type_field" class="fee_type_field"><?php echo esc_html( $this->get_fee_name( $acting_opts['atodene_fee_type'] ) ); ?></span><input type="button" class="button" value="<?php esc_attr_e( 'Detailed setting', 'usces' ); ?>" id="atodene_fee_setting" /></td> |
| 1743 |
</tr> |
| 1744 |
<tr id="ex_atodene_fee_welcart" class="explanation atodene_welcart"><td colspan="2"><?php esc_html_e( 'Set up postpaid settlement fee and maximum settlement amount. Leave it blank if you do not need it.', 'usces' ); ?></td></tr> |
| 1745 |
</table> |
| 1746 |
<table class="settle_table"> |
| 1747 |
<tr> |
| 1748 |
<th><?php esc_html_e( 'UnionPay', 'usces' ); /* 銀聯 */ ?></th> |
| 1749 |
<td><label><input name="unionpay_activate" type="radio" class="unionpay_activate_welcart" id="unionpay_activate_welcart_1" value="on"<?php checked( $unionpay_activate, 'on' ); ?> /><span><?php esc_html_e( 'Use', 'usces' ); ?></span></label><br /> |
| 1750 |
<label><input name="unionpay_activate" type="radio" class="unionpay_activate_welcart" id="unionpay_activate_welcart_0" value="off"<?php checked( $unionpay_activate, 'off' ); ?> /><span><?php esc_html_e( 'Do not Use', 'usces' ); ?></span></label> |
| 1751 |
</td> |
| 1752 |
</tr> |
| 1753 |
<tr class="unionpay_welcart"> |
| 1754 |
<th><a class="explanation-label" id="label_ex_unionpay_key_aes_welcart"><?php esc_html_e( 'Encryption Key', 'usces' ); /* 銀聯暗号化キー */ ?></a></th> |
| 1755 |
<td><input name="unionpay_key_aes" type="text" id="unionpay_key_aes_welcart" value="<?php echo esc_attr( $acting_opts['unionpay_key_aes'] ); ?>" class="regular-text" /></td> |
| 1756 |
</tr> |
| 1757 |
<tr id="ex_unionpay_key_aes_welcart" class="explanation unionpay_welcart"><td colspan="2"><?php esc_html_e( 'UnionPay encryption key (single-byte alphanumeric characters only) issued by e-SCOTT.', 'usces' ); ?></td></tr> |
| 1758 |
<tr class="unionpay_welcart"> |
| 1759 |
<th><a class="explanation-label" id="label_ex_unionpay_key_iv_welcart"><?php esc_html_e( 'Initialization Vector', 'usces' ); /* 銀聯初期化ベクトル */ ?></a></th> |
| 1760 |
<td><input name="unionpay_key_iv" type="text" id="unionpay_key_iv_welcart" value="<?php echo esc_attr( $acting_opts['unionpay_key_iv'] ); ?>" class="regular-text" /></td> |
| 1761 |
</tr> |
| 1762 |
<tr id="ex_unionpay_key_iv_welcart" class="explanation unionpay_welcart"><td colspan="2"><?php esc_html_e( 'UnionPay initialization vector (single-byte alphanumeric characters only) issued by e-SCOTT.', 'usces' ); ?></td></tr> |
| 1763 |
<tr class="unionpay_welcart"> |
| 1764 |
<th><a class="explanation-label" id="label_ex_unionpay_pagelanguage_welcart"><?php esc_html_e( 'Page Language', 'usces' ); /* 三� |
| 1765 |
間ページ言語 */ ?></a></th> |
| 1766 |
<td><select name="unionpay_pagelanguage" id="unionpay_pagelanguage_welcart"> |
| 1767 |
<option value=""><?php esc_html_e( 'Not set', 'usces' ); ?></option> |
| 1768 |
<option value="zh_CN"<?php selected( $acting_opts['unionpay_pagelanguage'], 'zh_CN' ); ?>><?php esc_html_e( 'Chinese (Simplified)', 'usces' ); ?></option> |
| 1769 |
<option value="zh_TW"<?php selected( $acting_opts['unionpay_pagelanguage'], 'zh_TW' ); ?>><?php esc_html_e( 'Chinese (Traditional)', 'usces' ); ?></option> |
| 1770 |
<option value="en_US"<?php selected( $acting_opts['unionpay_pagelanguage'], 'en_US' ); ?>><?php esc_html_e( 'English', 'usces' ); ?></option> |
| 1771 |
<option value="ja_JP"<?php selected( $acting_opts['unionpay_pagelanguage'], 'ja_JP' ); ?>><?php esc_html_e( 'Japanese', 'usces' ); ?></option> |
| 1772 |
<option value="ko_KR"<?php selected( $acting_opts['unionpay_pagelanguage'], 'ko_KR' ); ?>><?php esc_html_e( 'Korean', 'usces' ); ?></option> |
| 1773 |
</select> |
| 1774 |
</td> |
| 1775 |
</tr> |
| 1776 |
<tr id="ex_unionpay_pagelanguage_welcart" class="explanation unionpay_welcart"><td colspan="2"><?php esc_html_e( 'Specifies the language of the SecurePay payment page. If not set, the page is displayed according to the language of the end user\'s browser. For mobile devices, only Chinese and English are displayed.', 'usces' ); ?></td></tr> |
| 1777 |
</table> |
| 1778 |
<input type="hidden" name="acting" value="welcart" /> |
| 1779 |
<input type="hidden" name="conv_fee_type" id="conv_fee_type" value="<?php echo esc_attr( $acting_opts['conv_fee_type'] ); ?>" /> |
| 1780 |
<input type="hidden" name="conv_fee" id="conv_fee" value="<?php echo esc_attr( $acting_opts['conv_fee'] ); ?>" /> |
| 1781 |
<input type="hidden" name="conv_fee_limit_amount_fix" id="conv_fee_limit_amount_fix" value="<?php echo esc_attr( $acting_opts['conv_fee_limit_amount'] ); ?>" /> |
| 1782 |
<input type="hidden" name="conv_fee_first_amount" id="conv_fee_first_amount" value="<?php echo esc_attr( $acting_opts['conv_fee_first_amount'] ); ?>" /> |
| 1783 |
<input type="hidden" name="conv_fee_first_fee" id="conv_fee_first_fee" value="<?php echo esc_attr( $acting_opts['conv_fee_first_fee'] ); ?>" /> |
| 1784 |
<input type="hidden" name="conv_fee_limit_amount_change" id="conv_fee_limit_amount_change" value="<?php echo esc_attr( $acting_opts['conv_fee_limit_amount'] ); ?>" /> |
| 1785 |
<input type="hidden" name="conv_fee_amounts" id="conv_fee_amounts" value="<?php echo esc_attr( implode( '|', $acting_opts['conv_fee_amounts'] ) ); ?>" /> |
| 1786 |
<input type="hidden" name="conv_fee_fees" id="conv_fee_fees" value="<?php echo esc_attr( implode( '|', $acting_opts['conv_fee_fees'] ) ); ?>" /> |
| 1787 |
<input type="hidden" name="conv_fee_end_fee" id="conv_fee_end_fee" value="<?php echo esc_attr( $acting_opts['conv_fee_end_fee'] ); ?>" /> |
| 1788 |
<input type="hidden" name="atodene_fee_type" id="atodene_fee_type" value="<?php echo esc_attr( $acting_opts['atodene_fee_type'] ); ?>" /> |
| 1789 |
<input type="hidden" name="atodene_fee" id="atodene_fee" value="<?php echo esc_attr( $acting_opts['atodene_fee'] ); ?>" /> |
| 1790 |
<input type="hidden" name="atodene_fee_limit_amount_fix" id="atodene_fee_limit_amount_fix" value="<?php echo esc_attr( $acting_opts['atodene_fee_limit_amount'] ); ?>" /> |
| 1791 |
<input type="hidden" name="atodene_fee_first_amount" id="atodene_fee_first_amount" value="<?php echo esc_attr( $acting_opts['atodene_fee_first_amount'] ); ?>" /> |
| 1792 |
<input type="hidden" name="atodene_fee_first_fee" id="atodene_fee_first_fee" value="<?php echo esc_attr( $acting_opts['atodene_fee_first_fee'] ); ?>" /> |
| 1793 |
<input type="hidden" name="atodene_fee_limit_amount_change" id="atodene_fee_limit_amount_change" value="<?php echo esc_attr( $acting_opts['atodene_fee_limit_amount'] ); ?>" /> |
| 1794 |
<input type="hidden" name="atodene_fee_amounts" id="atodene_fee_amounts" value="<?php echo esc_attr( implode( '|', $acting_opts['atodene_fee_amounts'] ) ); ?>" /> |
| 1795 |
<input type="hidden" name="atodene_fee_fees" id="atodene_fee_fees" value="<?php echo esc_attr( implode( '|', $acting_opts['atodene_fee_fees'] ) ); ?>" /> |
| 1796 |
<input type="hidden" name="atodene_fee_end_fee" id="atodene_fee_end_fee" value="<?php echo esc_attr( $acting_opts['atodene_fee_end_fee'] ); ?>" /> |
| 1797 |
<input name="usces_option_update" type="submit" class="button button-primary" value="<?php esc_attr_e( 'Update WelcartPay settings', 'usces' ); ?>" /> |
| 1798 |
<?php wp_nonce_field( 'admin_settlement', 'wc_nonce' ); ?> |
| 1799 |
</form> |
| 1800 |
<div class="settle_exp"> |
| 1801 |
<p><strong>WelcartPay based on e-SCOTT</strong><br /> |
| 1802 |
<a href="<?php echo esc_url( $this->acting_company_url ); ?>" target="_blank"><?php esc_html_e( 'Details of e-SCOTT Smart is here >>', 'usces' ); ?></a></p> |
| 1803 |
<p><?php esc_html_e( "'Non-passage type' is a settlement system that completes with shop site only, without transitioning to the page of the settlement company.", 'usces' ); ?><br /> |
| 1804 |
<?php esc_html_e( 'Stylish with unified design is possible. However, because we will handle the card number, dedicated SSL is required.', 'usces' ); ?><br /> |
| 1805 |
<?php esc_html_e( "'External link type' is a settlement system that moves to the page of the settlement company and inputs card information.", 'usces' ); ?><br /> |
| 1806 |
<?php esc_html_e( 'In both types, the entered card number will be sent to the e-SCOTT Smart system, so it will not be saved in Welcart.', 'usces' ); ?></p> |
| 1807 |
<p><?php esc_html_e( "'WCEX DL Seller' is necessary when using 'automatic continuing charging'.", 'usces' ); ?><br /> |
| 1808 |
<?php esc_html_e( "'WCEX Auto Delivery' is necessary when using 'subscription'.", 'usces' ); ?></p> |
| 1809 |
<p><?php esc_html_e( 'In addition, in the production environment, it is SSL communication with only an authorized SSL certificate, so it is necessary to be careful.', 'usces' ); ?></p> |
| 1810 |
<p><?php esc_html_e( 'The Welcart member account used in the test environment may not be available in the production environment.', 'usces' ); ?><br /> |
| 1811 |
<?php esc_html_e( 'Please make another member registration in the test environment and production environment, or delete the member used in the test environment once and register again in the production environment.', 'usces' ); ?></p> |
| 1812 |
<p><strong><?php esc_html_e( '[About 3D Secure]', 'usces' ); ?></strong><br /> |
| 1813 |
<?php esc_html_e( 'If you do not use 3D Secure (do not check the "Use" box), the merchant is responsible for payment due to fraudulent use of the credit card.', 'usces' ); ?><br /> |
| 1814 |
<?php esc_html_e( 'Even if we have already paid the merchant an amount equivalent to the sales proceeds, the merchant must return the amount to us upon request for a chargeback (return of sales proceeds) from the credit card company.', 'usces' ); ?><br /> |
| 1815 |
<?php esc_html_e( 'Please note that chargebacks may occur even if you select "Use". Please understand this in advance.', 'usces' ); ?><br /> |
| 1816 |
<?php esc_html_e( 'If you have applied for the EMV 3D Secure service, please be sure to select "Use".', 'usces' ); ?></p> |
| 1817 |
<p><strong><?php esc_html_e( '[Note on chargebacks]', 'usces' ); ?></strong><br /> |
| 1818 |
<?php esc_html_e( '* Even if sales approval has been obtained (when the authorization result is OK), chargebacks will still be incurred.', 'usces' ); ?><br /> |
| 1819 |
<?php esc_html_e( '* If chargebacks occur, there is no compensation or reimbursement by us or the credit card companies. The merchant is responsible for all charges.', 'usces' ); ?><br /> |
| 1820 |
<?php esc_html_e( "* Chargebacks will be incurred regardless of whether the merchant's intentional or negligent conduct is involved.", 'usces' ); ?><br /> |
| 1821 |
<?php esc_html_e( 'Please be sure to confirm the following before starting to use the service.', 'usces' ); ?><br /> |
| 1822 |
<a href="https://www.splinks.co.jp/yougo/chargeback.html" target="_blank"><?php esc_html_e( 'About chargebacks', 'usces' ); ?></a></p> |
| 1823 |
</div> |
| 1824 |
</div><!--uscestabs_welcart--> |
| 1825 |
|
| 1826 |
<div id="welcartpay_fee_dialog" class="cod_dialog"> |
| 1827 |
<fieldset> |
| 1828 |
<table id="welcartpay_fee_type_table" class="cod_type_table"> |
| 1829 |
<tr> |
| 1830 |
<th><?php esc_html_e( 'Type of the fee', 'usces' ); ?></th> |
| 1831 |
<td class="radio"><input name="fee_type" type="radio" id="fee_type_fix" class="fee_type" value="fix" /></td><td><label for="fee_type_fix"><?php esc_html_e( 'Fixation', 'usces' ); ?></label></td> |
| 1832 |
<td class="radio"><input name="fee_type" type="radio" id="fee_type_change" class="fee_type" value="change" /></td><td><label for="fee_type_change"><?php esc_html_e( 'Variable', 'usces' ); ?></label></td> |
| 1833 |
</tr> |
| 1834 |
</table> |
| 1835 |
<table id="welcartpay_fee_fix_table" class="cod_fix_table"> |
| 1836 |
<tr> |
| 1837 |
<th><?php esc_html_e( 'Fee', 'usces' ); ?></th> |
| 1838 |
<td><input name="fee" type="text" id="fee_fix" class="short_str num" /><?php usces_crcode(); ?></td> |
| 1839 |
</tr> |
| 1840 |
<tr> |
| 1841 |
<th><?php esc_html_e( 'Upper limit', 'usces' ); ?></th> |
| 1842 |
<td><input name="fee_limit_amount_fix" type="text" id="fee_limit_amount_fix" class="short_str num" /><?php usces_crcode(); ?></td> |
| 1843 |
</tr> |
| 1844 |
</table> |
| 1845 |
<div id="welcartpay_fee_change_table" class="cod_change_table"> |
| 1846 |
<input type="button" class="button" id="fee_add_row" value="<?php esc_attr_e( 'Add row', 'usces' ); ?>" /> |
| 1847 |
<input type="button" class="button" id="fee_del_row" value="<?php esc_attr_e( 'Delete row', 'usces' ); ?>" /> |
| 1848 |
<table> |
| 1849 |
<thead> |
| 1850 |
<tr> |
| 1851 |
<th colspan="3"><?php esc_html_e( 'A purchase amount', 'usces' ); ?>(<?php usces_crcode(); ?>)</th> |
| 1852 |
<th><?php esc_html_e( 'Fee', 'usces' ); ?>(<?php usces_crcode(); ?>)</th> |
| 1853 |
</tr> |
| 1854 |
<tr> |
| 1855 |
<td class="cod_f">0</td> |
| 1856 |
<td class="cod_m"><?php esc_html_e( ' - ', 'usces' ); ?></td> |
| 1857 |
<td class="cod_e"><input name="fee_first_amount" id="fee_first_amount" type="text" class="short_str num" /></td> |
| 1858 |
<td class="cod_cod"><input name="fee_first_fee" id="fee_first_fee" type="text" class="short_str num" /></td> |
| 1859 |
</tr> |
| 1860 |
</thead> |
| 1861 |
<tbody id="fee_change_field"></tbody> |
| 1862 |
<tfoot> |
| 1863 |
<tr> |
| 1864 |
<td class="cod_f"><span id="end_amount"></span></td> |
| 1865 |
<td class="cod_m"><?php esc_html_e( ' - ', 'usces' ); ?></td> |
| 1866 |
<td class="cod_e"><input name="fee_limit_amount_change" type="text" id="fee_limit_amount_change" class="short_str num" /></td> |
| 1867 |
<td class="cod_cod"><input name="fee_end_fee" type="text" id="fee_end_fee" class="short_str num" /></td> |
| 1868 |
</tr> |
| 1869 |
</tfoot> |
| 1870 |
</table> |
| 1871 |
</div> |
| 1872 |
</fieldset> |
| 1873 |
<input type="hidden" id="welcartpay_fee_mode"> |
| 1874 |
</div><!--welcartpay_fee_dialog--> |
| 1875 |
<?php |
| 1876 |
endif; |
| 1877 |
} |
| 1878 |
|
| 1879 |
/** |
| 1880 |
* ゼウス定期購� |
| 1881 |
�メッセージ |
| 1882 |
* wcad_filter_admin_notices |
| 1883 |
* |
| 1884 |
* @param string $msg Admin message. |
| 1885 |
* @return string |
| 1886 |
*/ |
| 1887 |
public function admin_notices_autodelivery( $msg ) { |
| 1888 |
global $usces; |
| 1889 |
|
| 1890 |
$acting_opts = $this->get_acting_settings(); |
| 1891 |
if ( ( isset( $acting_opts['activate'] ) && 'on' === $acting_opts['activate'] ) && |
| 1892 |
( isset( $acting_opts['card_activate'] ) && ( 'on' === $acting_opts['card_activate'] || 'link' === $acting_opts['card_activate'] || 'token' === $acting_opts['card_activate'] ) ) && |
| 1893 |
( isset( $acting_opts['quickpay'] ) && 'on' === $acting_opts['quickpay'] ) ) { |
| 1894 |
$msg = ''; |
| 1895 |
} else { |
| 1896 |
$zeus_opts = $usces->options['acting_settings']['zeus']; |
| 1897 |
$p_flag = ( ( isset( $zeus_opts['activate'] ) && 'on' === $zeus_opts['activate'] ) && ( isset( $zeus_opts['card_activate'] ) && 'on' === $zeus_opts['card_activate'] ) ) ? true : false; |
| 1898 |
$batch = ( isset( $zeus_opts['batch'] ) ) ? $zeus_opts['batch'] : 'off'; |
| 1899 |
if ( ! $p_flag || 'off' === $batch ) { |
| 1900 |
$msg .= ' |
| 1901 |
<div class="error"> |
| 1902 |
<p>' . __( "In 'credit settlement Settings', please set to 'use' the quickpay of WelcartPay.", 'usces' ) . '</p> |
| 1903 |
</div>'; |
| 1904 |
} |
| 1905 |
} |
| 1906 |
return $msg; |
| 1907 |
} |
| 1908 |
|
| 1909 |
/** |
| 1910 |
* � |
| 1911 |
�金通知処理および、三� |
| 1912 |
間決済画面からのリダイレクト |
| 1913 |
* usces_after_cart_instant |
| 1914 |
*/ |
| 1915 |
public function acting_transaction() { |
| 1916 |
global $usces; |
| 1917 |
|
| 1918 |
/* � |
| 1919 |
�金通知 */ |
| 1920 |
if ( isset( $_REQUEST['MerchantFree1'] ) && isset( $_REQUEST['MerchantId'] ) && isset( $_REQUEST['TransactionId'] ) && isset( $_REQUEST['RecvNum'] ) && isset( $_REQUEST['NyukinDate'] ) && |
| 1921 |
( isset( $_REQUEST['MerchantFree2'] ) && 'acting_welcart_conv' === wp_unslash( $_REQUEST['MerchantFree2'] ) ) ) { |
| 1922 |
$acting_opts = $this->get_acting_settings(); |
| 1923 |
if ( $acting_opts['merchant_id'] === wp_unslash( $_REQUEST['MerchantId'] ) ) { |
| 1924 |
$response_data = wp_unslash( $_REQUEST ); |
| 1925 |
$order_id = usces_get_order_id_by_trans_id( $response_data['MerchantFree1'] ); |
| 1926 |
if ( ! empty( $order_id ) ) { |
| 1927 |
|
| 1928 |
/* オーダーステータス変更 */ |
| 1929 |
usces_change_order_receipt( $order_id, 'receipted' ); |
| 1930 |
/* ポイント付与 */ |
| 1931 |
usces_action_acting_getpoint( $order_id ); |
| 1932 |
|
| 1933 |
$response_data['OperateId'] = 'receipted'; |
| 1934 |
$order_meta = usces_unserialize( $usces->get_order_meta_value( $response_data['MerchantFree2'], $order_id ) ); |
| 1935 |
$meta_value = array_merge( $order_meta, $response_data ); |
| 1936 |
$usces->set_order_meta_value( $response_data['MerchantFree2'], usces_serialize( $meta_value ), $order_id ); |
| 1937 |
$this->save_acting_history_log( $response_data, $order_id . '_' . $response_data['MerchantFree1'] ); |
| 1938 |
usces_log( '[WelcartPay] conv receipted : ' . print_r( $response_data, true ), 'acting_transaction.log' ); |
| 1939 |
} else { |
| 1940 |
usces_log( '[WelcartPay] conv receipted order_id error : ' . print_r( $response_data, true ), 'acting_transaction.log' ); |
| 1941 |
} |
| 1942 |
} |
| 1943 |
header( 'HTTP/1.0 200 OK' ); |
| 1944 |
die(); |
| 1945 |
|
| 1946 |
} elseif ( isset( $_REQUEST['EncryptValue'] ) ) { |
| 1947 |
$acting_opts = $this->get_acting_settings(); |
| 1948 |
|
| 1949 |
/* 銀聯決済 */ |
| 1950 |
if ( isset( $_REQUEST['acting'] ) && $this->acting_unionpay === wp_unslash( $_REQUEST['acting'] ) && $this->is_validity_acting( 'unionpay' ) ) { |
| 1951 |
$encryptvalue = openssl_decrypt( $_REQUEST['EncryptValue'], 'aes-128-cbc', $acting_opts['unionpay_key_aes'], false, $acting_opts['unionpay_key_iv'] ); |
| 1952 |
if ( $encryptvalue ) { |
| 1953 |
parse_str( $encryptvalue, $response_data ); |
| 1954 |
if ( isset( $response_data['OperateId'] ) && isset( $response_data['ResponseCd'] ) && isset( $response_data['MerchantFree1'] ) && |
| 1955 |
( isset( $response_data['MerchantFree2'] ) && 'acting_welcart_unionpay' === $response_data['MerchantFree2'] ) ) { |
| 1956 |
if ( 'OK' === $response_data['ResponseCd'] ) { |
| 1957 |
$order_data = usces_restore_order_acting_data( $response_data['MerchantFree1'] ); |
| 1958 |
if ( ! empty( $order_data ) ) { |
| 1959 |
$response_data['acting'] = $this->acting_unionpay; |
| 1960 |
$res = $usces->order_processing( $response_data ); |
| 1961 |
if ( 'ordercompletion' === $res ) { |
| 1962 |
$_nonce = ( isset( $order_data['_nonce'] ) ) ? $order_data['_nonce'] : wp_create_nonce( $this->acting_flg_unionpay ); |
| 1963 |
wp_redirect( |
| 1964 |
add_query_arg( |
| 1965 |
array( |
| 1966 |
'acting' => $this->acting_unionpay, |
| 1967 |
'acting_return' => 1, |
| 1968 |
'result' => 1, |
| 1969 |
'_nonce' => $_nonce, |
| 1970 |
), |
| 1971 |
USCES_CART_URL |
| 1972 |
) |
| 1973 |
); |
| 1974 |
} else { |
| 1975 |
$logdata = array_merge( $usces_entries['order'], $response_data ); |
| 1976 |
$log = array( |
| 1977 |
'acting' => $this->acting_unionpay, |
| 1978 |
'key' => $response_data['MerchantFree1'], |
| 1979 |
'result' => 'ORDER DATA REGISTERED ERROR', |
| 1980 |
'data' => $logdata, |
| 1981 |
); |
| 1982 |
usces_save_order_acting_error( $log ); |
| 1983 |
wp_redirect( |
| 1984 |
add_query_arg( |
| 1985 |
array( |
| 1986 |
'acting' => $this->acting_unionpay, |
| 1987 |
'acting_return' => 0, |
| 1988 |
'result' => 0, |
| 1989 |
), |
| 1990 |
USCES_CART_URL |
| 1991 |
) |
| 1992 |
); |
| 1993 |
} |
| 1994 |
} else { |
| 1995 |
$log = array( |
| 1996 |
'acting' => $this->acting_unionpay, |
| 1997 |
'key' => $response_data['MerchantFree1'], |
| 1998 |
'result' => 'ORDER DATA RESTORE ERROR', |
| 1999 |
'data' => $response_data, |
| 2000 |
); |
| 2001 |
usces_save_order_acting_error( $log ); |
| 2002 |
wp_redirect( |
| 2003 |
add_query_arg( |
| 2004 |
array( |
| 2005 |
'acting' => $this->acting_unionpay, |
| 2006 |
'acting_return' => 0, |
| 2007 |
'result' => 0, |
| 2008 |
), |
| 2009 |
USCES_CART_URL |
| 2010 |
) |
| 2011 |
); |
| 2012 |
} |
| 2013 |
} elseif ( 'KI0' === $response_data['ResponseCd'] ) { |
| 2014 |
/* Return to Merchant */ |
| 2015 |
wp_redirect( |
| 2016 |
add_query_arg( |
| 2017 |
array( |
| 2018 |
'confirm' => 1, |
| 2019 |
), |
| 2020 |
USCES_CART_URL |
| 2021 |
) |
| 2022 |
); |
| 2023 |
} else { |
| 2024 |
$responsecd = explode( '|', $response_data['ResponseCd'] ); |
| 2025 |
foreach ( (array) $responsecd as $cd ) { |
| 2026 |
$response_data[ $cd ] = $this->response_message( $cd ); |
| 2027 |
} |
| 2028 |
$log = array( |
| 2029 |
'acting' => $this->acting_unionpay, |
| 2030 |
'key' => $response_data['MerchantFree1'], |
| 2031 |
'result' => $response_data['ResponseCd'], |
| 2032 |
'data' => $response_data, |
| 2033 |
); |
| 2034 |
usces_save_order_acting_error( $log ); |
| 2035 |
wp_redirect( |
| 2036 |
add_query_arg( |
| 2037 |
array( |
| 2038 |
'acting' => $this->acting_unionpay, |
| 2039 |
'acting_return' => 0, |
| 2040 |
'result' => 0, |
| 2041 |
), |
| 2042 |
USCES_CART_URL |
| 2043 |
) |
| 2044 |
); |
| 2045 |
} |
| 2046 |
} |
| 2047 |
exit(); |
| 2048 |
} |
| 2049 |
|
| 2050 |
/* 外部リンク(三� |
| 2051 |
間画面)決済 */ |
| 2052 |
} else { |
| 2053 |
$encryptvalue = openssl_decrypt( $_REQUEST['EncryptValue'], 'aes-128-cbc', $acting_opts['key_aes'], false, $acting_opts['key_iv'] ); |
| 2054 |
if ( $encryptvalue ) { |
| 2055 |
parse_str( $encryptvalue, $response_data ); |
| 2056 |
if ( isset( $response_data['OperateId'] ) && isset( $response_data['ResponseCd'] ) && ( isset( $response_data['MerchantId'] ) && $acting_opts['merchant_id'] === $response_data['MerchantId'] ) ) { |
| 2057 |
$cancel = array( 'P51', 'P52', 'P55', 'P56', 'P62', 'P63', 'P64', 'P65', 'P69', 'P70' ); |
| 2058 |
if ( isset( $response_data['MerchantFree1'] ) && ( isset( $response_data['MerchantFree2'] ) && 'acting_welcart_card' === $response_data['MerchantFree2'] ) ) { |
| 2059 |
if ( 'OK' === $response_data['ResponseCd'] ) { |
| 2060 |
/* 会員登録・会員変更 */ |
| 2061 |
if ( '4MemAdd' === $response_data['OperateId'] || '4MemChg' === $response_data['OperateId'] ) { |
| 2062 |
$member = $usces->get_member(); |
| 2063 |
$usces->set_member_meta_value( 'wcpay_member_id', $response_data['KaiinId'], $member['ID'] ); |
| 2064 |
$usces->set_member_meta_value( 'wcpay_member_passwd', $response_data['KaiinPass'], $member['ID'] ); |
| 2065 |
|
| 2066 |
$usces_entries = $usces->cart->get_entry(); |
| 2067 |
$cart = $usces->cart->get_cart(); |
| 2068 |
|
| 2069 |
if ( usces_have_continue_charge() ) { |
| 2070 |
$chargingday = $usces->getItemChargingDay( $cart[0]['post_id'] ); |
| 2071 |
if ( 99 === (int) $chargingday ) { /* 受注日課金 */ |
| 2072 |
$operateid = $acting_opts['operateid']; |
| 2073 |
} else { |
| 2074 |
$operateid = '1Auth'; |
| 2075 |
} |
| 2076 |
} else { |
| 2077 |
$operateid = $acting_opts['operateid']; |
| 2078 |
} |
| 2079 |
$operateid = apply_filters( 'usces_filter_escott_operateid', $operateid, $cart, $usces_entries['order']['total_full_price'] ); |
| 2080 |
|
| 2081 |
$home_url = str_replace( 'http://', 'https://', home_url( '/' ) ); |
| 2082 |
$redirecturl = $home_url . '?page_id=' . USCES_CART_NUMBER; |
| 2083 |
|
| 2084 |
$data_list = array(); |
| 2085 |
$data_list['OperateId'] = $operateid; |
| 2086 |
$data_list['MerchantPass'] = $acting_opts['merchant_pass']; |
| 2087 |
$data_list['TransactionDate'] = $response_data['TransactionDate']; |
| 2088 |
$data_list['MerchantFree1'] = $response_data['MerchantFree1']; |
| 2089 |
$data_list['MerchantFree2'] = $response_data['MerchantFree2']; |
| 2090 |
$data_list['MerchantFree3'] = $this->merchantfree3; |
| 2091 |
$data_list['TenantId'] = $acting_opts['tenant_id']; |
| 2092 |
$data_list['KaiinId'] = $response_data['KaiinId']; |
| 2093 |
$data_list['KaiinPass'] = $response_data['KaiinPass']; |
| 2094 |
$data_list['PayType'] = '01'; |
| 2095 |
$data_list['Amount'] = $usces_entries['order']['total_full_price']; |
| 2096 |
$data_list['ProcNo'] = '0000000'; |
| 2097 |
if ( isset( $response_data['EncodeXId3D'] ) ) { |
| 2098 |
$data_list['EncodeXId3D'] = $response_data['EncodeXId3D']; |
| 2099 |
} |
| 2100 |
if ( isset( $response_data['TransactionId3D'] ) ) { |
| 2101 |
$data_list['TransactionId3D'] = $response_data['TransactionId3D']; |
| 2102 |
} |
| 2103 |
if ( isset( $response_data['MessageVersionNo3D'] ) ) { |
| 2104 |
$data_list['MessageVersionNo3D'] = $response_data['MessageVersionNo3D']; |
| 2105 |
} |
| 2106 |
if ( isset( $response_data['TransactionStatus3D'] ) ) { |
| 2107 |
$data_list['TransactionStatus3D'] = $response_data['TransactionStatus3D']; |
| 2108 |
} |
| 2109 |
if ( isset( $response_data['CAVVAlgorithm3D'] ) ) { |
| 2110 |
$data_list['CAVVAlgorithm3D'] = $response_data['CAVVAlgorithm3D']; |
| 2111 |
} |
| 2112 |
if ( isset( $response_data['ECI3D'] ) ) { |
| 2113 |
$data_list['ECI3D'] = $response_data['ECI3D']; |
| 2114 |
} |
| 2115 |
if ( isset( $response_data['CAVV3D'] ) ) { |
| 2116 |
$data_list['CAVV3D'] = $response_data['CAVV3D']; |
| 2117 |
} |
| 2118 |
if ( isset( $response_data['SecureResultCode'] ) ) { |
| 2119 |
$data_list['SecureResultCode'] = $response_data['SecureResultCode']; |
| 2120 |
} |
| 2121 |
if ( isset( $response_data['DSTransactionId'] ) ) { |
| 2122 |
$data_list['DSTransactionId'] = $response_data['DSTransactionId']; |
| 2123 |
} |
| 2124 |
if ( isset( $response_data['ThreeDSServerTransactionId'] ) ) { |
| 2125 |
$data_list['ThreeDSServerTransactionId'] = $response_data['ThreeDSServerTransactionId']; |
| 2126 |
} |
| 2127 |
$data_list['RedirectUrl'] = $redirecturl; |
| 2128 |
$data_query = http_build_query( $data_list ); |
| 2129 |
$encryptvalue = openssl_encrypt( $data_query, 'aes-128-cbc', $acting_opts['key_aes'], false, $acting_opts['key_iv'] ); |
| 2130 |
wp_redirect( |
| 2131 |
add_query_arg( |
| 2132 |
array( |
| 2133 |
'MerchantId' => $acting_opts['merchant_id'], |
| 2134 |
'EncryptValue' => urlencode( $encryptvalue ), |
| 2135 |
), |
| 2136 |
$acting_opts['send_url_link'] |
| 2137 |
) |
| 2138 |
); |
| 2139 |
exit(); |
| 2140 |
|
| 2141 |
/* 決済 */ |
| 2142 |
} else { |
| 2143 |
$order_data = usces_restore_order_acting_data( $response_data['MerchantFree1'] ); |
| 2144 |
if ( ! empty( $order_data ) ) { |
| 2145 |
$res = $usces->order_processing( $response_data ); |
| 2146 |
if ( 'ordercompletion' === $res ) { |
| 2147 |
$_nonce = ( isset( $order_data['_nonce'] ) ) ? $order_data['_nonce'] : wp_create_nonce( $this->acting_flg_card ); |
| 2148 |
wp_redirect( |
| 2149 |
add_query_arg( |
| 2150 |
array( |
| 2151 |
'acting' => $this->acting_card, |
| 2152 |
'acting_return' => 1, |
| 2153 |
'result' => 1, |
| 2154 |
'_nonce' => $_nonce, |
| 2155 |
), |
| 2156 |
USCES_CART_URL |
| 2157 |
) |
| 2158 |
); |
| 2159 |
} else { |
| 2160 |
$log = array( |
| 2161 |
'acting' => $this->acting_card, |
| 2162 |
'key' => $response_data['MerchantFree1'], |
| 2163 |
'result' => 'ORDER DATA REGISTERED ERROR', |
| 2164 |
'data' => $response_data, |
| 2165 |
); |
| 2166 |
usces_save_order_acting_error( $log ); |
| 2167 |
wp_redirect( |
| 2168 |
add_query_arg( |
| 2169 |
array( |
| 2170 |
'acting' => $this->acting_card, |
| 2171 |
'acting_return' => 0, |
| 2172 |
'result' => 0, |
| 2173 |
), |
| 2174 |
USCES_CART_URL |
| 2175 |
) |
| 2176 |
); |
| 2177 |
} |
| 2178 |
} else { |
| 2179 |
$log = array( |
| 2180 |
'acting' => $this->acting_card, |
| 2181 |
'key' => $response_data['MerchantFree1'], |
| 2182 |
'result' => 'ORDER DATA RESTORE ERROR', |
| 2183 |
'data' => $response_data, |
| 2184 |
); |
| 2185 |
usces_save_order_acting_error( $log ); |
| 2186 |
wp_redirect( |
| 2187 |
add_query_arg( |
| 2188 |
array( |
| 2189 |
'acting' => $this->acting_card, |
| 2190 |
'acting_return' => 0, |
| 2191 |
'result' => 0, |
| 2192 |
), |
| 2193 |
USCES_CART_URL |
| 2194 |
) |
| 2195 |
); |
| 2196 |
} |
| 2197 |
} |
| 2198 |
} elseif ( in_array( $response_data['ResponseCd'], $cancel, true ) ) { |
| 2199 |
wp_redirect( |
| 2200 |
add_query_arg( |
| 2201 |
array( |
| 2202 |
'acting' => $this->acting_card, |
| 2203 |
'confirm' => 1, |
| 2204 |
), |
| 2205 |
USCES_CART_URL |
| 2206 |
) |
| 2207 |
); |
| 2208 |
} else { |
| 2209 |
$responsecd = explode( '|', $response_data['ResponseCd'] ); |
| 2210 |
foreach ( (array) $responsecd as $cd ) { |
| 2211 |
$response_data[ $cd ] = $this->response_message( $cd ); |
| 2212 |
} |
| 2213 |
$log = array( |
| 2214 |
'acting' => $this->acting_card, |
| 2215 |
'key' => $response_data['MerchantFree1'], |
| 2216 |
'result' => $response_data['ResponseCd'], |
| 2217 |
'data' => $response_data, |
| 2218 |
); |
| 2219 |
usces_save_order_acting_error( $log ); |
| 2220 |
wp_redirect( |
| 2221 |
add_query_arg( |
| 2222 |
array( |
| 2223 |
'acting' => $this->acting_card, |
| 2224 |
'acting_return' => 0, |
| 2225 |
'result' => 0, |
| 2226 |
), |
| 2227 |
USCES_CART_URL |
| 2228 |
) |
| 2229 |
); |
| 2230 |
} |
| 2231 |
} else { |
| 2232 |
/* マイページからの会員登録・会員変更 */ |
| 2233 |
if ( '4MemAdd' === $response_data['OperateId'] || '4MemChg' === $response_data['OperateId'] ) { |
| 2234 |
if ( 'OK' === $response_data['ResponseCd'] ) { |
| 2235 |
$member = $usces->get_member(); |
| 2236 |
$usces->set_member_meta_value( 'wcpay_member_id', $response_data['KaiinId'], $member['ID'] ); |
| 2237 |
$usces->set_member_meta_value( 'wcpay_member_passwd', $response_data['KaiinPass'], $member['ID'] ); |
| 2238 |
|
| 2239 |
} elseif ( in_array( $response_data['ResponseCd'], $cancel ) ) { // phpcs:ignore |
| 2240 |
|
| 2241 |
} else { |
| 2242 |
usces_log( '[WelcartPay] 4MemChg NG : ' . print_r( $response_data, true ), 'acting_transaction.log' ); |
| 2243 |
} |
| 2244 |
wp_redirect( USCES_MEMBER_URL ); |
| 2245 |
} |
| 2246 |
} |
| 2247 |
exit(); |
| 2248 |
} |
| 2249 |
} |
| 2250 |
} |
| 2251 |
} |
| 2252 |
} |
| 2253 |
|
| 2254 |
/** |
| 2255 |
* 管理画面決済処理 |
| 2256 |
* usces_action_admin_ajax |
| 2257 |
*/ |
| 2258 |
public function admin_ajax() { |
| 2259 |
global $usces; |
| 2260 |
|
| 2261 |
$mode = filter_input( INPUT_POST, 'mode', FILTER_DEFAULT ); |
| 2262 |
$data = array(); |
| 2263 |
|
| 2264 |
switch ( $mode ) { |
| 2265 |
/* 取引参� |
| 2266 |
� */ |
| 2267 |
case 'get_welcartpay_card': |
| 2268 |
check_admin_referer( 'order_edit', 'wc_nonce' ); |
| 2269 |
$order_id = filter_input( INPUT_POST, 'order_id' ); |
| 2270 |
$order_num = filter_input( INPUT_POST, 'order_num' ); |
| 2271 |
$trans_id = filter_input( INPUT_POST, 'trans_id' ); |
| 2272 |
if ( is_null( $order_id ) || is_null( $order_num ) || is_null( $trans_id ) ) { |
| 2273 |
$data['status'] = 'NG'; |
| 2274 |
$data['result'] = ''; |
| 2275 |
wp_send_json( $data ); |
| 2276 |
break; |
| 2277 |
} |
| 2278 |
$res = ''; |
| 2279 |
$log_data = array(); |
| 2280 |
if ( '9999999999' === $trans_id ) { |
| 2281 |
$member_id = filter_input( INPUT_POST, 'member_id' ); |
| 2282 |
$response_member = $this->escott_member_reference( $member_id ); /* e-SCOTT 会員� |
| 2283 |
�会 */ |
| 2284 |
if ( 'OK' === $response_member['ResponseCd'] ) { |
| 2285 |
$order_data = $usces->get_order_data( $order_id, 'direct' ); |
| 2286 |
$total_full_price = $order_data['order_item_total_price'] - $order_data['order_usedpoint'] + $order_data['order_discount'] + $order_data['order_shipping_charge'] + $order_data['order_cod_fee'] + $order_data['order_tax']; |
| 2287 |
|
| 2288 |
$res .= '<div class="welcart-settlement-admin card-new">' . __( 'New', 'usces' ) . '</div>'; |
| 2289 |
$res .= '<table class="welcart-settlement-admin-table">'; |
| 2290 |
$res .= '<tr><th>' . __( 'Spending amount', 'usces' ) . '</th>'; |
| 2291 |
$res .= '<td><input type="text" id="amount_change" value="' . $total_full_price . '" style="text-align:right;ime-mode:disabled" size="10" />' . __( usces_crcode( 'return' ), 'usces' ) . '<input type="hidden" id="amount" value="' . $total_full_price . '" /></td>'; |
| 2292 |
$res .= '</tr>'; |
| 2293 |
$res .= '</table>'; |
| 2294 |
$res .= '<div class="welcart-settlement-admin-button">'; |
| 2295 |
$res .= '<input id="auth-settlement" type="button" class="button" value="' . __( 'Credit', 'usces' ) . '" />'; /* 与信 */ |
| 2296 |
$res .= '<input id="gathering-settlement" type="button" class="button" value="' . __( 'Credit sales', 'usces' ) . '" />'; /* 与信売上計上 */ |
| 2297 |
$res .= '</div>'; |
| 2298 |
} else { |
| 2299 |
$res .= '<div class="welcart-settlement-admin card-error">' . __( 'Error', 'usces' ) . '</div>'; |
| 2300 |
$res .= '<div class="welcart-settlement-admin-error">'; |
| 2301 |
$res .= '<div><span class="message">' . __( 'Credit card information not registered', 'usces' ) . '</span></div>'; /* カード� |
| 2302 |
報未登録 */ |
| 2303 |
$res .= '</div>'; |
| 2304 |
} |
| 2305 |
$data['status'] = 'OK'; |
| 2306 |
$data['result'] = $res; |
| 2307 |
} else { |
| 2308 |
if ( 1 === (int) $order_num ) { |
| 2309 |
$acting_data = usces_unserialize( $usces->get_order_meta_value( 'acting_welcart_card', $order_id ) ); |
| 2310 |
} else { |
| 2311 |
$log_data = $this->get_acting_log( $order_id, $order_id . '_' . $trans_id ); |
| 2312 |
$acting_data = usces_unserialize( $log_data[0]['log'] ); |
| 2313 |
} |
| 2314 |
$operateid = $this->get_acting_operateid( $order_id . '_' . $trans_id ); |
| 2315 |
$acting_opts = $this->get_acting_settings(); |
| 2316 |
$transaction_date = $this->get_transaction_date(); |
| 2317 |
$param_list = array(); |
| 2318 |
$params = array(); |
| 2319 |
$param_list['MerchantId'] = $acting_opts['merchant_id']; |
| 2320 |
$param_list['MerchantPass'] = $acting_opts['merchant_pass']; |
| 2321 |
$param_list['TransactionDate'] = $transaction_date; |
| 2322 |
$param_list['MerchantFree1'] = $trans_id; |
| 2323 |
$param_list['MerchantFree2'] = 'acting_welcart_card'; |
| 2324 |
$param_list['MerchantFree3'] = $this->merchantfree3; |
| 2325 |
$param_list['TenantId'] = $acting_opts['tenant_id']; |
| 2326 |
$params['send_url'] = $acting_opts['send_url']; |
| 2327 |
$params['param_list'] = array_merge( |
| 2328 |
$param_list, |
| 2329 |
array( |
| 2330 |
'OperateId' => '1Search', |
| 2331 |
'ProcessId' => $acting_data['ProcessId'], |
| 2332 |
'ProcessPass' => $acting_data['ProcessPass'], |
| 2333 |
) |
| 2334 |
); |
| 2335 |
$response_data = $this->connection( $params ); |
| 2336 |
if ( 'OK' === $response_data['ResponseCd'] ) { |
| 2337 |
$latest_log = $this->get_acting_latest_log( $order_id . '_' . $trans_id ); |
| 2338 |
if ( isset( $latest_log['OperateId'] ) ) { |
| 2339 |
$class = ' card-' . mb_strtolower( substr( $latest_log['OperateId'], 1 ) ); |
| 2340 |
$status_name = $this->get_operate_name( $latest_log['OperateId'] ); |
| 2341 |
$res .= '<div class="welcart-settlement-admin' . $class . '">' . $status_name . '</div>'; |
| 2342 |
$res .= '<table class="welcart-settlement-admin-table">'; |
| 2343 |
if ( isset( $response_data['Amount'] ) ) { |
| 2344 |
$res .= '<tr><th>' . __( 'Spending amount', 'usces' ) . '</th>'; |
| 2345 |
$res .= '<td><input type="text" id="amount_change" value="' . $response_data['Amount'] . '" style="text-align:right;ime-mode:disabled" size="10" />' . __( usces_crcode( 'return' ), 'usces' ) . '<input type="hidden" id="amount" value="' . $response_data['Amount'] . '" /></td>'; |
| 2346 |
$res .= '</tr>'; |
| 2347 |
} |
| 2348 |
if ( isset( $response_data['SalesDate'] ) ) { |
| 2349 |
$res .= '<tr><th>' . __( 'Recorded sales date', 'usces' ) . '</th><td>' . $response_data['SalesDate'] . '</td></tr>'; |
| 2350 |
} |
| 2351 |
$res .= '</table>'; |
| 2352 |
$res .= '<div class="welcart-settlement-admin-button">'; |
| 2353 |
if ( '1Delete' === $latest_log['OperateId'] ) { |
| 2354 |
$res .= '<input id="reauth-settlement" type="button" class="button" value="' . __( 'Re-authorization', 'usces' ) . '" />'; /* 再オーソリ */ |
| 2355 |
} else { |
| 2356 |
if ( '1Auth' === $operateid && '1Capture' !== $latest_log['OperateId'] && '1Gathering' !== $latest_log['OperateId'] ) { |
| 2357 |
$res .= '<input id="reauth-settlement" type="button" class="button" value="' . __( 'Re-authorization', 'usces' ) . '" />'; /* 再オーソリ */ |
| 2358 |
$res .= '<input id="capture-settlement" type="button" class="button" value="' . __( 'Sales recorded', 'usces' ) . '" />'; /* 売上計上 */ |
| 2359 |
} |
| 2360 |
if ( '1Delete' !== $latest_log['OperateId'] ) { |
| 2361 |
$res .= '<input id="delete-settlement" type="button" class="button" value="' . __( 'Unregister', 'usces' ) . '" />'; /* 取消 */ |
| 2362 |
} |
| 2363 |
if ( '1Change' !== $latest_log['OperateId'] ) { |
| 2364 |
$res .= '<input id="change-settlement" type="button" class="button" value="' . __( 'Change spending amount', 'usces' ) . '" />'; /* 利用額変更 */ |
| 2365 |
} |
| 2366 |
} |
| 2367 |
$res .= '</div>'; |
| 2368 |
} |
| 2369 |
} else { |
| 2370 |
if ( 'K12' === $response_data['ResponseCd'] ) { |
| 2371 |
$res .= '<div class="welcart-settlement-admin card-delete">' . __( 'Expired', 'usces' ) . '</div>'; |
| 2372 |
$res .= '<div class="welcart-settlement-admin-expired">'; |
| 2373 |
$res .= '<div><span class="code">K12</span> : <span class="message">' . __( 'Handling expired.', 'usces' ) . '</span></div>'; |
| 2374 |
$res .= '</div>'; |
| 2375 |
} else { |
| 2376 |
$res .= '<div class="welcart-settlement-admin card-error">' . __( 'Error', 'usces' ) . '</div>'; |
| 2377 |
$res .= '<div class="welcart-settlement-admin-error">'; |
| 2378 |
$responsecd = explode( '|', $response_data['ResponseCd'] ); |
| 2379 |
foreach ( (array) $responsecd as $cd ) { |
| 2380 |
$res .= '<div><span class="code">' . $cd . '</span> : <span class="message">' . $this->response_message( $cd ) . '</span></div>'; |
| 2381 |
} |
| 2382 |
$res .= '</div>'; |
| 2383 |
usces_log( '[WelcartPay] 1Search connection NG : ' . print_r( $response_data, true ), 'acting_transaction.log' ); |
| 2384 |
} |
| 2385 |
} |
| 2386 |
$res .= $this->settlement_history( $order_id . '_' . $trans_id ); |
| 2387 |
$data['status'] = $response_data['ResponseCd']; |
| 2388 |
$data['result'] = $res; |
| 2389 |
} |
| 2390 |
wp_send_json( $data ); |
| 2391 |
break; |
| 2392 |
|
| 2393 |
/* 売上計上 */ |
| 2394 |
case 'capture_welcartpay_card': |
| 2395 |
check_admin_referer( 'order_edit', 'wc_nonce' ); |
| 2396 |
$order_id = filter_input( INPUT_POST, 'order_id' ); |
| 2397 |
$order_num = filter_input( INPUT_POST, 'order_num' ); |
| 2398 |
$trans_id = filter_input( INPUT_POST, 'trans_id' ); |
| 2399 |
$amount = filter_input( INPUT_POST, 'amount' ); |
| 2400 |
if ( is_null( $order_id ) || is_null( $order_num ) || is_null( $trans_id ) ) { |
| 2401 |
$data['status'] = 'NG'; |
| 2402 |
wp_send_json( $data ); |
| 2403 |
break; |
| 2404 |
} |
| 2405 |
$res = ''; |
| 2406 |
$acting_status = ''; |
| 2407 |
$log_data = array(); |
| 2408 |
if ( 1 === (int) $order_num ) { |
| 2409 |
$acting_data = usces_unserialize( $usces->get_order_meta_value( 'acting_welcart_card', $order_id ) ); |
| 2410 |
} else { |
| 2411 |
$log_data = $this->get_acting_log( $order_id, $order_id . '_' . $trans_id ); |
| 2412 |
$acting_data = usces_unserialize( $log_data[0]['log'] ); |
| 2413 |
} |
| 2414 |
$acting_opts = $this->get_acting_settings(); |
| 2415 |
$transaction_date = $this->get_transaction_date(); |
| 2416 |
$param_list = array(); |
| 2417 |
$params = array(); |
| 2418 |
$param_list['MerchantId'] = $acting_opts['merchant_id']; |
| 2419 |
$param_list['MerchantPass'] = $acting_opts['merchant_pass']; |
| 2420 |
$param_list['TransactionDate'] = $transaction_date; |
| 2421 |
$param_list['MerchantFree1'] = $trans_id; |
| 2422 |
$param_list['MerchantFree2'] = 'acting_welcart_card'; |
| 2423 |
$param_list['MerchantFree3'] = $this->merchantfree3; |
| 2424 |
$param_list['TenantId'] = $acting_opts['tenant_id']; |
| 2425 |
$member_id = filter_input( INPUT_POST, 'member_id' ); |
| 2426 |
$response_member = $this->escott_member_reference( $member_id ); /* e-SCOTT 会員� |
| 2427 |
�会 */ |
| 2428 |
if ( 'OK' === $response_member['ResponseCd'] ) { |
| 2429 |
$param_list['KaiinId'] = $response_member['KaiinId']; |
| 2430 |
$param_list['KaiinPass'] = $response_member['KaiinPass']; |
| 2431 |
} |
| 2432 |
$params['send_url'] = $acting_opts['send_url']; |
| 2433 |
$params['param_list'] = array_merge( |
| 2434 |
$param_list, |
| 2435 |
array( |
| 2436 |
'OperateId' => '1Capture', |
| 2437 |
'ProcessId' => $acting_data['ProcessId'], |
| 2438 |
'ProcessPass' => $acting_data['ProcessPass'], |
| 2439 |
'SalesDate' => $transaction_date, |
| 2440 |
) |
| 2441 |
); |
| 2442 |
$response_data = $this->connection( $params ); |
| 2443 |
if ( 'K81' === $response_data['ResponseCd'] ) { |
| 2444 |
$param_list['KaiinId'] = ''; |
| 2445 |
$param_list['KaiinPass'] = ''; |
| 2446 |
$params['param_list'] = array_merge( |
| 2447 |
$param_list, |
| 2448 |
array( |
| 2449 |
'OperateId' => '1Capture', |
| 2450 |
'ProcessId' => $acting_data['ProcessId'], |
| 2451 |
'ProcessPass' => $acting_data['ProcessPass'], |
| 2452 |
'SalesDate' => $transaction_date, |
| 2453 |
) |
| 2454 |
); |
| 2455 |
$response_data = $this->connection( $params ); |
| 2456 |
} |
| 2457 |
if ( 'OK' === $response_data['ResponseCd'] ) { |
| 2458 |
$class = ' card-' . mb_strtolower( substr( $response_data['OperateId'], 1 ) ); |
| 2459 |
$status_name = $this->get_operate_name( $response_data['OperateId'] ); |
| 2460 |
$res .= '<div class="welcart-settlement-admin' . $class . '">' . $status_name . '</div>'; |
| 2461 |
$res .= '<table class="welcart-settlement-admin-table">'; |
| 2462 |
$res .= '<tr><th>' . __( 'Spending amount', 'usces' ) . '</th>'; |
| 2463 |
$res .= '<td><input type="text" id="amount_change" value="' . $amount . '" style="text-align:right;ime-mode:disabled" size="10" />' . __( usces_crcode( 'return' ), 'usces' ) . '<input type="hidden" id="amount" value="' . $amount . '" /></td>'; |
| 2464 |
$res .= '</tr>'; |
| 2465 |
if ( isset( $response_data['SalesDate'] ) ) { |
| 2466 |
$res .= '<tr><th>' . __( 'Recorded sales date', 'usces' ) . '</th><td>' . $response_data['SalesDate'] . '</td></tr>'; |
| 2467 |
} |
| 2468 |
$res .= '</table>'; |
| 2469 |
$res .= '<div class="welcart-settlement-admin-button">'; |
| 2470 |
$res .= '<input id="delete-settlement" type="button" class="button" value="' . __( 'Unregister', 'usces' ) . '" />'; /* 取消 */ |
| 2471 |
$res .= '<input id="change-settlement" type="button" class="button" value="' . __( 'Change spending amount', 'usces' ) . '" />'; /* 利用額変更 */ |
| 2472 |
$res .= '</div>'; |
| 2473 |
$acting_status = '<span class="acting-status' . $class . '">' . $status_name . '</span>'; |
| 2474 |
} else { |
| 2475 |
$res .= '<div class="welcart-settlement-admin card-error">' . __( 'Error', 'usces' ) . '</div>'; |
| 2476 |
$res .= '<div class="welcart-settlement-admin-error">'; |
| 2477 |
$responsecd = explode( '|', $response_data['ResponseCd'] ); |
| 2478 |
foreach ( (array) $responsecd as $cd ) { |
| 2479 |
$res .= '<div><span class="code">' . $cd . '</span> : <span class="message">' . $this->response_message( $cd ) . '</span></div>'; |
| 2480 |
} |
| 2481 |
$res .= '</div>'; |
| 2482 |
usces_log( '[WelcartPay] 1Capture connection NG : ' . print_r( $response_data, true ), 'acting_transaction.log' ); |
| 2483 |
} |
| 2484 |
do_action( 'usces_action_admin_' . $mode, $response_data, $order_id, $trans_id ); |
| 2485 |
if ( ! isset( $response_data['Amount'] ) ) { |
| 2486 |
$response_data['Amount'] = $amount; |
| 2487 |
} |
| 2488 |
$response_data = apply_filters( 'usces_filter_escott_capture_history_log', $response_data, $order_id ); |
| 2489 |
$this->save_acting_history_log( $response_data, $order_id . '_' . $trans_id ); |
| 2490 |
$res .= $this->settlement_history( $order_id . '_' . $trans_id ); |
| 2491 |
$data['status'] = $response_data['ResponseCd']; |
| 2492 |
$data['acting_status'] = $acting_status; |
| 2493 |
$data['result'] = $res; |
| 2494 |
$this->save_admin_log( $order_id, $order_id . '_' . $trans_id ); |
| 2495 |
wp_send_json( $data ); |
| 2496 |
break; |
| 2497 |
|
| 2498 |
/* 取消/返品 */ |
| 2499 |
case 'delete_welcartpay_card': |
| 2500 |
check_admin_referer( 'order_edit', 'wc_nonce' ); |
| 2501 |
$order_id = filter_input( INPUT_POST, 'order_id' ); |
| 2502 |
$order_num = filter_input( INPUT_POST, 'order_num' ); |
| 2503 |
$trans_id = filter_input( INPUT_POST, 'trans_id' ); |
| 2504 |
$amount = filter_input( INPUT_POST, 'amount' ); |
| 2505 |
if ( is_null( $order_id ) || is_null( $order_num ) || is_null( $trans_id ) ) { |
| 2506 |
$data['status'] = 'NG'; |
| 2507 |
wp_send_json( $data ); |
| 2508 |
break; |
| 2509 |
} |
| 2510 |
$res = ''; |
| 2511 |
$acting_status = ''; |
| 2512 |
$log_data = array(); |
| 2513 |
if ( 1 === (int) $order_num ) { |
| 2514 |
$acting_data = usces_unserialize( $usces->get_order_meta_value( 'acting_welcart_card', $order_id ) ); |
| 2515 |
} else { |
| 2516 |
$log_data = $this->get_acting_log( $order_id, $order_id . '_' . $trans_id ); |
| 2517 |
$acting_data = usces_unserialize( $log_data[0]['log'] ); |
| 2518 |
} |
| 2519 |
$acting_opts = $this->get_acting_settings(); |
| 2520 |
$transaction_date = $this->get_transaction_date(); |
| 2521 |
$param_list = array(); |
| 2522 |
$params = array(); |
| 2523 |
$param_list['MerchantId'] = $acting_opts['merchant_id']; |
| 2524 |
$param_list['MerchantPass'] = $acting_opts['merchant_pass']; |
| 2525 |
$param_list['TransactionDate'] = $transaction_date; |
| 2526 |
$param_list['MerchantFree1'] = $trans_id; |
| 2527 |
$param_list['MerchantFree2'] = 'acting_welcart_card'; |
| 2528 |
$param_list['MerchantFree3'] = $this->merchantfree3; |
| 2529 |
$param_list['TenantId'] = $acting_opts['tenant_id']; |
| 2530 |
$member_id = filter_input( INPUT_POST, 'member_id' ); |
| 2531 |
$response_member = $this->escott_member_reference( $member_id ); /* e-SCOTT 会員� |
| 2532 |
�会 */ |
| 2533 |
if ( 'OK' === $response_member['ResponseCd'] ) { |
| 2534 |
$param_list['KaiinId'] = $response_member['KaiinId']; |
| 2535 |
$param_list['KaiinPass'] = $response_member['KaiinPass']; |
| 2536 |
} |
| 2537 |
$params['send_url'] = $acting_opts['send_url']; |
| 2538 |
$params['param_list'] = array_merge( |
| 2539 |
$param_list, |
| 2540 |
array( |
| 2541 |
'OperateId' => '1Delete', |
| 2542 |
'ProcessId' => $acting_data['ProcessId'], |
| 2543 |
'ProcessPass' => $acting_data['ProcessPass'], |
| 2544 |
) |
| 2545 |
); |
| 2546 |
$response_data = $this->connection( $params ); |
| 2547 |
if ( 'K81' === $response_data['ResponseCd'] ) { |
| 2548 |
$param_list['KaiinId'] = ''; |
| 2549 |
$param_list['KaiinPass'] = ''; |
| 2550 |
$params['param_list'] = array_merge( |
| 2551 |
$param_list, |
| 2552 |
array( |
| 2553 |
'OperateId' => '1Delete', |
| 2554 |
'ProcessId' => $acting_data['ProcessId'], |
| 2555 |
'ProcessPass' => $acting_data['ProcessPass'], |
| 2556 |
) |
| 2557 |
); |
| 2558 |
$response_data = $this->connection( $params ); |
| 2559 |
} |
| 2560 |
if ( 'OK' === $response_data['ResponseCd'] ) { |
| 2561 |
$class = ' card-' . mb_strtolower( substr( $response_data['OperateId'], 1 ) ); |
| 2562 |
$status_name = $this->get_operate_name( $response_data['OperateId'] ); |
| 2563 |
$res .= '<div class="welcart-settlement-admin' . $class . '">' . $status_name . '</div>'; |
| 2564 |
$res .= '<table class="welcart-settlement-admin-table">'; |
| 2565 |
$res .= '<tr><th>' . __( 'Spending amount', 'usces' ) . '</th>'; |
| 2566 |
$res .= '<td><input type="text" id="amount_change" value="' . $amount . '" style="text-align:right;ime-mode:disabled" size="10" />' . __( usces_crcode( 'return' ), 'usces' ) . '<input type="hidden" id="amount" value="' . $amount . '" /></td>'; |
| 2567 |
$res .= '</tr>'; |
| 2568 |
$res .= '</table>'; |
| 2569 |
$res .= '<div class="welcart-settlement-admin-button">'; |
| 2570 |
$res .= '<input id="reauth-settlement" type="button" class="button" value="' . __( 'Re-authorization', 'usces' ) . '" />'; /* 再オーソリ */ |
| 2571 |
$res .= '</div>'; |
| 2572 |
$acting_status = '<span class="acting-status' . $class . '">' . $status_name . '</span>'; |
| 2573 |
} else { |
| 2574 |
$res .= '<div class="welcart-settlement-admin card-error">' . __( 'Error', 'usces' ) . '</div>'; |
| 2575 |
$res .= '<div class="welcart-settlement-admin-error">'; |
| 2576 |
$responsecd = explode( '|', $response_data['ResponseCd'] ); |
| 2577 |
foreach ( (array) $responsecd as $cd ) { |
| 2578 |
$res .= '<div><span class="code">' . $cd . '</span> : <span class="message">' . $this->response_message( $cd ) . '</span></div>'; |
| 2579 |
} |
| 2580 |
$res .= '</div>'; |
| 2581 |
usces_log( '[WelcartPay] 1Delete connection NG : ' . print_r( $response_data, true ), 'acting_transaction.log' ); |
| 2582 |
} |
| 2583 |
do_action( 'usces_action_admin_' . $mode, $response_data, $order_id, $trans_id ); |
| 2584 |
if ( ! isset( $response_data['Amount'] ) ) { |
| 2585 |
$response_data['Amount'] = $amount; |
| 2586 |
} |
| 2587 |
$response_data = apply_filters( 'usces_filter_escott_delete_history_log', $response_data, $order_id ); |
| 2588 |
$this->save_acting_history_log( $response_data, $order_id . '_' . $trans_id ); |
| 2589 |
$res .= $this->settlement_history( $order_id . '_' . $trans_id ); |
| 2590 |
$data['status'] = $response_data['ResponseCd']; |
| 2591 |
$data['acting_status'] = $acting_status; |
| 2592 |
$data['result'] = $res; |
| 2593 |
$this->save_admin_log( $order_id, $order_id . '_' . $trans_id ); |
| 2594 |
wp_send_json( $data ); |
| 2595 |
break; |
| 2596 |
|
| 2597 |
/* 利用額変更 */ |
| 2598 |
case 'change_welcartpay_card': |
| 2599 |
check_admin_referer( 'order_edit', 'wc_nonce' ); |
| 2600 |
$order_id = filter_input( INPUT_POST, 'order_id' ); |
| 2601 |
$order_num = filter_input( INPUT_POST, 'order_num' ); |
| 2602 |
$trans_id = filter_input( INPUT_POST, 'trans_id' ); |
| 2603 |
$amount = filter_input( INPUT_POST, 'amount' ); |
| 2604 |
if ( is_null( $order_id ) || is_null( $order_num ) || is_null( $trans_id ) || is_null( $amount ) ) { |
| 2605 |
$data['status'] = 'NG'; |
| 2606 |
wp_send_json( $data ); |
| 2607 |
break; |
| 2608 |
} |
| 2609 |
$res = ''; |
| 2610 |
$log_data = array(); |
| 2611 |
if ( 1 === (int) $order_num ) { |
| 2612 |
$acting_data = usces_unserialize( $usces->get_order_meta_value( 'acting_welcart_card', $order_id ) ); |
| 2613 |
} else { |
| 2614 |
$log_data = $this->get_acting_log( $order_id, $order_id . '_' . $trans_id ); |
| 2615 |
$acting_data = usces_unserialize( $log_data[0]['log'] ); |
| 2616 |
} |
| 2617 |
$operateid = $this->get_acting_operateid( $order_id . '_' . $trans_id ); |
| 2618 |
$acting_opts = $this->get_acting_settings(); |
| 2619 |
$transaction_date = $this->get_transaction_date(); |
| 2620 |
$param_list = array(); |
| 2621 |
$params = array(); |
| 2622 |
$param_list['MerchantId'] = $acting_opts['merchant_id']; |
| 2623 |
$param_list['MerchantPass'] = $acting_opts['merchant_pass']; |
| 2624 |
$param_list['TransactionDate'] = $transaction_date; |
| 2625 |
$param_list['MerchantFree1'] = $trans_id; |
| 2626 |
$param_list['MerchantFree2'] = 'acting_welcart_card'; |
| 2627 |
$param_list['MerchantFree3'] = $this->merchantfree3; |
| 2628 |
$param_list['TenantId'] = $acting_opts['tenant_id']; |
| 2629 |
$member_id = filter_input( INPUT_POST, 'member_id' ); |
| 2630 |
$response_member = $this->escott_member_reference( $member_id ); /* e-SCOTT 会員� |
| 2631 |
�会 */ |
| 2632 |
if ( 'OK' === $response_member['ResponseCd'] ) { |
| 2633 |
$param_list['KaiinId'] = $response_member['KaiinId']; |
| 2634 |
$param_list['KaiinPass'] = $response_member['KaiinPass']; |
| 2635 |
} |
| 2636 |
$params['send_url'] = $acting_opts['send_url']; |
| 2637 |
$params['param_list'] = array_merge( |
| 2638 |
$param_list, |
| 2639 |
array( |
| 2640 |
'OperateId' => '1Change', |
| 2641 |
'ProcessId' => $acting_data['ProcessId'], |
| 2642 |
'ProcessPass' => $acting_data['ProcessPass'], |
| 2643 |
'Amount' => $amount, |
| 2644 |
) |
| 2645 |
); |
| 2646 |
$response_data = $this->connection( $params ); |
| 2647 |
if ( 'K81' === $response_data['ResponseCd'] ) { |
| 2648 |
$param_list['KaiinId'] = ''; |
| 2649 |
$param_list['KaiinPass'] = ''; |
| 2650 |
$params['param_list'] = array_merge( |
| 2651 |
$param_list, |
| 2652 |
array( |
| 2653 |
'OperateId' => '1Change', |
| 2654 |
'ProcessId' => $acting_data['ProcessId'], |
| 2655 |
'ProcessPass' => $acting_data['ProcessPass'], |
| 2656 |
'Amount' => $amount, |
| 2657 |
) |
| 2658 |
); |
| 2659 |
$response_data = $this->connection( $params ); |
| 2660 |
} |
| 2661 |
if ( 'OK' === $response_data['ResponseCd'] ) { |
| 2662 |
$class = ' card-' . mb_strtolower( substr( $operateid, 1 ) ); |
| 2663 |
$status_name = $this->get_operate_name( $operateid ); |
| 2664 |
$res .= '<div class="welcart-settlement-admin' . $class . '">' . $status_name . '</div>'; |
| 2665 |
$res .= '<table class="welcart-settlement-admin-table">'; |
| 2666 |
$res .= '<tr><th>' . __( 'Spending amount', 'usces' ) . '</th>'; |
| 2667 |
$res .= '<td><input type="text" id="amount_change" value="' . $amount . '" style="text-align:right;ime-mode:disabled" size="10" />' . __( usces_crcode( 'return' ), 'usces' ) . '<input type="hidden" id="amount" value="' . $amount . '" /></td>'; |
| 2668 |
$res .= '</tr>'; |
| 2669 |
if ( isset( $response_data['SalesDate'] ) ) { |
| 2670 |
$res .= '<tr><th>' . __( 'Recorded sales date', 'usces' ) . '</th><td>' . $response_data['SalesDate'] . '</td></tr>'; |
| 2671 |
} |
| 2672 |
$res .= '</table>'; |
| 2673 |
$res .= '<div class="welcart-settlement-admin-button">'; |
| 2674 |
if ( '1Capture' !== $operateid && '1Gathering' !== $operateid ) { |
| 2675 |
$res .= '<input id="capture-settlement" type="button" class="button" value="' . __( 'Sales recorded', 'usces' ) . '" />'; /* 売上計上 */ |
| 2676 |
} |
| 2677 |
$res .= '<input id="delete-settlement" type="button" class="button" value="' . __( 'Unregister', 'usces' ) . '" />'; /* 取消 */ |
| 2678 |
$res .= '<input id="change-settlement" type="button" class="button" value="' . __( 'Change spending amount', 'usces' ) . '" />'; /* 利用額変更 */ |
| 2679 |
$res .= '</div>'; |
| 2680 |
} else { |
| 2681 |
$res .= '<div class="welcart-settlement-admin card-error">' . __( 'Error', 'usces' ) . '</div>'; /* エラー */ |
| 2682 |
$res .= '<div class="welcart-settlement-admin-error">'; |
| 2683 |
$responsecd = explode( '|', $response_data['ResponseCd'] ); |
| 2684 |
foreach ( (array) $responsecd as $cd ) { |
| 2685 |
$res .= '<div><span class="code">' . $cd . '</span> : <span class="message">' . $this->response_message( $cd ) . '</span></div>'; |
| 2686 |
} |
| 2687 |
$res .= '</div>'; |
| 2688 |
usces_log( '[WelcartPay] 1Change connection NG : ' . print_r( $response_data, true ), 'acting_transaction.log' ); |
| 2689 |
} |
| 2690 |
do_action( 'usces_action_admin_' . $mode, $response_data, $order_id, $trans_id ); |
| 2691 |
if ( ! isset( $response_data['Amount'] ) ) { |
| 2692 |
$response_data['Amount'] = $amount; |
| 2693 |
} |
| 2694 |
$response_data = apply_filters( 'usces_filter_escott_change_history_log', $response_data, $order_id ); |
| 2695 |
$this->save_acting_history_log( $response_data, $order_id . '_' . $trans_id ); |
| 2696 |
$res .= $this->settlement_history( $order_id . '_' . $trans_id ); |
| 2697 |
$data['status'] = $response_data['ResponseCd']; |
| 2698 |
$data['result'] = $res; |
| 2699 |
$this->save_admin_log( $order_id, $order_id . '_' . $trans_id ); |
| 2700 |
wp_send_json( $data ); |
| 2701 |
break; |
| 2702 |
|
| 2703 |
/* 与信 */ |
| 2704 |
case 'auth_welcartpay_card': |
| 2705 |
/* 与信売上計上 */ |
| 2706 |
case 'gathering_welcartpay_card': |
| 2707 |
check_admin_referer( 'order_edit', 'wc_nonce' ); |
| 2708 |
$order_id = filter_input( INPUT_POST, 'order_id' ); |
| 2709 |
$order_num = filter_input( INPUT_POST, 'order_num' ); |
| 2710 |
$trans_id = filter_input( INPUT_POST, 'trans_id' ); |
| 2711 |
$amount = filter_input( INPUT_POST, 'amount' ); |
| 2712 |
if ( is_null( $order_id ) || is_null( $order_num ) || is_null( $trans_id ) || is_null( $amount ) ) { |
| 2713 |
$data['status'] = 'NG'; |
| 2714 |
wp_send_json( $data ); |
| 2715 |
break; |
| 2716 |
} |
| 2717 |
$res = ''; |
| 2718 |
$acting_status = ''; |
| 2719 |
$log_data = array(); |
| 2720 |
if ( '9999999999' === $trans_id ) { |
| 2721 |
$trans_id = usces_acting_key(); |
| 2722 |
} else { |
| 2723 |
if ( 1 === (int) $order_num ) { |
| 2724 |
$acting_data = usces_unserialize( $usces->get_order_meta_value( 'acting_welcart_card', $order_id ) ); |
| 2725 |
} else { |
| 2726 |
$log_data = $this->get_acting_log( $order_id, $order_id . '_' . $trans_id ); |
| 2727 |
$acting_data = usces_unserialize( $log_data[0]['log'] ); |
| 2728 |
} |
| 2729 |
} |
| 2730 |
$operateid = ( 'auth_welcartpay_card' === $mode ) ? '1Auth' : '1Gathering'; |
| 2731 |
$acting_opts = $this->get_acting_settings(); |
| 2732 |
$transaction_date = $this->get_transaction_date(); |
| 2733 |
$param_list = array(); |
| 2734 |
$params = array(); |
| 2735 |
$param_list['MerchantId'] = $acting_opts['merchant_id']; |
| 2736 |
$param_list['MerchantPass'] = $acting_opts['merchant_pass']; |
| 2737 |
$param_list['TransactionDate'] = $transaction_date; |
| 2738 |
$param_list['MerchantFree1'] = $trans_id; |
| 2739 |
$param_list['MerchantFree2'] = 'acting_welcart_card'; |
| 2740 |
$param_list['MerchantFree3'] = $this->merchantfree3; |
| 2741 |
$param_list['TenantId'] = $acting_opts['tenant_id']; |
| 2742 |
$member_id = filter_input( INPUT_POST, 'member_id' ); |
| 2743 |
$response_member = $this->escott_member_reference( $member_id ); /* e-SCOTT 会員� |
| 2744 |
�会 */ |
| 2745 |
if ( 'OK' === $response_member['ResponseCd'] ) { |
| 2746 |
$params['send_url'] = $acting_opts['send_url']; |
| 2747 |
$params['param_list'] = array_merge( |
| 2748 |
$param_list, |
| 2749 |
array( |
| 2750 |
'KaiinId' => $response_member['KaiinId'], |
| 2751 |
'KaiinPass' => $response_member['KaiinPass'], |
| 2752 |
'OperateId' => $operateid, |
| 2753 |
'PayType' => '01', |
| 2754 |
'Amount' => $amount, |
| 2755 |
) |
| 2756 |
); |
| 2757 |
$response_data = $this->connection( $params ); |
| 2758 |
if ( 'OK' === $response_data['ResponseCd'] ) { |
| 2759 |
if ( 1 === (int) $order_num ) { |
| 2760 |
$cardlast4 = substr( $response_member['CardNo'], -4 ); |
| 2761 |
$expyy = substr( date_i18n( 'Y', current_time( 'timestamp' ) ), 0, 2 ) . substr( $response_member['CardExp'], 0, 2 ); |
| 2762 |
$expmm = substr( $response_member['CardExp'], 2, 2 ); |
| 2763 |
$response_data['acting'] = $this->acting_card; |
| 2764 |
$response_data['CardNo'] = $cardlast4; |
| 2765 |
$response_data['CardExp'] = $expyy . '/' . $expmm; |
| 2766 |
$usces->set_order_meta_value( 'acting_welcart_card', usces_serialize( $response_data ), $order_id ); |
| 2767 |
$usces->set_order_meta_value( 'trans_id', $trans_id, $order_id ); |
| 2768 |
$usces->set_order_meta_value( 'wc_trans_id', $trans_id, $order_id ); |
| 2769 |
} else { |
| 2770 |
if ( $log_data ) { |
| 2771 |
$this->update_acting_log( $response_data, $order_id . '_' . $trans_id ); |
| 2772 |
} |
| 2773 |
} |
| 2774 |
|
| 2775 |
$class = ' card-' . mb_strtolower( substr( $operateid, 1 ) ); |
| 2776 |
$status_name = $this->get_operate_name( $operateid ); |
| 2777 |
$res .= '<div class="welcart-settlement-admin' . $class . '">' . $status_name . '</div>'; |
| 2778 |
$res .= '<table class="welcart-settlement-admin-table">'; |
| 2779 |
$res .= '<tr><th>' . __( 'Spending amount', 'usces' ) . '</th>'; |
| 2780 |
$res .= '<td><input type="text" id="amount_change" value="' . $amount . '" style="text-align:right;ime-mode:disabled" size="10" />' . __( usces_crcode( 'return' ), 'usces' ) . '<input type="hidden" id="amount" value="' . $amount . '" /></td>'; |
| 2781 |
$res .= '</tr>'; |
| 2782 |
$res .= '</table>'; |
| 2783 |
$res .= '<div class="welcart-settlement-admin-button">'; |
| 2784 |
if ( '1Capture' !== $operateid && '1Gathering' !== $operateid ) { |
| 2785 |
$res .= '<input id="capture-settlement" type="button" class="button" value="' . __( 'Sales recorded', 'usces' ) . '" />'; /* 売上計上 */ |
| 2786 |
} |
| 2787 |
$res .= '<input id="delete-settlement" type="button" class="button" value="' . __( 'Unregister', 'usces' ) . '" />'; /* 取消 */ |
| 2788 |
$res .= '<input id="change-settlement" type="button" class="button" value="' . __( 'Change spending amount', 'usces' ) . '" />'; /* 利用額変更 */ |
| 2789 |
$res .= '</div>'; |
| 2790 |
$acting_status = '<span class="acting-status' . $class . '">' . $status_name . '</span>'; |
| 2791 |
} else { |
| 2792 |
$res .= '<div class="welcart-settlement-admin card-error">' . __( 'Error', 'usces' ) . '</div>'; /* エラー */ |
| 2793 |
$res .= '<div class="welcart-settlement-admin-error">'; |
| 2794 |
$responsecd = explode( '|', $response_data['ResponseCd'] ); |
| 2795 |
foreach ( (array) $responsecd as $cd ) { |
| 2796 |
$res .= '<div><span class="code">' . $cd . '</span> : <span class="message">' . $this->response_message( $cd ) . '</span></div>'; |
| 2797 |
} |
| 2798 |
$res .= '</div>'; |
| 2799 |
usces_log( '[WelcartPay] ' . $operateid . ' connection NG : ' . print_r( $response_data, true ), 'acting_transaction.log' ); |
| 2800 |
} |
| 2801 |
do_action( 'usces_action_admin_' . $mode, $response_data, $order_id, $trans_id ); |
| 2802 |
if ( ! isset( $response_data['Amount'] ) ) { |
| 2803 |
$response_data['Amount'] = $amount; |
| 2804 |
} |
| 2805 |
$response_data = apply_filters( 'usces_filter_escott_' . mb_strtolower( substr( $operateid, 1 ) ) . '_history_log', $response_data, $order_id ); |
| 2806 |
$this->save_acting_history_log( $response_data, $order_id . '_' . $trans_id ); |
| 2807 |
$res .= $this->settlement_history( $order_id . '_' . $trans_id ); |
| 2808 |
$data['status'] = $response_data['ResponseCd']; |
| 2809 |
$data['acting_status'] = $acting_status; |
| 2810 |
$data['result'] = $res; |
| 2811 |
$data['trans_id'] = $trans_id; |
| 2812 |
} else { |
| 2813 |
$res .= '<div class="welcart-settlement-admin card-error">' . __( 'Error', 'usces' ) . '</div>'; /* エラー */ |
| 2814 |
$res .= '<div class="welcart-settlement-admin-error">'; |
| 2815 |
$responsecd = explode( '|', $response_member['ResponseCd'] ); |
| 2816 |
foreach ( (array) $responsecd as $cd ) { |
| 2817 |
$res .= '<div><span class="code">' . $cd . '</span> : <span class="message">' . $this->response_message( $cd ) . '</span></div>'; |
| 2818 |
} |
| 2819 |
$res .= '</div>'; |
| 2820 |
usces_log( '[WelcartPay] 4MemRefM connection NG : ' . print_r( $response_member, true ), 'acting_transaction.log' ); |
| 2821 |
$data['status'] = $response_member['ResponseCd']; |
| 2822 |
$data['result'] = $res; |
| 2823 |
} |
| 2824 |
wp_send_json( $data ); |
| 2825 |
break; |
| 2826 |
|
| 2827 |
/* 再オーソリ */ |
| 2828 |
case 'reauth_welcartpay_card': |
| 2829 |
check_admin_referer( 'order_edit', 'wc_nonce' ); |
| 2830 |
$res = ''; |
| 2831 |
$order_id = filter_input( INPUT_POST, 'order_id' ); |
| 2832 |
$order_num = filter_input( INPUT_POST, 'order_num' ); |
| 2833 |
$trans_id = filter_input( INPUT_POST, 'trans_id' ); |
| 2834 |
$amount = filter_input( INPUT_POST, 'amount' ); |
| 2835 |
if ( is_null( $order_id ) || is_null( $order_num ) || is_null( $trans_id ) || is_null( $amount ) ) { |
| 2836 |
$data['status'] = 'NG'; |
| 2837 |
wp_send_json( $data ); |
| 2838 |
break; |
| 2839 |
} |
| 2840 |
$res = ''; |
| 2841 |
$acting_status = ''; |
| 2842 |
if ( 1 === (int) $order_num ) { |
| 2843 |
$acting_data = usces_unserialize( $usces->get_order_meta_value( 'acting_welcart_card', $order_id ) ); |
| 2844 |
} else { |
| 2845 |
$log_data = $this->get_acting_log( $order_id, $order_id . '_' . $trans_id ); |
| 2846 |
$acting_data = usces_unserialize( $log_data[0]['log'] ); |
| 2847 |
} |
| 2848 |
$operateid = $this->get_acting_operateid( $order_id . '_' . $trans_id ); |
| 2849 |
$acting_opts = $this->get_acting_settings(); |
| 2850 |
$transaction_date = $this->get_transaction_date(); |
| 2851 |
$param_list = array(); |
| 2852 |
$params = array(); |
| 2853 |
$param_list['MerchantId'] = $acting_opts['merchant_id']; |
| 2854 |
$param_list['MerchantPass'] = $acting_opts['merchant_pass']; |
| 2855 |
$param_list['TransactionDate'] = $transaction_date; |
| 2856 |
$param_list['MerchantFree1'] = $trans_id; |
| 2857 |
$param_list['MerchantFree2'] = 'acting_welcart_card'; |
| 2858 |
$param_list['MerchantFree3'] = $this->merchantfree3; |
| 2859 |
$param_list['TenantId'] = $acting_opts['tenant_id']; |
| 2860 |
$member_id = filter_input( INPUT_POST, 'member_id' ); |
| 2861 |
$response_member = $this->escott_member_reference( $member_id ); /* e-SCOTT 会員� |
| 2862 |
�会 */ |
| 2863 |
if ( 'OK' === $response_member['ResponseCd'] ) { |
| 2864 |
$param_list['KaiinId'] = $response_member['KaiinId']; |
| 2865 |
$param_list['KaiinPass'] = $response_member['KaiinPass']; |
| 2866 |
} |
| 2867 |
// if ( '1Gathering' === $operateid ) { |
| 2868 |
$param_list['SalesDate'] = $transaction_date; |
| 2869 |
// } |
| 2870 |
$params['send_url'] = $acting_opts['send_url']; |
| 2871 |
$params['param_list'] = array_merge( |
| 2872 |
$param_list, |
| 2873 |
array( |
| 2874 |
'OperateId' => '1ReAuth', |
| 2875 |
'ProcessId' => $acting_data['ProcessId'], |
| 2876 |
'ProcessPass' => $acting_data['ProcessPass'], |
| 2877 |
'Amount' => $amount, |
| 2878 |
) |
| 2879 |
); |
| 2880 |
$response_data = $this->connection( $params ); |
| 2881 |
if ( 'K81' === $response_data['ResponseCd'] ) { |
| 2882 |
$param_list['KaiinId'] = ''; |
| 2883 |
$param_list['KaiinPass'] = ''; |
| 2884 |
$params['param_list'] = array_merge( |
| 2885 |
$param_list, |
| 2886 |
array( |
| 2887 |
'OperateId' => '1ReAuth', |
| 2888 |
'ProcessId' => $acting_data['ProcessId'], |
| 2889 |
'ProcessPass' => $acting_data['ProcessPass'], |
| 2890 |
'Amount' => $amount, |
| 2891 |
) |
| 2892 |
); |
| 2893 |
$response_data = $this->connection( $params ); |
| 2894 |
} |
| 2895 |
if ( 'OK' === $response_data['ResponseCd'] ) { |
| 2896 |
$acting_data['TransactionId'] = $response_data['TransactionId']; |
| 2897 |
$acting_data['TransactionDate'] = $response_data['TransactionDate']; |
| 2898 |
$acting_data['ProcessId'] = $response_data['ProcessId']; |
| 2899 |
$acting_data['ProcessPass'] = $response_data['ProcessPass']; |
| 2900 |
$usces->set_order_meta_value( 'acting_welcart_card', usces_serialize( $acting_data ), $order_id ); |
| 2901 |
|
| 2902 |
$class = ' card-' . mb_strtolower( substr( $operateid, 1 ) ); |
| 2903 |
$status_name = $this->get_operate_name( $operateid ); |
| 2904 |
$res .= '<div class="welcart-settlement-admin' . $class . '">' . $status_name . '</div>'; |
| 2905 |
$res .= '<table class="welcart-settlement-admin-table">'; |
| 2906 |
$res .= '<tr><th>' . __( 'Spending amount', 'usces' ) . '</th>'; |
| 2907 |
$res .= '<td><input type="text" id="amount_change" value="' . $amount . '" style="text-align:right;ime-mode:disabled" size="10" />' . __( usces_crcode( 'return' ), 'usces' ) . '<input type="hidden" id="amount" value="' . $amount . '" /></td>'; |
| 2908 |
$res .= '</tr>'; |
| 2909 |
if ( isset( $response_data['SalesDate'] ) ) { |
| 2910 |
$res .= '<tr><th>' . __( 'Recorded sales date', 'usces' ) . '</th><td>' . $response_data['SalesDate'] . '</td></tr>'; |
| 2911 |
} |
| 2912 |
$res .= '</table>'; |
| 2913 |
$res .= '<div class="welcart-settlement-admin-button">'; |
| 2914 |
if ( '1Capture' !== $operateid && '1Gathering' !== $operateid ) { |
| 2915 |
$res .= '<input id="capture-settlement" type="button" class="button" value="' . __( 'Sales recorded', 'usces' ) . '" />'; /* 売上計上 */ |
| 2916 |
} |
| 2917 |
$res .= '<input id="delete-settlement" type="button" class="button" value="' . __( 'Unregister', 'usces' ) . '" />'; /* 取消 */ |
| 2918 |
$res .= '<input id="change-settlement" type="button" class="button" value="' . __( 'Change spending amount', 'usces' ) . '" />'; /* 利用額変更 */ |
| 2919 |
$res .= '</div>'; |
| 2920 |
$acting_status = '<span class="acting-status' . $class . '">' . $status_name . '</span>'; |
| 2921 |
} else { |
| 2922 |
$res .= '<div class="welcart-settlement-admin card-error">' . __( 'Error', 'usces' ) . '</div>'; /* エラー */ |
| 2923 |
$res .= '<div class="welcart-settlement-admin-error">'; |
| 2924 |
$responsecd = explode( '|', $response_data['ResponseCd'] ); |
| 2925 |
foreach ( (array) $responsecd as $cd ) { |
| 2926 |
$res .= '<div><span class="code">' . $cd . '</span> : <span class="message">' . $this->response_message( $cd ) . '</span></div>'; |
| 2927 |
} |
| 2928 |
$res .= '</div>'; |
| 2929 |
usces_log( '[WelcartPay] 1ReAuth connection NG : ' . print_r( $response_data, true ), 'acting_transaction.log' ); |
| 2930 |
} |
| 2931 |
do_action( 'usces_action_admin_' . $mode, $response_data, $order_id, $trans_id ); |
| 2932 |
if ( ! isset( $response_data['Amount'] ) ) { |
| 2933 |
$response_data['Amount'] = $amount; |
| 2934 |
} |
| 2935 |
$response_data = apply_filters( 'usces_filter_escott_reauth_history_log', $response_data, $order_id ); |
| 2936 |
$this->save_acting_history_log( $response_data, $order_id . '_' . $trans_id ); |
| 2937 |
$res .= $this->settlement_history( $order_id . '_' . $trans_id ); |
| 2938 |
$data['status'] = $response_data['ResponseCd']; |
| 2939 |
$data['acting_status'] = $acting_status; |
| 2940 |
$data['result'] = $res; |
| 2941 |
$this->save_admin_log( $order_id, $order_id . '_' . $trans_id ); |
| 2942 |
wp_send_json( $data ); |
| 2943 |
break; |
| 2944 |
|
| 2945 |
/* 決済エラー */ |
| 2946 |
case 'error_welcartpay_card': |
| 2947 |
check_admin_referer( 'order_edit', 'wc_nonce' ); |
| 2948 |
$order_id = filter_input( INPUT_POST, 'order_id' ); |
| 2949 |
$order_num = filter_input( INPUT_POST, 'order_num' ); |
| 2950 |
$trans_id = filter_input( INPUT_POST, 'trans_id' ); |
| 2951 |
if ( is_null( $order_id ) || is_null( $order_num ) || is_null( $trans_id ) ) { |
| 2952 |
$data['status'] = 'NG'; |
| 2953 |
$data['result'] = ''; |
| 2954 |
wp_send_json( $data ); |
| 2955 |
break; |
| 2956 |
} |
| 2957 |
$res = ''; |
| 2958 |
$member_id = filter_input( INPUT_POST, 'member_id' ); |
| 2959 |
$response_member = $this->escott_member_reference( $member_id ); /* e-SCOTT 会員� |
| 2960 |
�会 */ |
| 2961 |
if ( 'OK' === $response_member['ResponseCd'] ) { |
| 2962 |
$order_data = $usces->get_order_data( $order_id, 'direct' ); |
| 2963 |
$total_full_price = $order_data['order_item_total_price'] - $order_data['order_usedpoint'] + $order_data['order_discount'] + $order_data['order_shipping_charge'] + $order_data['order_cod_fee'] + $order_data['order_tax']; |
| 2964 |
|
| 2965 |
$res .= '<div class="welcart-settlement-admin card-error">' . __( 'Repayment', 'usces' ) . '</div>'; /* 再決済 */ |
| 2966 |
$res .= '<table class="welcart-settlement-admin-table">'; |
| 2967 |
$res .= '<tr><th>' . __( 'Spending amount', 'usces' ) . '</th>'; |
| 2968 |
$res .= '<td><input type="text" id="amount_change" value="' . $total_full_price . '" style="text-align:right;ime-mode:disabled" size="10" />' . __( usces_crcode( 'return' ), 'usces' ) . '<input type="hidden" id="amount" value="' . $total_full_price . '" /></td>'; |
| 2969 |
$res .= '</tr>'; |
| 2970 |
$res .= '</table>'; |
| 2971 |
$res .= '<div class="welcart-settlement-admin-button">'; |
| 2972 |
$res .= '<input id="auth-settlement" type="button" class="button" value="' . __( 'Credit', 'usces' ) . '" />'; /* 与信 */ |
| 2973 |
$res .= '<input id="gathering-settlement" type="button" class="button" value="' . __( 'Credit sales', 'usces' ) . '" />'; /* 与信売上計上 */ |
| 2974 |
$res .= '</div>'; |
| 2975 |
$res .= $this->settlement_history( $order_id . '_' . $trans_id ); |
| 2976 |
} else { |
| 2977 |
$res .= '<div class="welcart-settlement-admin card-error">' . __( 'Settlement error', 'usces' ) . '</div>'; /* エラー */ |
| 2978 |
$res .= '<div class="welcart-settlement-admin-error">'; |
| 2979 |
$res .= '<div><span class="message">' . __( 'Credit card information not registered', 'usces' ) . '</span></div>'; /* カード� |
| 2980 |
報未登録 */ |
| 2981 |
$res .= '</div>'; |
| 2982 |
} |
| 2983 |
$data['status'] = 'OK'; |
| 2984 |
$data['result'] = $res; |
| 2985 |
wp_send_json( $data ); |
| 2986 |
break; |
| 2987 |
|
| 2988 |
/* 継続課金� |
| 2989 |
報更新 */ |
| 2990 |
case 'continuation_update': |
| 2991 |
check_admin_referer( 'order_edit', 'wc_nonce' ); |
| 2992 |
$order_id = filter_input( INPUT_POST, 'order_id' ); |
| 2993 |
$member_id = filter_input( INPUT_POST, 'member_id' ); |
| 2994 |
$contracted_year = filter_input( INPUT_POST, 'contracted_year' ); |
| 2995 |
$contracted_month = filter_input( INPUT_POST, 'contracted_month' ); |
| 2996 |
$contracted_day = filter_input( INPUT_POST, 'contracted_day' ); |
| 2997 |
$charged_year = filter_input( INPUT_POST, 'charged_year' ); |
| 2998 |
$charged_month = filter_input( INPUT_POST, 'charged_month' ); |
| 2999 |
$charged_day = filter_input( INPUT_POST, 'charged_day' ); |
| 3000 |
$price = filter_input( INPUT_POST, 'price' ); |
| 3001 |
if ( is_null( $price ) ) { |
| 3002 |
$price = 0; |
| 3003 |
} |
| 3004 |
$status = filter_input( INPUT_POST, 'status' ); |
| 3005 |
|
| 3006 |
if ( version_compare( WCEX_DLSELLER_VERSION, '3.0-beta', '<=' ) ) { |
| 3007 |
$continue_data = usces_unserialize( $usces->get_member_meta_value( 'continuepay_' . $order_id, $member_id ) ); |
| 3008 |
} else { |
| 3009 |
$continue_data = $this->get_continuation_data( $order_id, $member_id ); |
| 3010 |
} |
| 3011 |
if ( ! $continue_data ) { |
| 3012 |
$data['status'] = 'NG'; |
| 3013 |
wp_send_json( $data ); |
| 3014 |
break; |
| 3015 |
} |
| 3016 |
|
| 3017 |
/* 継続中→停止 */ |
| 3018 |
if ( 'continuation' === $continue_data['status'] && 'cancellation' === $status ) { |
| 3019 |
if ( version_compare( WCEX_DLSELLER_VERSION, '3.0-beta', '<=' ) ) { |
| 3020 |
$continue_data['status'] = 'cancellation'; |
| 3021 |
$usces->set_member_meta_value( 'continuepay_' . $order_id, usces_serialize( $continue_data ), $member_id ); |
| 3022 |
} else { |
| 3023 |
$this->update_continuation_data( $order_id, $member_id, $continue_data, true ); |
| 3024 |
} |
| 3025 |
} else { |
| 3026 |
if ( ! empty( $contracted_year ) && ! empty( $contracted_month ) && ! empty( $contracted_day ) ) { |
| 3027 |
$contracted_date = ( empty( $continue_data['contractedday'] ) ) ? dlseller_next_contracting( $order_id ) : $continue_data['contractedday']; |
| 3028 |
if ( $contracted_date ) { |
| 3029 |
$new_contracted_date = $contracted_year . '-' . $contracted_month . '-' . $contracted_day; |
| 3030 |
if ( ! $this->isdate( $new_contracted_date ) ) { |
| 3031 |
$data['status'] = 'NG'; |
| 3032 |
$data['message'] = __( 'Next contract renewal date is incorrect.', 'dlseller' ); |
| 3033 |
wp_send_json( $data ); |
| 3034 |
} |
| 3035 |
} |
| 3036 |
} else { |
| 3037 |
$new_contracted_date = ''; |
| 3038 |
} |
| 3039 |
$new_charged_date = $charged_year . '-' . $charged_month . '-' . $charged_day; |
| 3040 |
if ( ! $this->isdate( $new_charged_date ) ) { |
| 3041 |
$data['status'] = 'NG'; |
| 3042 |
$data['message'] = __( 'Next settlement date is incorrect.', 'dlseller' ); |
| 3043 |
wp_send_json( $data ); |
| 3044 |
} |
| 3045 |
$tomorrow = date_i18n( 'Y-m-d', strtotime( '+1 day' ) ); |
| 3046 |
if ( $new_charged_date < $tomorrow ) { |
| 3047 |
$data['status'] = 'NG'; |
| 3048 |
$data['message'] = sprintf( __( 'The next settlement date must be after %s.', 'dlseller' ), $tomorrow ); |
| 3049 |
wp_send_json( $data ); |
| 3050 |
} |
| 3051 |
$continue_data['contractedday'] = $new_contracted_date; |
| 3052 |
$continue_data['chargedday'] = $new_charged_date; |
| 3053 |
$continue_data['price'] = usces_crform( $price, false, false, 'return', false ); |
| 3054 |
$continue_data['status'] = $status; |
| 3055 |
if ( version_compare( WCEX_DLSELLER_VERSION, '3.0-beta', '<=' ) ) { |
| 3056 |
$usces->set_member_meta_value( 'continuepay_' . $order_id, usces_serialize( $continue_data ), $member_id ); |
| 3057 |
} else { |
| 3058 |
$this->update_continuation_data( $order_id, $member_id, $continue_data ); |
| 3059 |
} |
| 3060 |
} |
| 3061 |
$data['status'] = 'OK'; |
| 3062 |
wp_send_json( $data ); |
| 3063 |
break; |
| 3064 |
|
| 3065 |
/* オンライン収納代行データ登録 */ |
| 3066 |
case 'add_welcartpay_conv': |
| 3067 |
check_admin_referer( 'order_edit', 'wc_nonce' ); |
| 3068 |
$order_id = filter_input( INPUT_POST, 'order_id' ); |
| 3069 |
$trans_id = filter_input( INPUT_POST, 'trans_id' ); |
| 3070 |
$paylimit = filter_input( INPUT_POST, 'paylimit' ); |
| 3071 |
$amount = filter_input( INPUT_POST, 'amount' ); |
| 3072 |
if ( is_null( $order_id ) || is_null( $trans_id ) || is_null( $paylimit ) || is_null( $amount ) ) { |
| 3073 |
$data['status'] = 'NG'; |
| 3074 |
wp_send_json( $data ); |
| 3075 |
break; |
| 3076 |
} |
| 3077 |
$res = ''; |
| 3078 |
$acting_status = ''; |
| 3079 |
$order_data = $usces->get_order_data( $order_id, 'direct' ); |
| 3080 |
$namekanji = $order_data['order_name1'] . $order_data['order_name2']; |
| 3081 |
$namekana = ( ! empty( $order_data['order_name3'] ) ) ? $order_data['order_name3'] . $order_data['order_name4'] : $namekanji; |
| 3082 |
$telno = $order_data['order_tel']; |
| 3083 |
$acting_opts = $this->get_acting_settings(); |
| 3084 |
$transaction_date = $this->get_transaction_date(); |
| 3085 |
$param_list = array(); |
| 3086 |
$params = array(); |
| 3087 |
$param_list['MerchantId'] = $acting_opts['merchant_id']; |
| 3088 |
$param_list['MerchantPass'] = $acting_opts['merchant_pass']; |
| 3089 |
$param_list['TransactionDate'] = $transaction_date; |
| 3090 |
$param_list['MerchantFree1'] = $trans_id; |
| 3091 |
$param_list['MerchantFree2'] = 'acting_welcart_conv'; |
| 3092 |
$param_list['MerchantFree3'] = $this->merchantfree3; |
| 3093 |
$param_list['TenantId'] = $acting_opts['tenant_id']; |
| 3094 |
$params['send_url'] = $acting_opts['send_url_conv']; |
| 3095 |
$params['param_list'] = array_merge( |
| 3096 |
$param_list, |
| 3097 |
array( |
| 3098 |
'OperateId' => '2Add', |
| 3099 |
'PayLimit' => $paylimit . '2359', |
| 3100 |
'Amount' => $amount, |
| 3101 |
'NameKanji' => $namekanji, |
| 3102 |
'NameKana' => $namekana, |
| 3103 |
'TelNo' => $telno, |
| 3104 |
'ReturnURL' => home_url( '/' ), |
| 3105 |
) |
| 3106 |
); |
| 3107 |
$response_data = $this->connection( $params ); |
| 3108 |
if ( 'OK' === $response_data['ResponseCd'] ) { |
| 3109 |
$response_data['acting'] = $this->acting_conv; |
| 3110 |
$response_data['PayLimit'] = $params['param_list']['PayLimit']; |
| 3111 |
$response_data['Amount'] = $params['param_list']['Amount']; |
| 3112 |
$usces->set_order_meta_value( 'acting_welcart_conv', usces_serialize( $response_data ), $order_id ); |
| 3113 |
$freearea = trim( $response_data['FreeArea'] ); |
| 3114 |
$url = add_query_arg( |
| 3115 |
array( |
| 3116 |
'code' => $freearea, |
| 3117 |
'rkbn' => 2, |
| 3118 |
), |
| 3119 |
$acting_opts['redirect_url_conv'] |
| 3120 |
); |
| 3121 |
$usces->set_order_meta_value( 'welcart_conv_url', $url, $order_id ); |
| 3122 |
|
| 3123 |
$res .= '<div class="welcart-settlement-admin conv-noreceipt">' . __( 'Unpaid', 'usces' ) . '</div>'; /* 未� |
| 3124 |
�金 */ |
| 3125 |
$res .= '<table class="welcart-settlement-admin-table">'; |
| 3126 |
$res .= '<tr><th>' . __( 'Payment due', 'usces' ) . '</th>'; |
| 3127 |
$res .= '<td><input type="text" id="paylimit_change" value="' . $paylimit . '" style="ime-mode:disabled" size="10" /><input type="hidden" id="paylimit" value="' . $paylimit . '" /></td>'; |
| 3128 |
$res .= '</tr>'; |
| 3129 |
$res .= '<tr><th>' . __( 'Payment amount', 'usces' ) . '</th>'; |
| 3130 |
$res .= '<td><input type="text" id="amount_change" value="' . $amount . '" style="text-align:right;ime-mode:disabled" size="10" />' . __( usces_crcode( 'return' ), 'usces' ) . '<input type="hidden" id="amount" value="' . $amount . '" /></td>'; |
| 3131 |
$res .= '</tr>'; |
| 3132 |
$res .= '</table>'; |
| 3133 |
$res .= '<div class="welcart-settlement-admin-button">'; |
| 3134 |
$res .= '<input id="delete-settlement" type="button" class="button" value="' . __( 'Unregister', 'usces' ) . '" />'; /* 取消 */ |
| 3135 |
$res .= '<input id="change-settlement" type="button" class="button" value="' . __( 'Change' ) . '" />'; /* 変更 */ |
| 3136 |
$res .= '</div>'; |
| 3137 |
$acting_status = '<span class="acting-status conv-noreceipt">' . __( 'Unpaid', 'usces' ) . '</span>'; |
| 3138 |
} else { |
| 3139 |
$res .= '<div class="welcart-settlement-admin conv-error">' . __( 'Error', 'usces' ) . '</div>'; /* エラー */ |
| 3140 |
$res .= '<div class="welcart-settlement-admin-error">'; |
| 3141 |
$responsecd = explode( '|', $response_data['ResponseCd'] ); |
| 3142 |
foreach ( (array) $responsecd as $cd ) { |
| 3143 |
$res .= '<div><span class="code">' . $cd . '</span> : <span class="message">' . $this->response_message( $cd ) . '</span></div>'; |
| 3144 |
} |
| 3145 |
$res .= '</div>'; |
| 3146 |
usces_log( '[WelcartPay] 2Add connection NG : ' . print_r( $response_data, true ), 'acting_transaction.log' ); |
| 3147 |
} |
| 3148 |
do_action( 'usces_action_admin_' . $mode, $response_data, $order_id, $trans_id ); |
| 3149 |
if ( ! isset( $response_data['Amount'] ) ) { |
| 3150 |
$response_data['Amount'] = $amount; |
| 3151 |
} |
| 3152 |
$response_data = apply_filters( 'usces_filter_escott_add_conv_history_log', $response_data, $order_id ); |
| 3153 |
$this->save_acting_history_log( $response_data, $order_id . '_' . $trans_id ); |
| 3154 |
$res .= $this->settlement_history( $order_id . '_' . $trans_id ); |
| 3155 |
$data['status'] = $response_data['ResponseCd']; |
| 3156 |
$data['acting_status'] = $acting_status; |
| 3157 |
$data['result'] = $res; |
| 3158 |
wp_send_json( $data ); |
| 3159 |
break; |
| 3160 |
|
| 3161 |
/* オンライン収納代行データ変更 */ |
| 3162 |
case 'change_welcartpay_conv': |
| 3163 |
check_admin_referer( 'order_edit', 'wc_nonce' ); |
| 3164 |
$order_id = filter_input( INPUT_POST, 'order_id' ); |
| 3165 |
$trans_id = filter_input( INPUT_POST, 'trans_id' ); |
| 3166 |
$paylimit = filter_input( INPUT_POST, 'paylimit' ); |
| 3167 |
$amount = filter_input( INPUT_POST, 'amount' ); |
| 3168 |
if ( is_null( $order_id ) || is_null( $trans_id ) || is_null( $paylimit ) || is_null( $amount ) ) { |
| 3169 |
$data['status'] = 'NG'; |
| 3170 |
wp_send_json( $data ); |
| 3171 |
break; |
| 3172 |
} |
| 3173 |
$res = ''; |
| 3174 |
$acting_data = usces_unserialize( $usces->get_order_meta_value( 'acting_welcart_conv', $order_id ) ); |
| 3175 |
$acting_opts = $this->get_acting_settings(); |
| 3176 |
$transaction_date = $this->get_transaction_date(); |
| 3177 |
$param_list = array(); |
| 3178 |
$params = array(); |
| 3179 |
$param_list['MerchantId'] = $acting_opts['merchant_id']; |
| 3180 |
$param_list['MerchantPass'] = $acting_opts['merchant_pass']; |
| 3181 |
$param_list['TransactionDate'] = $transaction_date; |
| 3182 |
$param_list['MerchantFree1'] = $trans_id; |
| 3183 |
$param_list['MerchantFree2'] = 'acting_welcart_conv'; |
| 3184 |
$param_list['MerchantFree3'] = $this->merchantfree3; |
| 3185 |
$param_list['TenantId'] = $acting_opts['tenant_id']; |
| 3186 |
$params['send_url'] = $acting_opts['send_url_conv']; |
| 3187 |
$params['param_list'] = array_merge( |
| 3188 |
$param_list, |
| 3189 |
array( |
| 3190 |
'OperateId' => '2Chg', |
| 3191 |
'ProcessId' => $acting_data['ProcessId'], |
| 3192 |
'ProcessPass' => $acting_data['ProcessPass'], |
| 3193 |
'PayLimit' => $paylimit . '2359', |
| 3194 |
'Amount' => $amount, |
| 3195 |
) |
| 3196 |
); |
| 3197 |
$response_data = $this->connection( $params ); |
| 3198 |
if ( 'OK' === $response_data['ResponseCd'] ) { |
| 3199 |
$acting_data['PayLimit'] = $params['param_list']['PayLimit']; |
| 3200 |
$acting_data['Amount'] = $params['param_list']['Amount']; |
| 3201 |
$usces->set_order_meta_value( 'acting_welcart_conv', usces_serialize( $acting_data ), $order_id ); |
| 3202 |
$freearea = trim( $response_data['FreeArea'] ); |
| 3203 |
$url = add_query_arg( |
| 3204 |
array( |
| 3205 |
'code' => $freearea, |
| 3206 |
'rkbn' => 2, |
| 3207 |
), |
| 3208 |
$acting_opts['redirect_url_conv'] |
| 3209 |
); |
| 3210 |
$usces->set_order_meta_value( 'welcart_conv_url', $url, $order_id ); |
| 3211 |
|
| 3212 |
$res .= '<div class="welcart-settlement-admin conv-noreceipt">' . __( 'Unpaid', 'usces' ) . '</div>'; /* 未� |
| 3213 |
�金 */ |
| 3214 |
$res .= '<table class="welcart-settlement-admin-table">'; |
| 3215 |
if ( isset( $acting_data['PayLimit'] ) ) { |
| 3216 |
$res .= '<tr><th>' . __( 'Payment due', 'usces' ) . '</th><td>' . $acting_data['PayLimit'] . '</td></tr>'; |
| 3217 |
} |
| 3218 |
if ( isset( $acting_data['Amount'] ) ) { |
| 3219 |
$res .= '<tr><th>' . __( 'Payment amount', 'usces' ) . '</th><td>' . $acting_data['Amount'] . '</td></tr>'; |
| 3220 |
} |
| 3221 |
$res .= '</table>'; |
| 3222 |
$res .= '<div class="welcart-settlement-admin-button">'; |
| 3223 |
$res .= '<input id="delete-settlement" type="button" class="button" value="' . __( 'Unregister', 'usces' ) . '" />'; /* 取消 */ |
| 3224 |
$res .= '</div>'; |
| 3225 |
} else { |
| 3226 |
$res .= '<div class="welcart-settlement-admin conv-error">' . __( 'Error', 'usces' ) . '</div>'; /* エラー */ |
| 3227 |
$res .= '<div class="welcart-settlement-admin-error">'; |
| 3228 |
$responsecd = explode( '|', $response_data['ResponseCd'] ); |
| 3229 |
foreach ( (array) $responsecd as $cd ) { |
| 3230 |
$res .= '<div><span class="code">' . $cd . '</span> : <span class="message">' . $this->response_message( $cd ) . '</span></div>'; |
| 3231 |
} |
| 3232 |
$res .= '</div>'; |
| 3233 |
usces_log( '[WelcartPay] 2Chg connection NG : ' . print_r( $response_data, true ), 'acting_transaction.log' ); |
| 3234 |
} |
| 3235 |
do_action( 'usces_action_admin_' . $mode, $response_data, $order_id, $trans_id ); |
| 3236 |
if ( ! isset( $response_data['Amount'] ) ) { |
| 3237 |
$response_data['Amount'] = $amount; |
| 3238 |
} |
| 3239 |
$response_data = apply_filters( 'usces_filter_escott_change_conv_history_log', $response_data, $order_id ); |
| 3240 |
$this->save_acting_history_log( $response_data, $order_id . '_' . $trans_id ); |
| 3241 |
$res .= $this->settlement_history( $order_id . '_' . $trans_id ); |
| 3242 |
$data['status'] = $response_data['ResponseCd']; |
| 3243 |
$data['result'] = $res; |
| 3244 |
wp_send_json( $data ); |
| 3245 |
break; |
| 3246 |
|
| 3247 |
/* オンライン収納代行データ削除 */ |
| 3248 |
case 'delete_welcartpay_conv': |
| 3249 |
check_admin_referer( 'order_edit', 'wc_nonce' ); |
| 3250 |
$order_id = filter_input( INPUT_POST, 'order_id' ); |
| 3251 |
$trans_id = filter_input( INPUT_POST, 'trans_id' ); |
| 3252 |
$amount = filter_input( INPUT_POST, 'amount' ); |
| 3253 |
if ( is_null( $order_id ) || is_null( $trans_id ) ) { |
| 3254 |
$data['status'] = 'NG'; |
| 3255 |
wp_send_json( $data ); |
| 3256 |
break; |
| 3257 |
} |
| 3258 |
$res = ''; |
| 3259 |
$acting_status = ''; |
| 3260 |
$acting_data = usces_unserialize( $usces->get_order_meta_value( 'acting_welcart_conv', $order_id ) ); |
| 3261 |
$acting_opts = $this->get_acting_settings(); |
| 3262 |
$transaction_date = $this->get_transaction_date(); |
| 3263 |
$param_list = array(); |
| 3264 |
$params = array(); |
| 3265 |
$param_list['MerchantId'] = $acting_opts['merchant_id']; |
| 3266 |
$param_list['MerchantPass'] = $acting_opts['merchant_pass']; |
| 3267 |
$param_list['TransactionDate'] = $transaction_date; |
| 3268 |
$param_list['MerchantFree1'] = $trans_id; |
| 3269 |
$param_list['MerchantFree2'] = 'acting_welcart_conv'; |
| 3270 |
$param_list['MerchantFree3'] = $this->merchantfree3; |
| 3271 |
$param_list['TenantId'] = $acting_opts['tenant_id']; |
| 3272 |
$params['send_url'] = $acting_opts['send_url_conv']; |
| 3273 |
$params['param_list'] = array_merge( |
| 3274 |
$param_list, |
| 3275 |
array( |
| 3276 |
'OperateId' => '2Del', |
| 3277 |
'ProcessId' => $acting_data['ProcessId'], |
| 3278 |
'ProcessPass' => $acting_data['ProcessPass'], |
| 3279 |
) |
| 3280 |
); |
| 3281 |
$response_data = $this->connection( $params ); |
| 3282 |
if ( 'OK' === $response_data['ResponseCd'] ) { |
| 3283 |
$res .= '<div class="welcart-settlement-admin conv-del">' . __( 'Canceled', 'usces' ) . '</div>'; /* 取消済み */ |
| 3284 |
$res .= '<table class="welcart-settlement-admin-table">'; |
| 3285 |
if ( isset( $acting_data['PayLimit'] ) ) { |
| 3286 |
$paylimit = substr( $acting_data['PayLimit'], 0, 8 ); |
| 3287 |
$res .= '<tr><th>' . __( 'Payment due', 'usces' ) . '</th><td>' . $paylimit . '</td></tr>'; |
| 3288 |
} |
| 3289 |
if ( isset( $acting_data['Amount'] ) ) { |
| 3290 |
$res .= '<tr><th>' . __( 'Payment amount', 'usces' ) . '</th><td>' . $acting_data['Amount'] . '</td></tr>'; |
| 3291 |
} |
| 3292 |
$res .= '</table>'; |
| 3293 |
$acting_status = '<span class="acting-status conv-del">' . __( 'Canceled', 'usces' ) . '</span>'; |
| 3294 |
} else { |
| 3295 |
$res .= '<div class="welcart-settlement-admin conv-error">' . __( 'Error', 'usces' ) . '</div>'; /* エラー */ |
| 3296 |
$res .= '<div class="welcart-settlement-admin-error">'; |
| 3297 |
$responsecd = explode( '|', $response_data['ResponseCd'] ); |
| 3298 |
foreach ( (array) $responsecd as $cd ) { |
| 3299 |
$res .= '<div><span class="code">' . $cd . '</span> : <span class="message">' . $this->response_message( $cd ) . '</span></div>'; |
| 3300 |
} |
| 3301 |
$res .= '</div>'; |
| 3302 |
usces_log( '[WelcartPay] 2Del connection NG : ' . print_r( $response_data, true ), 'acting_transaction.log' ); |
| 3303 |
} |
| 3304 |
do_action( 'usces_action_admin_' . $mode, $response_data, $order_id, $trans_id ); |
| 3305 |
if ( ! isset( $response_data['Amount'] ) ) { |
| 3306 |
$response_data['Amount'] = ( isset( $acting_data['Amount'] ) ) ? $acting_data['Amount'] : $amount; |
| 3307 |
} |
| 3308 |
$response_data = apply_filters( 'usces_filter_escott_delete_conv_history_log', $response_data, $order_id ); |
| 3309 |
$this->save_acting_history_log( $response_data, $order_id . '_' . $trans_id ); |
| 3310 |
$res .= $this->settlement_history( $order_id . '_' . $trans_id ); |
| 3311 |
$data['status'] = $response_data['ResponseCd']; |
| 3312 |
$data['acting_status'] = $acting_status; |
| 3313 |
$data['result'] = $res; |
| 3314 |
wp_send_json( $data ); |
| 3315 |
break; |
| 3316 |
|
| 3317 |
/* オンライン収納代行データ� |
| 3318 |
�金結果参� |
| 3319 |
� */ |
| 3320 |
case 'get_welcartpay_conv': |
| 3321 |
check_admin_referer( 'order_edit', 'wc_nonce' ); |
| 3322 |
$order_id = filter_input( INPUT_POST, 'order_id' ); |
| 3323 |
$trans_id = filter_input( INPUT_POST, 'trans_id' ); |
| 3324 |
if ( is_null( $order_id ) || is_null( $trans_id ) ) { |
| 3325 |
$data['status'] = 'NG'; |
| 3326 |
wp_send_json( $data ); |
| 3327 |
break; |
| 3328 |
} |
| 3329 |
$res = ''; |
| 3330 |
$acting_data = usces_unserialize( $usces->get_order_meta_value( 'acting_welcart_conv', $order_id ) ); |
| 3331 |
$acting_opts = $this->get_acting_settings(); |
| 3332 |
$transaction_date = $this->get_transaction_date(); |
| 3333 |
$param_list = array(); |
| 3334 |
$params = array(); |
| 3335 |
$param_list['MerchantId'] = $acting_opts['merchant_id']; |
| 3336 |
$param_list['MerchantPass'] = $acting_opts['merchant_pass']; |
| 3337 |
$param_list['TransactionDate'] = $transaction_date; |
| 3338 |
$param_list['MerchantFree1'] = $trans_id; |
| 3339 |
$param_list['MerchantFree2'] = 'acting_welcart_conv'; |
| 3340 |
$param_list['MerchantFree3'] = $this->merchantfree3; |
| 3341 |
$param_list['TenantId'] = $acting_opts['tenant_id']; |
| 3342 |
$params['send_url'] = $acting_opts['send_url_conv']; |
| 3343 |
$params['param_list'] = array_merge( |
| 3344 |
$param_list, |
| 3345 |
array( |
| 3346 |
'OperateId' => '2Ref', |
| 3347 |
'ProcessId' => $acting_data['ProcessId'], |
| 3348 |
'ProcessPass' => $acting_data['ProcessPass'], |
| 3349 |
) |
| 3350 |
); |
| 3351 |
$response_data = $this->connection( $params ); |
| 3352 |
if ( 'OK' === $response_data['ResponseCd'] ) { |
| 3353 |
if ( isset( $response_data['NyukinDate'] ) ) { |
| 3354 |
$res .= '<div class="welcart-settlement-admin conv-receipted">' . __( 'Paid', 'usces' ) . '</div>'; /* � |
| 3355 |
�金済 */ |
| 3356 |
$res .= '<table class="welcart-settlement-admin-table">'; |
| 3357 |
if ( isset( $response_data['RecvNum'] ) ) { |
| 3358 |
$res .= '<tr><th>' . __( 'Receipt number', 'usces' ) . '</th><td>' . $response_data['RecvNum'] . '</td></tr>'; /* 受付番号 */ |
| 3359 |
} |
| 3360 |
if ( isset( $response_data['NyukinDate'] ) ) { |
| 3361 |
$res .= '<tr><th>' . __( 'Deposit date', 'usces' ) . '</th><td>' . $response_data['NyukinDate'] . '</td></tr>'; /* � |
| 3362 |
�金日時 */ |
| 3363 |
} |
| 3364 |
if ( isset( $response_data['CvsCd'] ) ) { |
| 3365 |
$cvs_name = $this->get_cvs_name( $response_data['CvsCd'] ); |
| 3366 |
$res .= '<tr><th>' . __( 'Convenience store code', 'usces' ) . '</th><td>' . $cvs_name . '</td></tr>'; /* 収納機関コード */ |
| 3367 |
} |
| 3368 |
if ( isset( $response_data['TenantCd'] ) ) { |
| 3369 |
$res .= '<tr><th>' . __( 'Tenant code', 'usces' ) . '</th><td>' . $response_data['TenantCd'] . '</td></tr>'; /* 店舗コード */ |
| 3370 |
} |
| 3371 |
if ( isset( $response_data['Amount'] ) ) { |
| 3372 |
$res .= '<tr><th>' . __( 'Payment amount', 'usces' ) . '</th><td>' . $response_data['Amount'] . __( usces_crcode( 'return' ), 'usces' ) . '</td></tr>'; |
| 3373 |
} |
| 3374 |
$res .= '</table>'; |
| 3375 |
} else { |
| 3376 |
$paylimit = substr( $acting_data['PayLimit'], 0, 8 ); |
| 3377 |
$expiration = $this->check_paylimit( $order_id, $trans_id ); |
| 3378 |
$res .= '<div class="welcart-settlement-admin conv-noreceipt">' . __( 'Unpaid', 'usces' ); /* 未� |
| 3379 |
�金 */ |
| 3380 |
if ( $expiration ) { |
| 3381 |
$res .= __( '(Expired)', 'usces' ); /* (期限切れ) */ |
| 3382 |
} |
| 3383 |
$res .= '</div>'; |
| 3384 |
$res .= '<table class="welcart-settlement-admin-table">'; |
| 3385 |
$res .= '<tr><th>' . __( 'Payment due', 'usces' ) . '</th>'; |
| 3386 |
$res .= '<td><input type="text" id="paylimit_change" value="' . $paylimit . '" style="ime-mode:disabled" size="10" /><input type="hidden" id="paylimit" value="' . $paylimit . '" /></td>'; |
| 3387 |
$res .= '</tr>'; |
| 3388 |
$res .= '<tr><th>' . __( 'Payment amount', 'usces' ) . '</th>'; |
| 3389 |
$res .= '<td><input type="text" id="amount_change" value="' . $acting_data['Amount'] . '" style="text-align:right;ime-mode:disabled" size="10" />' . __( usces_crcode( 'return' ), 'usces' ) . '<input type="hidden" id="amount" value="' . $acting_data['Amount'] . '" /></td>'; |
| 3390 |
$res .= '</tr>'; |
| 3391 |
$res .= '</table>'; |
| 3392 |
$latest_log = $this->get_acting_latest_log( $order_id . '_' . $trans_id ); |
| 3393 |
if ( isset( $latest_log['OperateId'] ) ) { |
| 3394 |
$res .= '<div class="welcart-settlement-admin-button">'; |
| 3395 |
if ( '2Del' !== $latest_log['OperateId'] ) { |
| 3396 |
$res .= '<input id="delete-settlement" type="button" class="button" value="' . __( 'Unregister', 'usces' ) . '" />'; /* 取消 */ |
| 3397 |
} |
| 3398 |
if ( '2Chg' !== $latest_log['OperateId'] ) { |
| 3399 |
$res .= '<input id="change-settlement" type="button" class="button" value="' . __( 'Change' ) . '" />'; /* 変更 */ |
| 3400 |
} |
| 3401 |
$res .= '</div>'; |
| 3402 |
} |
| 3403 |
} |
| 3404 |
} else { |
| 3405 |
$latest_log = $this->get_acting_latest_log( $order_id . '_' . $trans_id ); |
| 3406 |
if ( isset( $latest_log['OperateId'] ) && '2Del' === $latest_log['OperateId'] && 'K12' === $response_data['ResponseCd'] ) { |
| 3407 |
$paylimit = substr( $acting_data['PayLimit'], 0, 8 ); |
| 3408 |
$res .= '<div class="welcart-settlement-admin conv-del">' . __( 'Canceled', 'usces' ) . '</div>'; /* 取消済み */ |
| 3409 |
$res .= '<table class="welcart-settlement-admin-table">'; |
| 3410 |
$res .= '<tr><th>' . __( 'Payment due', 'usces' ) . '</th>'; |
| 3411 |
$res .= '<td><input type="text" id="paylimit_change" value="' . $paylimit . '" style="ime-mode:disabled" size="10" /><input type="hidden" id="paylimit" value="' . $paylimit . '" /></td>'; |
| 3412 |
$res .= '</tr>'; |
| 3413 |
$res .= '<tr><th>' . __( 'Payment amount', 'usces' ) . '</th>'; |
| 3414 |
$res .= '<td><input type="text" id="amount_change" value="' . $acting_data['Amount'] . '" style="text-align:right;ime-mode:disabled" size="10" />' . __( usces_crcode( 'return' ), 'usces' ) . '<input type="hidden" id="amount" value="' . $acting_data['Amount'] . '" /></td>'; |
| 3415 |
$res .= '</tr>'; |
| 3416 |
$res .= '</table>'; |
| 3417 |
$res .= '<div class="welcart-settlement-admin-button">'; |
| 3418 |
$res .= '<input id="add-settlement" type="button" class="button" value="' . __( 'Register' ) . '" />'; /* 登録 */ |
| 3419 |
$res .= '</div>'; |
| 3420 |
} else { |
| 3421 |
$res .= '<div class="welcart-settlement-admin conv-error">' . __( 'Error', 'usces' ) . '</div>'; /* エラー */ |
| 3422 |
$res .= '<div class="welcart-settlement-admin-error">'; |
| 3423 |
$responsecd = explode( '|', $response_data['ResponseCd'] ); |
| 3424 |
foreach ( (array) $responsecd as $cd ) { |
| 3425 |
$res .= '<div><span class="code">' . $cd . '</span> : <span class="message">' . $this->response_message( $cd ) . '</span></div>'; |
| 3426 |
} |
| 3427 |
$res .= '</div>'; |
| 3428 |
usces_log( '[WelcartPay] 2Ref connection NG : ' . print_r( $response_data, true ), 'acting_transaction.log' ); |
| 3429 |
} |
| 3430 |
} |
| 3431 |
$res .= $this->settlement_history( $order_id . '_' . $trans_id ); |
| 3432 |
$data['status'] = $response_data['ResponseCd']; |
| 3433 |
$data['result'] = $res; |
| 3434 |
wp_send_json( $data ); |
| 3435 |
break; |
| 3436 |
|
| 3437 |
/* 銀聯取引参� |
| 3438 |
� */ |
| 3439 |
case 'get_welcartpay_unionpay': |
| 3440 |
check_admin_referer( 'order_edit', 'wc_nonce' ); |
| 3441 |
$order_id = filter_input( INPUT_POST, 'order_id' ); |
| 3442 |
$order_num = filter_input( INPUT_POST, 'order_num' ); |
| 3443 |
$trans_id = filter_input( INPUT_POST, 'trans_id' ); |
| 3444 |
if ( is_null( $order_id ) || is_null( $order_num ) || is_null( $trans_id ) ) { |
| 3445 |
$data['status'] = 'NG'; |
| 3446 |
wp_send_json( $data ); |
| 3447 |
break; |
| 3448 |
} |
| 3449 |
$res = ''; |
| 3450 |
$log_data = array(); |
| 3451 |
$acting_data = usces_unserialize( $usces->get_order_meta_value( 'acting_welcart_unionpay', $order_id ) ); |
| 3452 |
$acting_opts = $this->get_acting_settings(); |
| 3453 |
$transaction_date = $this->get_transaction_date(); |
| 3454 |
$param_list = array(); |
| 3455 |
$params = array(); |
| 3456 |
$param_list['MerchantId'] = $acting_opts['merchant_id']; |
| 3457 |
$param_list['MerchantPass'] = $acting_opts['merchant_pass']; |
| 3458 |
$param_list['TransactionDate'] = $transaction_date; |
| 3459 |
$param_list['MerchantFree1'] = $trans_id; |
| 3460 |
$param_list['MerchantFree2'] = 'acting_welcart_unionpay'; |
| 3461 |
$param_list['MerchantFree3'] = $this->merchantfree3; |
| 3462 |
$param_list['TenantId'] = $acting_opts['tenant_id']; |
| 3463 |
$params['send_url'] = $acting_opts['send_url_unionpay']; |
| 3464 |
$params['param_list'] = array_merge( |
| 3465 |
$param_list, |
| 3466 |
array( |
| 3467 |
'OperateId' => '11Search', |
| 3468 |
'ProcessId' => $acting_data['ProcessId'], |
| 3469 |
'ProcessPass' => $acting_data['ProcessPass'], |
| 3470 |
) |
| 3471 |
); |
| 3472 |
$response_data = $this->connection( $params ); |
| 3473 |
if ( 'OK' === $response_data['ResponseCd'] ) { |
| 3474 |
$latest_log = $this->get_acting_latest_log( $order_id . '_' . $trans_id ); |
| 3475 |
if ( isset( $latest_log['OperateId'] ) ) { |
| 3476 |
$class = ' card-' . mb_strtolower( substr( $latest_log['OperateId'], 2 ) ); |
| 3477 |
$status_name = $this->get_operate_name( $latest_log['OperateId'] ); |
| 3478 |
$res .= '<div class="welcart-settlement-admin' . $class . '">' . $status_name . '</div>'; |
| 3479 |
$res .= '<table class="welcart-settlement-admin-table">'; |
| 3480 |
if ( isset( $latest_log['Amount'] ) ) { |
| 3481 |
$res .= '<tr><th>' . __( 'Spending amount', 'usces' ) . '</th><td>' . usces_crform( $latest_log['Amount'], false, true, 'return', true ) . '</td></tr>'; |
| 3482 |
} |
| 3483 |
if ( isset( $latest_log['Status'] ) ) { |
| 3484 |
$res .= '<tr><th>' . __( 'Transaction status', 'usces' ) . '</th><td>' . $this->get_unionpay_status_name( $latest_log['Status'] ) . '</td></tr>'; |
| 3485 |
} |
| 3486 |
$res .= '</table>'; |
| 3487 |
$res .= '<div class="welcart-settlement-admin-button">'; |
| 3488 |
if ( '11Delete' !== $latest_log['OperateId'] ) { |
| 3489 |
$res .= '<input id="delete-settlement" type="button" class="button" value="' . __( 'Unregister', 'usces' ) . '" />'; /* 取消 */ |
| 3490 |
} |
| 3491 |
$res .= '</div>'; |
| 3492 |
} |
| 3493 |
} else { |
| 3494 |
if ( 'K12' === $response_data['ResponseCd'] ) { |
| 3495 |
$res .= '<div class="welcart-settlement-admin card-delete">' . __( 'Expired', 'usces' ) . '</div>'; |
| 3496 |
$res .= '<div class="welcart-settlement-admin-expired">'; |
| 3497 |
$res .= '<div><span class="code">K12</span> : <span class="message">' . __( 'Handling expired.', 'usces' ) . '</span></div>'; |
| 3498 |
$res .= '</div>'; |
| 3499 |
} else { |
| 3500 |
$res .= '<div class="welcart-settlement-admin card-error">' . __( 'Error', 'usces' ) . '</div>'; |
| 3501 |
$res .= '<div class="welcart-settlement-admin-error">'; |
| 3502 |
$responsecd = explode( '|', $response_data['ResponseCd'] ); |
| 3503 |
foreach ( $responsecd as $cd ) { |
| 3504 |
$res .= '<div><span class="code">' . $cd . '</span> : <span class="message">' . $this->response_message( $cd ) . '</span></div>'; |
| 3505 |
} |
| 3506 |
$res .= '</div>'; |
| 3507 |
usces_log( '[WelcartPay] 11Search connection NG : ' . print_r( $response_data, true ), 'acting_transaction.log' ); |
| 3508 |
} |
| 3509 |
} |
| 3510 |
$res .= $this->settlement_history( $order_id . '_' . $trans_id ); |
| 3511 |
$data['status'] = $response_data['ResponseCd']; |
| 3512 |
$data['result'] = $res; |
| 3513 |
wp_send_json( $data ); |
| 3514 |
break; |
| 3515 |
|
| 3516 |
/* 銀聯取消 */ |
| 3517 |
case 'delete_welcartpay_unionpay': |
| 3518 |
check_admin_referer( 'order_edit', 'wc_nonce' ); |
| 3519 |
$order_id = filter_input( INPUT_POST, 'order_id' ); |
| 3520 |
$order_num = filter_input( INPUT_POST, 'order_num' ); |
| 3521 |
$trans_id = filter_input( INPUT_POST, 'trans_id' ); |
| 3522 |
$amount = filter_input( INPUT_POST, 'amount' ); |
| 3523 |
if ( is_null( $order_id ) || is_null( $order_num ) || is_null( $trans_id ) ) { |
| 3524 |
$data['status'] = 'NG'; |
| 3525 |
wp_send_json( $data ); |
| 3526 |
break; |
| 3527 |
} |
| 3528 |
$res = ''; |
| 3529 |
$acting_status = ''; |
| 3530 |
$log_data = array(); |
| 3531 |
$acting_data = usces_unserialize( $usces->get_order_meta_value( 'acting_welcart_unionpay', $order_id ) ); |
| 3532 |
$acting_opts = $this->get_acting_settings(); |
| 3533 |
$transaction_date = $this->get_transaction_date(); |
| 3534 |
$param_list = array(); |
| 3535 |
$params = array(); |
| 3536 |
$param_list['MerchantId'] = $acting_opts['merchant_id']; |
| 3537 |
$param_list['MerchantPass'] = $acting_opts['merchant_pass']; |
| 3538 |
$param_list['TransactionDate'] = $transaction_date; |
| 3539 |
$param_list['MerchantFree1'] = $trans_id; |
| 3540 |
$param_list['MerchantFree2'] = 'acting_welcart_unionpay'; |
| 3541 |
$param_list['MerchantFree3'] = $this->merchantfree3; |
| 3542 |
$param_list['TenantId'] = $acting_opts['tenant_id']; |
| 3543 |
$params['send_url'] = $acting_opts['send_url_unionpay']; |
| 3544 |
$params['param_list'] = array_merge( |
| 3545 |
$param_list, |
| 3546 |
array( |
| 3547 |
'OperateId' => '11Delete', |
| 3548 |
'ProcessId' => $acting_data['ProcessId'], |
| 3549 |
'ProcessPass' => $acting_data['ProcessPass'], |
| 3550 |
) |
| 3551 |
); |
| 3552 |
$response_data = $this->connection( $params ); |
| 3553 |
if ( 'OK' === $response_data['ResponseCd'] ) { |
| 3554 |
$class = ' card-' . mb_strtolower( substr( $response_data['OperateId'], 2 ) ); |
| 3555 |
$status_name = $this->get_operate_name( $response_data['OperateId'] ); |
| 3556 |
$res .= '<div class="welcart-settlement-admin' . $class . '">' . $status_name . '</div>'; |
| 3557 |
$res .= '<table class="welcart-settlement-admin-table">'; |
| 3558 |
$res .= '<tr><th>' . __( 'Spending amount', 'usces' ) . '</th><td>' . usces_crform( $amount, false, true, 'return', true ) . '</td></tr>'; |
| 3559 |
$res .= '</table>'; |
| 3560 |
$acting_status = '<span class="acting-status' . $class . '">' . $status_name . '</span>'; |
| 3561 |
} else { |
| 3562 |
$res .= '<div class="welcart-settlement-admin card-error">' . __( 'Error', 'usces' ) . '</div>'; |
| 3563 |
$res .= '<div class="welcart-settlement-admin-error">'; |
| 3564 |
$responsecd = explode( '|', $response_data['ResponseCd'] ); |
| 3565 |
foreach ( (array) $responsecd as $cd ) { |
| 3566 |
$res .= '<div><span class="code">' . $cd . '</span> : <span class="message">' . $this->response_message( $cd ) . '</span></div>'; |
| 3567 |
} |
| 3568 |
$res .= '</div>'; |
| 3569 |
usces_log( '[WelcartPay] 11Delete connection NG : ' . print_r( $response_data, true ), 'acting_transaction.log' ); |
| 3570 |
} |
| 3571 |
do_action( 'usces_action_admin_' . $mode, $response_data, $order_id, $trans_id ); |
| 3572 |
if ( ! isset( $response_data['Amount'] ) ) { |
| 3573 |
$response_data['Amount'] = $amount; |
| 3574 |
} |
| 3575 |
$response_data = apply_filters( 'usces_filter_escott_delete_unionpay_history_log', $response_data, $order_id ); |
| 3576 |
$this->save_acting_history_log( $response_data, $order_id . '_' . $trans_id ); |
| 3577 |
$res .= $this->settlement_history( $order_id . '_' . $trans_id ); |
| 3578 |
$data['status'] = $response_data['ResponseCd']; |
| 3579 |
$data['acting_status'] = $acting_status; |
| 3580 |
$data['result'] = $res; |
| 3581 |
wp_send_json( $data ); |
| 3582 |
break; |
| 3583 |
} |
| 3584 |
} |
| 3585 |
|
| 3586 |
/** |
| 3587 |
* 決済状況 |
| 3588 |
* usces_filter_orderlist_detail_value |
| 3589 |
* |
| 3590 |
* @param string $detail HTML. |
| 3591 |
* @param string $value Settlement info key. |
| 3592 |
* @param string $key Settlement info value. |
| 3593 |
* @param int $order_id Order number. |
| 3594 |
* @return array |
| 3595 |
*/ |
| 3596 |
public function orderlist_settlement_status( $detail, $value, $key, $order_id ) { |
| 3597 |
global $usces; |
| 3598 |
|
| 3599 |
if ( 'wc_trans_id' !== $key || empty( $value ) ) { |
| 3600 |
return $detail; |
| 3601 |
} |
| 3602 |
|
| 3603 |
$order_data = $usces->get_order_data( $order_id, 'direct' ); |
| 3604 |
$payment = usces_get_payments_by_name( $order_data['order_payment_name'] ); |
| 3605 |
$acting_flg = ( isset( $payment['settlement'] ) ) ? $payment['settlement'] : ''; |
| 3606 |
|
| 3607 |
if ( 'acting_welcart_card' === $acting_flg ) { |
| 3608 |
$trans_id = $usces->get_order_meta_value( 'trans_id', $order_id ); |
| 3609 |
$latest_log = $this->get_acting_latest_log( $order_id . '_' . $trans_id ); |
| 3610 |
if ( isset( $latest_log['OperateId'] ) ) { |
| 3611 |
$class = ( ctype_digit( substr( $latest_log['OperateId'], 0, 1 ) ) ) ? ' card-' . mb_strtolower( substr( $latest_log['OperateId'], 1 ) ) : ' card-' . $latest_log['OperateId']; |
| 3612 |
$detail = '<td>' . $value . '<span class="acting-status' . $class . '">' . $this->get_operate_name( $latest_log['OperateId'] ) . '</span></td>'; |
| 3613 |
} elseif ( defined( 'WCEX_AUTO_DELIVERY' ) ) { |
| 3614 |
$regular_id = $usces->get_order_meta_value( 'regular_id', $order_id ); |
| 3615 |
if ( ! empty( $regular_id ) && empty( $trans_id ) ) { |
| 3616 |
$detail = '<td>' . $value . '<span class="acting-status card-error">' . __( 'Card unregistered', 'usces' ) . '</span></td>'; |
| 3617 |
} |
| 3618 |
} |
| 3619 |
} elseif ( 'acting_welcart_conv' === $acting_flg ) { |
| 3620 |
$trans_id = $usces->get_order_meta_value( 'trans_id', $order_id ); |
| 3621 |
$expiration = $this->check_paylimit( $order_id, $trans_id ); |
| 3622 |
if ( $expiration ) { |
| 3623 |
if ( ! $usces->is_status( 'receipted', $order_data['order_status'] ) ) { |
| 3624 |
$detail = '<td>' . $value . '<span class="acting-status conv-expiration">' . __( 'Expired', 'usces' ) . '</span></td>'; |
| 3625 |
} |
| 3626 |
} else { |
| 3627 |
$latest_log = $this->get_acting_latest_log( $order_id . '_' . $trans_id ); |
| 3628 |
if ( isset( $latest_log['OperateId'] ) && '2Del' === $latest_log['OperateId'] ) { |
| 3629 |
$detail = '<td>' . $value . '<span class="acting-status conv-del">' . __( 'Canceled', 'usces' ) . '</span></td>'; |
| 3630 |
} else { |
| 3631 |
$management_status = apply_filters( 'usces_filter_management_status', get_option( 'usces_management_status' ) ); |
| 3632 |
if ( $usces->is_status( 'noreceipt', $value ) ) { |
| 3633 |
$detail = '<td>' . $value . '<span class="acting-status conv-noreceipt">' . esc_html( $management_status['noreceipt'] ) . '</span></td>'; |
| 3634 |
} elseif ( $usces->is_status( 'receipted', $value ) ) { |
| 3635 |
$detail = '<td>' . $value . '<span class="acting-status conv-receipted">' . esc_html( $management_status['receipted'] ) . '</span></td>'; |
| 3636 |
} else { |
| 3637 |
$detail = '<td>' . $value . '</td>'; |
| 3638 |
} |
| 3639 |
} |
| 3640 |
} |
| 3641 |
} elseif ( 'acting_welcart_unionpay' === $acting_flg ) { |
| 3642 |
$trans_id = $usces->get_order_meta_value( 'trans_id', $order_id ); |
| 3643 |
$latest_log = $this->get_acting_latest_log( $order_id . '_' . $trans_id ); |
| 3644 |
if ( isset( $latest_log['OperateId'] ) ) { |
| 3645 |
$class = ( ctype_digit( substr( $latest_log['OperateId'], 0, 2 ) ) ) ? ' card-' . mb_strtolower( substr( $latest_log['OperateId'], 2 ) ) : ' card-' . $latest_log['OperateId']; |
| 3646 |
$detail = '<td>' . $value . '<span class="acting-status' . $class . '">' . $this->get_operate_name( $latest_log['OperateId'] ) . '</span></td>'; |
| 3647 |
} |
| 3648 |
} |
| 3649 |
return $detail; |
| 3650 |
} |
| 3651 |
|
| 3652 |
/** |
| 3653 |
* 受注編集画面に表示する決済� |
| 3654 |
報の値整形 |
| 3655 |
* usces_filter_settle_info_field_value |
| 3656 |
* |
| 3657 |
* @param string $value Settlement information value. |
| 3658 |
* @param string $key Settlement information key. |
| 3659 |
* @param string $acting Acting type. |
| 3660 |
* @return string |
| 3661 |
*/ |
| 3662 |
public function settlement_info_field_value( $value, $key, $acting ) { |
| 3663 |
if ( 'welcart_card' !== $acting && 'welcart_conv' !== $acting && 'welcart_atodene' !== $acting && 'welcart_applepay' !== $acting && 'welcart_unionpay' !== $acting ) { |
| 3664 |
return $value; |
| 3665 |
} |
| 3666 |
|
| 3667 |
switch ( $key ) { |
| 3668 |
case 'acting': |
| 3669 |
switch ( $value ) { |
| 3670 |
case 'welcart_card': |
| 3671 |
$value = __( 'WelcartPay - Credit card transaction', 'usces' ); |
| 3672 |
break; |
| 3673 |
case 'welcart_conv': |
| 3674 |
$value = __( 'WelcartPay - Online storage agency', 'usces' ); |
| 3675 |
break; |
| 3676 |
case 'welcart_atodene': |
| 3677 |
$value = __( 'WelcartPay - Postpay settlement', 'usces' ); |
| 3678 |
break; |
| 3679 |
case 'welcart_applepay': |
| 3680 |
$value = __( 'WelcartPay - Apple Pay', 'usces' ); |
| 3681 |
break; |
| 3682 |
case 'welcart_unionpay': |
| 3683 |
$value = __( 'WelcartPay - UnionPay', 'usces' ); |
| 3684 |
break; |
| 3685 |
} |
| 3686 |
break; |
| 3687 |
} |
| 3688 |
|
| 3689 |
$value = parent::settlement_info_field_value( $value, $key, $acting ); |
| 3690 |
|
| 3691 |
return $value; |
| 3692 |
} |
| 3693 |
|
| 3694 |
/** |
| 3695 |
* 受注編集画面【ステータス】 |
| 3696 |
* usces_action_order_edit_form_status_block_middle |
| 3697 |
* |
| 3698 |
* @param array $data Order data. |
| 3699 |
* @param array $cscs_meta Custom field data. |
| 3700 |
* @param array $action_args Compact array( 'order_action', 'order_id', 'cart' ). |
| 3701 |
*/ |
| 3702 |
public function settlement_status( $data, $cscs_meta, $action_args ) { |
| 3703 |
global $usces; |
| 3704 |
extract( $action_args ); // phpcs:ignore |
| 3705 |
|
| 3706 |
if ( 'new' !== $order_action && ! empty( $order_id ) ) { |
| 3707 |
$payment = usces_get_payments_by_name( $data['order_payment_name'] ); |
| 3708 |
if ( in_array( $payment['settlement'], $this->pay_method ) ) { |
| 3709 |
$acting_data = usces_unserialize( $usces->get_order_meta_value( $payment['settlement'], $order_id ) ); |
| 3710 |
$merchantfree1 = ( isset( $acting_data['MerchantFree1'] ) ) ? $acting_data['MerchantFree1'] : ''; |
| 3711 |
if ( ! empty( $merchantfree1 ) ) { |
| 3712 |
$status_name = ''; |
| 3713 |
$class = ''; |
| 3714 |
$latest_log = $this->get_acting_latest_log( $order_id . '_' . $merchantfree1 ); |
| 3715 |
if ( isset( $latest_log['OperateId'] ) ) { |
| 3716 |
switch ( $payment['settlement'] ) { |
| 3717 |
case 'acting_welcart_conv': |
| 3718 |
$expiration = $this->check_paylimit( $order_id, $merchantfree1 ); |
| 3719 |
if ( $expiration ) { |
| 3720 |
if ( ! $usces->is_status( 'receipted', $data['order_status'] ) ) { |
| 3721 |
$class = ' conv-expiration'; |
| 3722 |
$status_name = __( 'Expired', 'usces' ); |
| 3723 |
} |
| 3724 |
} else { |
| 3725 |
if ( '2Del' === $latest_log['OperateId'] ) { |
| 3726 |
$class = ' conv-del'; |
| 3727 |
$status_name = __( 'Canceled', 'usces' ); |
| 3728 |
} |
| 3729 |
} |
| 3730 |
break; |
| 3731 |
case 'acting_welcart_card': |
| 3732 |
$class = ' card-' . mb_strtolower( substr( $latest_log['OperateId'], 1 ) ); |
| 3733 |
$status_name = $this->get_operate_name( $latest_log['OperateId'] ); |
| 3734 |
break; |
| 3735 |
case 'acting_welcart_unionpay': |
| 3736 |
$class = ' card-' . mb_strtolower( substr( $latest_log['OperateId'], 2 ) ); |
| 3737 |
$status_name = $this->get_operate_name( $latest_log['OperateId'] ); |
| 3738 |
break; |
| 3739 |
} |
| 3740 |
if ( ! empty( $status_name ) ) { |
| 3741 |
echo ' |
| 3742 |
<tr> |
| 3743 |
<td class="label status">' . esc_html__( 'Settlement status', 'usces' ) . '</td> |
| 3744 |
<td class="col1 status"><span id="settlement-status"><span class="acting-status' . esc_attr( $class ) . '">' . esc_html( $status_name ) . '</span></span></td> |
| 3745 |
</tr>'; |
| 3746 |
} |
| 3747 |
} |
| 3748 |
} elseif ( defined( 'WCEX_AUTO_DELIVERY' ) ) { |
| 3749 |
$regular_id = $usces->get_order_meta_value( 'regular_id', $order_id ); |
| 3750 |
if ( ! empty( $regular_id ) ) { |
| 3751 |
echo ' |
| 3752 |
<tr> |
| 3753 |
<td class="label status">' . esc_html__( 'Settlement status', 'usces' ) . '</td> |
| 3754 |
<td class="col1 status"><span id="settlement-status"><span class="acting-status card-error">' . esc_html__( 'Card unregistered', 'usces' ) . '</span></span></td> |
| 3755 |
</tr>'; |
| 3756 |
} |
| 3757 |
} |
| 3758 |
} |
| 3759 |
} |
| 3760 |
} |
| 3761 |
|
| 3762 |
/** |
| 3763 |
* 受注編集画面【支払� |
| 3764 |
報】 |
| 3765 |
* usces_action_order_edit_form_settle_info |
| 3766 |
* |
| 3767 |
* @param array $data Order data. |
| 3768 |
* @param array $action_args Compact array( $order_action, $order_id, $cart ). |
| 3769 |
*/ |
| 3770 |
public function settlement_information( $data, $action_args ) { |
| 3771 |
global $usces; |
| 3772 |
extract( $action_args ); // phpcs:ignore |
| 3773 |
|
| 3774 |
if ( 'new' !== $order_action && ! empty( $order_id ) ) { |
| 3775 |
$payment = usces_get_payments_by_name( $data['order_payment_name'] ); |
| 3776 |
if ( in_array( $payment['settlement'], $this->pay_method, true ) ) { |
| 3777 |
$acting_data = usces_unserialize( $usces->get_order_meta_value( $payment['settlement'], $order_id ) ); |
| 3778 |
$merchantfree1 = ( isset( $acting_data['MerchantFree1'] ) && isset( $acting_data['ProcessId'] ) && isset( $acting_data['ProcessPass'] ) ) ? $acting_data['MerchantFree1'] : '9999999999'; |
| 3779 |
echo '<input type="button" id="settlement-information-' . esc_attr( $merchantfree1 ) . '-1" class="button settlement-information" value="' . esc_attr__( 'Settlement info', 'usces' ) . '">'; |
| 3780 |
} |
| 3781 |
} |
| 3782 |
} |
| 3783 |
|
| 3784 |
/** |
| 3785 |
* 決済� |
| 3786 |
報ダイアログ |
| 3787 |
* usces_action_endof_order_edit_form |
| 3788 |
* |
| 3789 |
* @param array $data Order data. |
| 3790 |
* @param array $action_args Compact array( $order_action, $order_id, $cart ). |
| 3791 |
*/ |
| 3792 |
public function settlement_dialog( $data, $action_args ) { |
| 3793 |
global $usces; |
| 3794 |
extract( $action_args ); // phpcs:ignore |
| 3795 |
|
| 3796 |
if ( 'new' !== $order_action && ! empty( $order_id ) ) : |
| 3797 |
$payment = usces_get_payments_by_name( $data['order_payment_name'] ); |
| 3798 |
if ( in_array( $payment['settlement'], $this->pay_method, true ) ) : |
| 3799 |
?> |
| 3800 |
<div id="settlement_dialog" title=""> |
| 3801 |
<div id="settlement-response-loading"></div> |
| 3802 |
<fieldset> |
| 3803 |
<div id="settlement-response"></div> |
| 3804 |
<input type="hidden" id="order_num"> |
| 3805 |
<input type="hidden" id="trans_id"> |
| 3806 |
<input type="hidden" id="acting" value="<?php echo esc_attr( $payment['settlement'] ); ?>"> |
| 3807 |
<input type="hidden" id="error"> |
| 3808 |
</fieldset> |
| 3809 |
</div> |
| 3810 |
<?php |
| 3811 |
endif; |
| 3812 |
endif; |
| 3813 |
} |
| 3814 |
|
| 3815 |
/** |
| 3816 |
* 決済処理 |
| 3817 |
* usces_action_acting_processing |
| 3818 |
* |
| 3819 |
* @param string $acting_flg Payment type. |
| 3820 |
* @param array $post_query Post data. |
| 3821 |
*/ |
| 3822 |
public function acting_processing( $acting_flg, $post_query ) { |
| 3823 |
global $usces; |
| 3824 |
|
| 3825 |
parent::acting_processing( $acting_flg, $post_query ); |
| 3826 |
|
| 3827 |
$acting_opts = $this->get_acting_settings(); |
| 3828 |
|
| 3829 |
/* 外部リンク(三� |
| 3830 |
間画面) */ |
| 3831 |
if ( 'acting_welcart_card' === $acting_flg && 'link' === $acting_opts['card_activate'] ) { |
| 3832 |
|
| 3833 |
$usces_entries = $usces->cart->get_entry(); |
| 3834 |
$cart = $usces->cart->get_cart(); |
| 3835 |
|
| 3836 |
if ( ! $usces_entries || ! $cart ) { |
| 3837 |
wp_redirect( USCES_CART_URL ); |
| 3838 |
exit(); |
| 3839 |
} |
| 3840 |
|
| 3841 |
if ( ! wp_verify_nonce( $_REQUEST['_nonce'], $acting_flg ) ) { |
| 3842 |
wp_redirect( USCES_CART_URL ); |
| 3843 |
exit(); |
| 3844 |
} |
| 3845 |
|
| 3846 |
parse_str( $post_query, $post_data ); |
| 3847 |
$transaction_date = $this->get_transaction_date(); |
| 3848 |
$rand = $post_data['rand']; |
| 3849 |
$member = $usces->get_member(); |
| 3850 |
|
| 3851 |
usces_save_order_acting_data( $rand ); |
| 3852 |
|
| 3853 |
$param_list = array(); |
| 3854 |
$params = array(); |
| 3855 |
|
| 3856 |
$quick_member = ( isset( $post_data['quick_member'] ) ) ? $post_data['quick_member'] : ''; |
| 3857 |
if ( 'add' !== $quick_member ) { |
| 3858 |
if ( ! empty( $member['ID'] ) && 'on' === $acting_opts['quickpay'] ) { |
| 3859 |
$kaiin_id = $this->get_quick_kaiin_id( $member['ID'] ); |
| 3860 |
$kaiin_pass = $this->get_quick_pass( $member['ID'] ); |
| 3861 |
} else { |
| 3862 |
$kaiin_id = ''; |
| 3863 |
$kaiin_pass = ''; |
| 3864 |
} |
| 3865 |
if ( empty( $kaiin_id ) || empty( $kaiin_pass ) ) { |
| 3866 |
$quick_member = 'no'; |
| 3867 |
} |
| 3868 |
} |
| 3869 |
|
| 3870 |
$home_url = str_replace( 'http://', 'https://', home_url( '/' ) ); |
| 3871 |
$redirecturl = $home_url . '?page_id=' . USCES_CART_NUMBER; |
| 3872 |
|
| 3873 |
if ( ! empty( $member['ID'] ) && 'on' === $acting_opts['quickpay'] && ( 'add' === $quick_member || 'update' === $quick_member ) ) { |
| 3874 |
$data_list = array(); |
| 3875 |
$data_list['MerchantPass'] = $acting_opts['merchant_pass']; |
| 3876 |
$data_list['TransactionDate'] = $transaction_date; |
| 3877 |
$data_list['MerchantFree1'] = $rand; |
| 3878 |
$data_list['MerchantFree2'] = $acting_flg; |
| 3879 |
$data_list['MerchantFree3'] = $this->merchantfree3; |
| 3880 |
$data_list['TenantId'] = $acting_opts['tenant_id']; |
| 3881 |
if ( 'add' === $quick_member ) { |
| 3882 |
$data_list['OperateId'] = '4MemAdd'; |
| 3883 |
$data_list['KaiinId'] = $this->make_kaiin_id( $member['ID'] ); |
| 3884 |
$data_list['KaiinPass'] = $this->make_kaiin_pass(); |
| 3885 |
} elseif ( 'update' === $quick_member ) { |
| 3886 |
$data_list['OperateId'] = '4MemChg'; |
| 3887 |
$data_list['KaiinId'] = $kaiin_id; |
| 3888 |
$data_list['KaiinPass'] = $kaiin_pass; |
| 3889 |
} |
| 3890 |
$data_list['ProcNo'] = '0000000'; |
| 3891 |
$data_list['RedirectUrl'] = $redirecturl; |
| 3892 |
$data_query = http_build_query( $data_list ); |
| 3893 |
$encryptvalue = openssl_encrypt( $data_query, 'aes-128-cbc', $acting_opts['key_aes'], false, $acting_opts['key_iv'] ); |
| 3894 |
|
| 3895 |
$param_list['MerchantId'] = $acting_opts['merchant_id']; |
| 3896 |
$param_list['EncryptValue'] = urlencode( $encryptvalue ); |
| 3897 |
wp_redirect( add_query_arg( $param_list, $acting_opts['send_url_link'] ) ); |
| 3898 |
} else { |
| 3899 |
if ( usces_have_continue_charge() ) { |
| 3900 |
$chargingday = $usces->getItemChargingDay( $cart[0]['post_id'] ); |
| 3901 |
if ( 99 === (int) $chargingday ) { /* 受注日課金 */ |
| 3902 |
$operateid = $acting_opts['operateid']; |
| 3903 |
} else { |
| 3904 |
$operateid = '1Auth'; |
| 3905 |
} |
| 3906 |
} else { |
| 3907 |
$operateid = $acting_opts['operateid']; |
| 3908 |
} |
| 3909 |
$operateid = apply_filters( 'usces_filter_escott_operateid', $operateid, $cart, $usces_entries['order']['total_full_price'] ); |
| 3910 |
|
| 3911 |
$data_list = array(); |
| 3912 |
$data_list['OperateId'] = $operateid; |
| 3913 |
$data_list['MerchantPass'] = $acting_opts['merchant_pass']; |
| 3914 |
$data_list['TransactionDate'] = $transaction_date; |
| 3915 |
$data_list['MerchantFree1'] = $rand; |
| 3916 |
$data_list['MerchantFree2'] = $acting_flg; |
| 3917 |
$data_list['MerchantFree3'] = $this->merchantfree3; |
| 3918 |
$data_list['TenantId'] = $acting_opts['tenant_id']; |
| 3919 |
if ( 'on' === $acting_opts['quickpay'] && ! empty( $kaiin_id ) && ! empty( $kaiin_pass ) ) { |
| 3920 |
$data_list['KaiinId'] = $kaiin_id; |
| 3921 |
$data_list['KaiinPass'] = $kaiin_pass; |
| 3922 |
} |
| 3923 |
$data_list['PayType'] = '01'; |
| 3924 |
$data_list['Amount'] = $usces_entries['order']['total_full_price']; |
| 3925 |
$data_list['ProcNo'] = '0000000'; |
| 3926 |
$data_list['RedirectUrl'] = $redirecturl; |
| 3927 |
$data_query = http_build_query( $data_list ); |
| 3928 |
$encryptvalue = openssl_encrypt( $data_query, 'aes-128-cbc', $acting_opts['key_aes'], false, $acting_opts['key_iv'] ); |
| 3929 |
|
| 3930 |
$param_list['MerchantId'] = $acting_opts['merchant_id']; |
| 3931 |
$param_list['EncryptValue'] = urlencode( $encryptvalue ); |
| 3932 |
wp_redirect( add_query_arg( $param_list, $acting_opts['send_url_link'] ) ); |
| 3933 |
} |
| 3934 |
exit(); |
| 3935 |
|
| 3936 |
/* 銀聯 */ |
| 3937 |
} elseif ( 'acting_welcart_unionpay' === $acting_flg ) { |
| 3938 |
$home_url = str_replace( 'http://', 'https://', home_url( '/' ) ); |
| 3939 |
|
| 3940 |
$usces_entries = $usces->cart->get_entry(); |
| 3941 |
$cart = $usces->cart->get_cart(); |
| 3942 |
|
| 3943 |
if ( ! $usces_entries || ! $cart ) { |
| 3944 |
wp_redirect( USCES_CART_URL ); |
| 3945 |
exit(); |
| 3946 |
} |
| 3947 |
|
| 3948 |
if ( ! wp_verify_nonce( $_REQUEST['_nonce'], $acting_flg ) ) { |
| 3949 |
wp_redirect( USCES_CART_URL ); |
| 3950 |
exit(); |
| 3951 |
} |
| 3952 |
|
| 3953 |
parse_str( $post_query, $post_data ); |
| 3954 |
$transaction_date = $this->get_transaction_date(); |
| 3955 |
$rand = $post_data['rand']; |
| 3956 |
|
| 3957 |
usces_save_order_acting_data( $rand ); |
| 3958 |
|
| 3959 |
$data_list = array(); |
| 3960 |
$data_list['MerchantPass'] = $acting_opts['merchant_pass']; |
| 3961 |
$data_list['TransactionDate'] = $transaction_date; |
| 3962 |
$data_list['MerchantFree1'] = $rand; |
| 3963 |
$data_list['MerchantFree2'] = $acting_flg; |
| 3964 |
$data_list['MerchantFree3'] = $this->merchantfree3; |
| 3965 |
$data_list['TenantId'] = $acting_opts['tenant_id']; |
| 3966 |
$data_list['Amount'] = $usces_entries['order']['total_full_price']; |
| 3967 |
$data_list['CurrencyId'] = '392'; /* JPY */ |
| 3968 |
if ( ! empty( $acting_opts['unionpay_pagelanguage'] ) ) { |
| 3969 |
$data_list['PageLanguage'] = $acting_opts['unionpay_pagelanguage']; |
| 3970 |
} |
| 3971 |
// $data_list['PayCardType'] = '00'; |
| 3972 |
$data_list['ProcNo'] = sprintf( '%020d', $rand ); |
| 3973 |
$data_list['SuccessURL'] = USCES_CART_URL . $usces->delim . 'acting=' . $this->acting_unionpay . '&acting_return=1'; |
| 3974 |
$data_list['ErrorURL'] = USCES_CART_URL . $usces->delim . 'acting=' . $this->acting_unionpay . '&acting_return=0'; |
| 3975 |
$data_list['StatusNoticeURL'] = $home_url; |
| 3976 |
$data_list['EndNoticeURL'] = $home_url; |
| 3977 |
$data_query = http_build_query( $data_list ); |
| 3978 |
$encryptvalue = openssl_encrypt( $data_query, 'aes-128-cbc', $acting_opts['unionpay_key_aes'], false, $acting_opts['unionpay_key_iv'] ); |
| 3979 |
|
| 3980 |
$param_list = array(); |
| 3981 |
$param_list['MerchantId'] = $acting_opts['merchant_id']; |
| 3982 |
$param_list['OperateId'] = '11Gathering'; |
| 3983 |
$param_list['EncryptValue'] = $encryptvalue; |
| 3984 |
|
| 3985 |
$gc = new SLNConnection(); |
| 3986 |
$gc->send_request_unionpay( $acting_opts['send_url_unionpay'], $param_list ); |
| 3987 |
exit(); |
| 3988 |
} |
| 3989 |
} |
| 3990 |
|
| 3991 |
/** |
| 3992 |
* 受注データ登録 |
| 3993 |
* Called by usces_reg_orderdata() and usces_new_orderdata(). |
| 3994 |
* usces_action_reg_orderdata |
| 3995 |
* |
| 3996 |
* @param array $args Compact array( $cart, $entry, $order_id, $member_id, $payments, $charging_type, $results ). |
| 3997 |
*/ |
| 3998 |
public function register_orderdata( $args ) { |
| 3999 |
extract( $args ); // phpcs:ignore |
| 4000 |
|
| 4001 |
if ( ! isset( $results['MerchantFree1'] ) ) { |
| 4002 |
return; |
| 4003 |
} |
| 4004 |
|
| 4005 |
$acting_flg = $payments['settlement']; |
| 4006 |
if ( ! in_array( $acting_flg, $this->pay_method ) ) { |
| 4007 |
return; |
| 4008 |
} |
| 4009 |
|
| 4010 |
if ( ! $entry['order']['total_full_price'] ) { |
| 4011 |
return; |
| 4012 |
} |
| 4013 |
|
| 4014 |
parent::register_orderdata( $args ); |
| 4015 |
|
| 4016 |
if ( ! isset( $results['Amount'] ) ) { |
| 4017 |
$results['Amount'] = $entry['order']['total_full_price']; |
| 4018 |
} |
| 4019 |
$results = apply_filters( 'usces_filter_escott_register_orderdata_history_log', $results, $args ); |
| 4020 |
$this->save_acting_history_log( $results, $order_id . '_' . $results['MerchantFree1'] ); |
| 4021 |
} |
| 4022 |
|
| 4023 |
/** |
| 4024 |
* Front scripts. |
| 4025 |
* wp_print_footer_scripts |
| 4026 |
*/ |
| 4027 |
public function footer_scripts() { |
| 4028 |
global $usces; |
| 4029 |
|
| 4030 |
if ( ! $this->is_validity_acting( 'card' ) ) { |
| 4031 |
return; |
| 4032 |
} |
| 4033 |
|
| 4034 |
parent::footer_scripts(); |
| 4035 |
|
| 4036 |
/* 発送・支払方法ページ */ |
| 4037 |
if ( 'delivery' === $usces->page ) { |
| 4038 |
$acting_opts = $this->get_acting_settings(); |
| 4039 |
/* リンク型 */ |
| 4040 |
if ( isset( $acting_opts['card_activate'] ) && 'link' === $acting_opts['card_activate'] ) { |
| 4041 |
wp_enqueue_style( 'jquery-ui-style' ); |
| 4042 |
wp_enqueue_script( 'jquery-ui-dialog' ); |
| 4043 |
wp_enqueue_style( 'jquery-ui-dialog-min-css', includes_url() . 'css/jquery-ui-dialog.min.css' ); |
| 4044 |
wp_register_script( 'usces_cart_escott_link', USCES_FRONT_PLUGIN_URL . '/js/cart_escott_link.js', array( 'jquery' ), USCES_VERSION, true ); |
| 4045 |
$escott_params = array(); |
| 4046 |
$escott_params['card_activate'] = $acting_opts['card_activate']; |
| 4047 |
$escott_params['message']['agreement'] = $this->consent_message(); |
| 4048 |
$escott_params['message']['agree'] = __( 'Agree', 'usces' ); |
| 4049 |
$escott_params['message']['disagree'] = __( 'Disagree', 'usces' ); |
| 4050 |
wp_localize_script( 'usces_cart_escott_link', 'escott_params', $escott_params ); |
| 4051 |
wp_enqueue_script( 'usces_cart_escott_link' ); |
| 4052 |
} |
| 4053 |
} |
| 4054 |
|
| 4055 |
if ( ! usces_is_membersystem_state() || ! usces_is_login() ) { |
| 4056 |
return; |
| 4057 |
} |
| 4058 |
|
| 4059 |
/* クレジットカード� |
| 4060 |
報更新ページ */ |
| 4061 |
if ( isset( $_GET['usces_page'] ) && ( 'member_register_settlement' === filter_input( INPUT_GET, 'usces_page', FILTER_DEFAULT ) || 'member_update_settlement' === filter_input( INPUT_GET, 'usces_page', FILTER_DEFAULT ) ) ) { |
| 4062 |
// wp_enqueue_script( 'usces_escott_member', USCES_FRONT_PLUGIN_URL . '/js/member_escott.js', array( 'jquery' ), USCES_VERSION, true ); |
| 4063 |
print_google_recaptcha_response( filter_input( INPUT_GET, 'usces_page', FILTER_DEFAULT ), 'member-card-info', 'member_update_settlement' ); |
| 4064 |
} |
| 4065 |
|
| 4066 |
/* マイページ */ |
| 4067 |
if ( $usces->is_member_page( $_SERVER['REQUEST_URI'] ) ) { |
| 4068 |
$acting_opts = $this->get_acting_settings(); |
| 4069 |
if ( 'on' === $acting_opts['quickpay'] ) { |
| 4070 |
wp_enqueue_style( 'jquery-ui-style' ); |
| 4071 |
wp_enqueue_script( 'jquery-ui-dialog' ); |
| 4072 |
wp_enqueue_style( 'jquery-ui-dialog-min-css', includes_url() . 'css/jquery-ui-dialog.min.css' ); |
| 4073 |
wp_register_script( 'usces_member_escott', USCES_FRONT_PLUGIN_URL . '/js/member_escott.js', array( 'jquery' ), USCES_VERSION, true ); |
| 4074 |
$escott_params = array(); |
| 4075 |
$escott_params['sec3d_activate'] = $acting_opts['sec3d_activate']; |
| 4076 |
$escott_params['message']['agreement'] = $this->consent_message(); |
| 4077 |
$escott_params['message']['agree'] = __( 'Agree', 'usces' ); |
| 4078 |
$escott_params['message']['disagree'] = __( 'Disagree', 'usces' ); |
| 4079 |
$escott_params['update_settlement_url'] = urlencode( |
| 4080 |
add_query_arg( |
| 4081 |
array( |
| 4082 |
'usces_page' => 'member_update_settlement', |
| 4083 |
're-enter' => 1, |
| 4084 |
), |
| 4085 |
USCES_MEMBER_URL |
| 4086 |
) |
| 4087 |
); |
| 4088 |
$escott_params['register_settlement_url'] = urlencode( |
| 4089 |
add_query_arg( |
| 4090 |
array( |
| 4091 |
'usces_page' => 'member_register_settlement', |
| 4092 |
're-enter' => 1, |
| 4093 |
), |
| 4094 |
USCES_MEMBER_URL |
| 4095 |
) |
| 4096 |
); |
| 4097 |
$member = $usces->get_member(); |
| 4098 |
$escott_params['edit_auth'] = ( isset( $member['edit_auth'] ) ) ? $member['edit_auth'] : ''; |
| 4099 |
$escott_params['edit_flag'] = USCES_VERIFY_MEMBERS_EMAIL::$opts['edit_flag']; |
| 4100 |
wp_localize_script( 'usces_member_escott', 'escott_params', $escott_params ); |
| 4101 |
wp_enqueue_script( 'usces_member_escott' ); |
| 4102 |
} |
| 4103 |
} |
| 4104 |
} |
| 4105 |
|
| 4106 |
/** |
| 4107 |
* 支払方法説明 |
| 4108 |
* usces_fiter_the_payment_method_explanation |
| 4109 |
* |
| 4110 |
* @param string $explanation Explanation of Payment Method. |
| 4111 |
* @param array $payment Payment data. |
| 4112 |
* @param string $value Input value. |
| 4113 |
* @return string |
| 4114 |
*/ |
| 4115 |
public function set_payment_method_explanation( $explanation, $payment, $value ) { |
| 4116 |
global $usces; |
| 4117 |
|
| 4118 |
$quickpay = ''; |
| 4119 |
if ( $this->acting_flg_card === $payment['settlement'] ) { |
| 4120 |
$acting_opts = $this->get_acting_settings(); |
| 4121 |
if ( 'link' === $acting_opts['card_activate'] ) { |
| 4122 |
if ( usces_is_login() && 'on' === $acting_opts['quickpay'] ) { |
| 4123 |
$member = $usces->get_member(); |
| 4124 |
$kaiin_id = $this->get_quick_kaiin_id( $member['ID'] ); |
| 4125 |
$kaiin_pass = $this->get_quick_pass( $member['ID'] ); |
| 4126 |
if ( ! empty( $kaiin_id ) && ! empty( $kaiin_pass ) ) { |
| 4127 |
$quickpay = '<p class="' . $this->paymod_id . '_quick_member"><label type="update"><input type="checkbox" name="quick_member" value="update"><span>' . __( 'Change and register purchased credit card', 'usces' ) . '</span></label></p>'; |
| 4128 |
} else { |
| 4129 |
if ( usces_have_regular_order() || usces_have_continue_charge() ) { |
| 4130 |
$quickpay = '<input type="hidden" name="quick_member" value="add">'; |
| 4131 |
} elseif ( 'on' !== $acting_opts['chooseable_quickpay'] ) { |
| 4132 |
$quickpay = '<input type="hidden" name="quick_member" value="add">'; |
| 4133 |
} else { |
| 4134 |
$quickpay = '<p class="' . $this->paymod_id . '_quick_member"><label type="add"><input type="checkbox" name="quick_member" value="add"><span>' . __( 'Register and purchase a credit card', 'usces' ) . '</span></label></p>'; |
| 4135 |
} |
| 4136 |
} |
| 4137 |
} else { |
| 4138 |
$quickpay = '<input type="hidden" name="quick_member" value="no">'; |
| 4139 |
} |
| 4140 |
} |
| 4141 |
} |
| 4142 |
return $quickpay . $explanation; |
| 4143 |
} |
| 4144 |
|
| 4145 |
/** |
| 4146 |
* 利用可能な決済モジュール |
| 4147 |
* usces_filter_available_payment_method |
| 4148 |
* |
| 4149 |
* @param array $payments Payment data. |
| 4150 |
* @return array |
| 4151 |
*/ |
| 4152 |
public function set_available_payment_method( $payments ) { |
| 4153 |
global $usces; |
| 4154 |
|
| 4155 |
if ( $usces->is_member_page( $_SERVER['REQUEST_URI'] ) ) { |
| 4156 |
$payment_method = array(); |
| 4157 |
foreach ( (array) $payments as $id => $payment ) { |
| 4158 |
if ( $this->acting_flg_card === $payment['settlement'] ) { |
| 4159 |
$payment_method[ $id ] = $payments[ $id ]; |
| 4160 |
break; |
| 4161 |
} |
| 4162 |
} |
| 4163 |
if ( ! empty( $payment_method ) ) { |
| 4164 |
$payments = $payment_method; |
| 4165 |
} |
| 4166 |
} |
| 4167 |
return $payments; |
| 4168 |
} |
| 4169 |
|
| 4170 |
/** |
| 4171 |
* 支払回数 |
| 4172 |
* usces_filter_delivery_secure_form_howpay |
| 4173 |
* |
| 4174 |
* @param string $html HTML. |
| 4175 |
* @return string |
| 4176 |
*/ |
| 4177 |
public function delivery_secure_form_howpay( $html ) { |
| 4178 |
if ( isset( $_GET['usces_page'] ) && ( 'member_update_settlement' === filter_input( INPUT_GET, 'usces_page', FILTER_DEFAULT ) || 'member_register_settlement' === filter_input( INPUT_GET, 'usces_page', FILTER_DEFAULT ) ) ) { |
| 4179 |
$html = ''; |
| 4180 |
} |
| 4181 |
return $html; |
| 4182 |
} |
| 4183 |
|
| 4184 |
/** |
| 4185 |
* � |
| 4186 |
容確認ページ [注文する] ボタン |
| 4187 |
* usces_filter_confirm_inform |
| 4188 |
* |
| 4189 |
* @param string $html Purchase post form. |
| 4190 |
* @param array $payments Payment data. |
| 4191 |
* @param string $acting_flg Payment type. |
| 4192 |
* @param string $rand Welcart transaction key. |
| 4193 |
* @param string $purchase_disabled Disable purchase button. |
| 4194 |
* @return string |
| 4195 |
*/ |
| 4196 |
public function confirm_inform( $html, $payments, $acting_flg, $rand, $purchase_disabled ) { |
| 4197 |
global $usces; |
| 4198 |
|
| 4199 |
$html = parent::confirm_inform( $html, $payments, $acting_flg, $rand, $purchase_disabled ); |
| 4200 |
|
| 4201 |
$usces_entries = $usces->cart->get_entry(); |
| 4202 |
if ( ! $usces_entries['order']['total_full_price'] ) { |
| 4203 |
return $html; |
| 4204 |
} |
| 4205 |
|
| 4206 |
if ( $this->acting_flg_unionpay === $acting_flg ) { |
| 4207 |
$html = '<form id="purchase_form" action="' . USCES_CART_URL . '" method="post" onKeyDown="if(event.keyCode == 13){return false;}"> |
| 4208 |
<input type="hidden" name="rand" value="' . $rand . '"> |
| 4209 |
<div class="send"> |
| 4210 |
' . apply_filters( 'usces_filter_confirm_before_backbutton', null, $payments, $acting_flg, $rand ) . ' |
| 4211 |
<input name="backDelivery" type="submit" id="back_button" class="back_to_delivery_button" value="' . __( 'Back', 'usces' ) . '"' . apply_filters( 'usces_filter_confirm_prebutton', null ) . ' /> |
| 4212 |
<input name="purchase" type="submit" id="purchase_button" class="checkout_button" value="' . apply_filters( 'usces_filter_confirm_checkout_button_value', __( 'Checkout', 'usces' ) ) . '"' . apply_filters( 'usces_filter_confirm_nextbutton', null ) . $purchase_disabled . ' /> |
| 4213 |
</div> |
| 4214 |
<input type="hidden" name="_nonce" value="' . wp_create_nonce( $acting_flg ) . '">'; |
| 4215 |
} |
| 4216 |
return $html; |
| 4217 |
} |
| 4218 |
|
| 4219 |
/** |
| 4220 |
* Front styles. |
| 4221 |
* wp_print_styles |
| 4222 |
*/ |
| 4223 |
public function print_styles() { |
| 4224 |
global $usces; |
| 4225 |
|
| 4226 |
parent::print_styles(); |
| 4227 |
|
| 4228 |
/* マイページ */ |
| 4229 |
if ( $usces->is_member_page( $_SERVER['REQUEST_URI'] ) ) : |
| 4230 |
$acting_opts = $this->get_acting_settings(); |
| 4231 |
if ( isset( $acting_opts['card_activate'] ) && 'token' === $acting_opts['card_activate'] || 'link' === $acting_opts['card_activate'] ) : |
| 4232 |
?> |
| 4233 |
<style type="text/css"> |
| 4234 |
#escott-dialog { |
| 4235 |
left: 50% !important; |
| 4236 |
transform: translateY(-50%) translateX(-50%); |
| 4237 |
-webkit- transform: translateY(-50%) translateX(-50%); |
| 4238 |
width: 90% !important; |
| 4239 |
max-width: 700px; |
| 4240 |
} |
| 4241 |
#escott-agree-dialog { |
| 4242 |
height: auto !important; |
| 4243 |
} |
| 4244 |
.escott_agreement_message { |
| 4245 |
width: 100%; |
| 4246 |
height: 200px; |
| 4247 |
} |
| 4248 |
</style> |
| 4249 |
<?php |
| 4250 |
endif; |
| 4251 |
endif; |
| 4252 |
} |
| 4253 |
|
| 4254 |
/** |
| 4255 |
* Front scripts. |
| 4256 |
* wp_enqueue_scripts |
| 4257 |
*/ |
| 4258 |
public function enqueue_scripts() { |
| 4259 |
global $usces; |
| 4260 |
|
| 4261 |
/* 発送・支払方法ページ、クレジットカード� |
| 4262 |
報更新ページ */ |
| 4263 |
if ( ! is_admin() && $this->is_validity_acting( 'card' ) ) : |
| 4264 |
if ( ( $usces->is_cart_page( $_SERVER['REQUEST_URI'] ) && 'delivery' === $usces->page ) || |
| 4265 |
( $usces->is_member_page( $_SERVER['REQUEST_URI'] ) && ( 'member_register_settlement' === filter_input( INPUT_GET, 'usces_page', FILTER_DEFAULT ) || 'member_update_settlement' === filter_input( INPUT_GET, 'usces_page', FILTER_DEFAULT ) ) ) ) : |
| 4266 |
$acting_opts = $this->get_acting_settings(); |
| 4267 |
if ( isset( $acting_opts['card_activate'] ) && 'token' === $acting_opts['card_activate'] ) : |
| 4268 |
?> |
| 4269 |
<script type="text/javascript" src="<?php echo esc_attr( $acting_opts['api_token'] ); ?>?k_TokenNinsyoCode=<?php echo esc_attr( $acting_opts['token_code'] ); ?>" callBackFunc="setToken" class="spsvToken"></script> |
| 4270 |
<?php |
| 4271 |
endif; |
| 4272 |
endif; |
| 4273 |
endif; |
| 4274 |
} |
| 4275 |
|
| 4276 |
/** |
| 4277 |
* Set uscesL10n. |
| 4278 |
* usces_filter_uscesL10n |
| 4279 |
* |
| 4280 |
* @param string $l10n uscesL10n. |
| 4281 |
* @param int $post_id Post ID. |
| 4282 |
* @return string |
| 4283 |
*/ |
| 4284 |
public function set_uscesL10n( $l10n, $post_id ) { |
| 4285 |
global $usces; |
| 4286 |
|
| 4287 |
$l10n = parent::set_uscesL10n( $l10n, $post_id ); |
| 4288 |
|
| 4289 |
if ( $usces->is_cart_page( $_SERVER['REQUEST_URI'] ) && 'delivery' === $usces->page ) { |
| 4290 |
$acting_opts = $this->get_acting_settings(); |
| 4291 |
if ( isset( $acting_opts['card_activate'] ) && 'link' === $acting_opts['card_activate'] ) { |
| 4292 |
$front_ajaxurl = trailingslashit( USCES_SSL_URL ) . 'index.php'; |
| 4293 |
$l10n .= "'front_ajaxurl': '" . $front_ajaxurl . "',\n"; |
| 4294 |
$payment_method = usces_get_system_option( 'usces_payment_method', 'sort' ); |
| 4295 |
$payment_method = apply_filters( 'usces_fiter_the_payment_method', $payment_method, '' ); |
| 4296 |
foreach ( (array) $payment_method as $id => $payment ) { |
| 4297 |
if ( $payment['settlement'] === $this->acting_flg_card ) { |
| 4298 |
$l10n .= "'escott_link_payment_id': '" . $id . "',\n"; |
| 4299 |
break; |
| 4300 |
} |
| 4301 |
} |
| 4302 |
} |
| 4303 |
} elseif ( $usces->is_member_page( $_SERVER['REQUEST_URI'] ) && ( isset( $_GET['usces_page'] ) && ( 'member_register_settlement' === filter_input( INPUT_GET, 'usces_page', FILTER_DEFAULT ) || 'member_update_settlement' === filter_input( INPUT_GET, 'usces_page', FILTER_DEFAULT ) ) ) ) { |
| 4304 |
$acting_opts = $this->get_acting_settings(); |
| 4305 |
if ( isset( $acting_opts['card_activate'] ) && 'token' === $acting_opts['card_activate'] ) { |
| 4306 |
$front_ajaxurl = trailingslashit( USCES_SSL_URL ) . 'index.php'; |
| 4307 |
$l10n .= "'front_ajaxurl': '" . $front_ajaxurl . "',\n"; |
| 4308 |
$l10n .= "'escott_token_error_message': '" . __( 'Credit card information is not appropriate.', 'usces' ) . "',\n"; |
| 4309 |
} |
| 4310 |
} |
| 4311 |
return $l10n; |
| 4312 |
} |
| 4313 |
|
| 4314 |
/** |
| 4315 |
* クレジットカード登録・変更ページ表示 |
| 4316 |
* usces_filter_template_redirect |
| 4317 |
*/ |
| 4318 |
public function member_update_settlement() { |
| 4319 |
global $usces; |
| 4320 |
|
| 4321 |
if ( $usces->is_member_page( $_SERVER['REQUEST_URI'] ) ) { |
| 4322 |
if ( ! usces_is_membersystem_state() || ! usces_is_login() ) { |
| 4323 |
return; |
| 4324 |
} |
| 4325 |
|
| 4326 |
$acting_opts = $this->get_acting_settings(); |
| 4327 |
if ( 'on' !== $acting_opts['quickpay'] ) { |
| 4328 |
return; |
| 4329 |
} |
| 4330 |
|
| 4331 |
if ( isset( $_REQUEST['usces_page'] ) && 'member_update_settlement' === wp_unslash( $_REQUEST['usces_page'] ) ) { |
| 4332 |
add_filter( 'usces_filter_states_form_js', array( $this, 'states_form_js' ) ); |
| 4333 |
$usces->page = 'member_update_settlement'; |
| 4334 |
$this->member_update_settlement_form(); |
| 4335 |
exit(); |
| 4336 |
|
| 4337 |
} elseif ( isset( $_REQUEST['usces_page'] ) && 'member_register_settlement' === wp_unslash( $_REQUEST['usces_page'] ) ) { |
| 4338 |
add_filter( 'usces_filter_states_form_js', array( $this, 'states_form_js' ) ); |
| 4339 |
$usces->page = 'member_register_settlement'; |
| 4340 |
$this->member_update_settlement_form(); |
| 4341 |
exit(); |
| 4342 |
} |
| 4343 |
} |
| 4344 |
return false; |
| 4345 |
} |
| 4346 |
|
| 4347 |
/** |
| 4348 |
* クレジットカード登録・変更ページ表示 |
| 4349 |
* usces_filter_states_form_js |
| 4350 |
* |
| 4351 |
* @param string $js Scripts. |
| 4352 |
* @return string |
| 4353 |
*/ |
| 4354 |
public function states_form_js( $js ) { |
| 4355 |
return ''; |
| 4356 |
} |
| 4357 |
|
| 4358 |
/** |
| 4359 |
* 会員データ削除チェック |
| 4360 |
* usces_filter_delete_member_check |
| 4361 |
* |
| 4362 |
* @param boolean $del Deletable. |
| 4363 |
* @param int $member_id Member ID. |
| 4364 |
* @return boolean |
| 4365 |
*/ |
| 4366 |
public function delete_member_check( $del, $member_id ) { |
| 4367 |
$kaiin_id = $this->get_quick_kaiin_id( $member_id ); |
| 4368 |
if ( ! empty( $kaiin_id ) ) { |
| 4369 |
$del = false; |
| 4370 |
} |
| 4371 |
return $del; |
| 4372 |
} |
| 4373 |
|
| 4374 |
/** |
| 4375 |
* クレジットカード登録・変更ページリンク |
| 4376 |
* usces_action_member_submenu_list |
| 4377 |
*/ |
| 4378 |
public function e_update_settlement() { |
| 4379 |
global $usces; |
| 4380 |
|
| 4381 |
$member = $usces->get_member(); |
| 4382 |
$html = $this->update_settlement( '', $member ); |
| 4383 |
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 4384 |
} |
| 4385 |
|
| 4386 |
/** |
| 4387 |
* クレジットカード登録・変更ページリンク |
| 4388 |
* usces_filter_member_submenu_list |
| 4389 |
* |
| 4390 |
* @param string $html Submenu area of the member page. |
| 4391 |
* @param array $member Member information. |
| 4392 |
* @return string |
| 4393 |
*/ |
| 4394 |
public function update_settlement( $html, $member ) { |
| 4395 |
$acting_opts = $this->get_acting_settings(); |
| 4396 |
if ( 'on' === $acting_opts['quickpay'] ) { |
| 4397 |
/* e-SCOTT 会員� |
| 4398 |
�会 */ |
| 4399 |
$response_member = $this->escott_member_reference( $member['ID'] ); |
| 4400 |
if ( 'OK' === $response_member['ResponseCd'] ) { |
| 4401 |
if ( 'on' === $acting_opts['sec3d_activate'] ) { |
| 4402 |
$html .= '<li class="settlement-update gotoedit"><a href="javascript:void(0);" class="escott_agreement" data-mode="update">' . __( 'Change the credit card is here >>', 'usces' ) . '</a></li>'; |
| 4403 |
} else { |
| 4404 |
$update_settlement_url = add_query_arg( |
| 4405 |
array( |
| 4406 |
'usces_page' => 'member_update_settlement', |
| 4407 |
're-enter' => 1, |
| 4408 |
), |
| 4409 |
USCES_MEMBER_URL |
| 4410 |
); |
| 4411 |
$html .= '<li class="settlement-update gotoedit"><a href="' . $update_settlement_url . '">' . __( 'Change the credit card is here >>', 'usces' ) . '</a></li>'; |
| 4412 |
} |
| 4413 |
} else { |
| 4414 |
if ( 'on' === $acting_opts['sec3d_activate'] ) { |
| 4415 |
$html .= '<li class="settlement-register gotoedit"><a href="javascript:void(0);" class="escott_agreement" data-mode="register">' . __( 'Credit card registration is here >>', 'usces' ) . '</a></li>'; |
| 4416 |
} else { |
| 4417 |
$register_settlement_url = add_query_arg( |
| 4418 |
array( |
| 4419 |
'usces_page' => 'member_register_settlement', |
| 4420 |
're-enter' => 1, |
| 4421 |
), |
| 4422 |
USCES_MEMBER_URL |
| 4423 |
); |
| 4424 |
$html .= '<li class="settlement-register gotoedit"><a href="' . $register_settlement_url . '">' . __( 'Credit card registration is here >>', 'usces' ) . '</a></li>'; |
| 4425 |
} |
| 4426 |
} |
| 4427 |
} |
| 4428 |
return $html; |
| 4429 |
} |
| 4430 |
|
| 4431 |
/** |
| 4432 |
* クレジットカード登録・変更ページ |
| 4433 |
*/ |
| 4434 |
public function member_update_settlement_form() { |
| 4435 |
global $usces; |
| 4436 |
|
| 4437 |
$member = $usces->get_member(); |
| 4438 |
$acting_opts = $this->get_acting_settings(); |
| 4439 |
|
| 4440 |
/* 外部リンク(三� |
| 4441 |
間画面) */ |
| 4442 |
if ( 'link' === $acting_opts['card_activate'] ) { |
| 4443 |
$transaction_date = $this->get_transaction_date(); |
| 4444 |
$home_url = str_replace( 'http://', 'https://', home_url( '/' ) ); |
| 4445 |
$redirecturl = $home_url . '?page_id=' . USCES_MEMBER_NUMBER; |
| 4446 |
|
| 4447 |
$data_list = array(); |
| 4448 |
$data_list['MerchantPass'] = $acting_opts['merchant_pass']; |
| 4449 |
$data_list['TransactionDate'] = $transaction_date; |
| 4450 |
$data_list['MerchantFree3'] = $this->merchantfree3; |
| 4451 |
$data_list['TenantId'] = $acting_opts['tenant_id']; |
| 4452 |
if ( 'member_register_settlement' === $usces->page ) { |
| 4453 |
$data_list['OperateId'] = '4MemAdd'; |
| 4454 |
$data_list['KaiinId'] = $this->make_kaiin_id( $member['ID'] ); |
| 4455 |
$data_list['KaiinPass'] = $this->make_kaiin_pass(); |
| 4456 |
} else { |
| 4457 |
$data_list['OperateId'] = '4MemChg'; |
| 4458 |
$data_list['KaiinId'] = $this->get_quick_kaiin_id( $member['ID'] ); |
| 4459 |
$data_list['KaiinPass'] = $this->get_quick_pass( $member['ID'] ); |
| 4460 |
} |
| 4461 |
$data_list['ProcNo'] = '0000000'; |
| 4462 |
$data_list['RedirectUrl'] = $redirecturl; |
| 4463 |
$data_query = http_build_query( $data_list ); |
| 4464 |
$encryptvalue = openssl_encrypt( $data_query, 'aes-128-cbc', $acting_opts['key_aes'], false, $acting_opts['key_iv'] ); |
| 4465 |
|
| 4466 |
$param_list['MerchantId'] = $acting_opts['merchant_id']; |
| 4467 |
$param_list['EncryptValue'] = urlencode( $encryptvalue ); |
| 4468 |
wp_redirect( add_query_arg( $param_list, $acting_opts['send_url_link'] ) ); |
| 4469 |
exit(); |
| 4470 |
|
| 4471 |
/* マイページ */ |
| 4472 |
} else { |
| 4473 |
$script = ''; |
| 4474 |
$done_message = ''; |
| 4475 |
$html = ''; |
| 4476 |
$register = ( 'member_register_settlement' === $usces->page ) ? true : false; |
| 4477 |
$deleted = false; |
| 4478 |
|
| 4479 |
$cardno = ''; |
| 4480 |
$seccd = ''; |
| 4481 |
$expyy = ''; |
| 4482 |
$expmm = ''; |
| 4483 |
$cardname = ''; |
| 4484 |
|
| 4485 |
if ( 'on' === $acting_opts['quickpay'] ) { |
| 4486 |
if ( isset( $_POST['update'] ) ) { |
| 4487 |
check_admin_referer( 'member_update_settlement', 'wc_nonce' ); |
| 4488 |
$verify_action = wel_verify_update_settlement( $member['ID'] ); |
| 4489 |
if ( ! $verify_action ) { |
| 4490 |
$usces->error_message .= '<p>' . __( 'Update has been locked. Please contact the store administrator.', 'usces' ) . '</p>'; |
| 4491 |
} else { |
| 4492 |
$response_member = $this->escott_member_update( $member['ID'] ); |
| 4493 |
if ( 'OK' === $response_member['ResponseCd'] ) { |
| 4494 |
$this->send_update_settlement_mail(); |
| 4495 |
$done_message = __( 'Successfully updated.', 'usces' ); |
| 4496 |
} else { |
| 4497 |
$usces->error_message .= '<p>' . __( 'Credit card information is not appropriate.', 'usces' ) . '</p>'; |
| 4498 |
$cardno = filter_input( INPUT_POST, 'cardno', FILTER_DEFAULT ); |
| 4499 |
$seccd = filter_input( INPUT_POST, 'seccd', FILTER_DEFAULT ); |
| 4500 |
$expyy = filter_input( INPUT_POST, 'expyy', FILTER_DEFAULT ); |
| 4501 |
$expmm = filter_input( INPUT_POST, 'expmm', FILTER_DEFAULT ); |
| 4502 |
$cardname = filter_input( INPUT_POST, 'cardname', FILTER_DEFAULT ); |
| 4503 |
} |
| 4504 |
} |
| 4505 |
} elseif ( isset( $_POST['register'] ) ) { |
| 4506 |
check_admin_referer( 'member_update_settlement', 'wc_nonce' ); |
| 4507 |
$verify_action = wel_verify_update_settlement( $member['ID'] ); |
| 4508 |
if ( ! $verify_action ) { |
| 4509 |
$usces->error_message .= '<p>' . __( 'Update has been locked. Please contact the store administrator.', 'usces' ) . '</p>'; |
| 4510 |
} else { |
| 4511 |
$response_member = $this->escott_member_register( $member['ID'] ); |
| 4512 |
if ( 'OK' === $response_member['ResponseCd'] ) { |
| 4513 |
$done_message = __( 'Successfully registered.', 'usces' ); |
| 4514 |
$register = false; |
| 4515 |
} else { |
| 4516 |
$usces->error_message .= '<p>' . __( 'Credit card information is not appropriate.', 'usces' ) . '</p>'; |
| 4517 |
$cardno = filter_input( INPUT_POST, 'cardno', FILTER_DEFAULT ); |
| 4518 |
$seccd = filter_input( INPUT_POST, 'seccd', FILTER_DEFAULT ); |
| 4519 |
$expyy = filter_input( INPUT_POST, 'expyy', FILTER_DEFAULT ); |
| 4520 |
$expmm = filter_input( INPUT_POST, 'expmm', FILTER_DEFAULT ); |
| 4521 |
$cardname = filter_input( INPUT_POST, 'cardname', FILTER_DEFAULT ); |
| 4522 |
} |
| 4523 |
} |
| 4524 |
} |
| 4525 |
|
| 4526 |
if ( ! $deleted ) { |
| 4527 |
/* e-SCOTT 会員� |
| 4528 |
�会 */ |
| 4529 |
$response_member = $this->escott_member_reference( $member['ID'] ); |
| 4530 |
if ( 'OK' === $response_member['ResponseCd'] ) { |
| 4531 |
$cardlast4 = substr( $response_member['CardNo'], -4 ); |
| 4532 |
$expyy = substr( date_i18n( 'Y', current_time( 'timestamp' ) ), 0, 2 ) . substr( $response_member['CardExp'], 0, 2 ); |
| 4533 |
$expmm = substr( $response_member['CardExp'], 2, 2 ); |
| 4534 |
} else { |
| 4535 |
$cardlast4 = ''; |
| 4536 |
} |
| 4537 |
$html .= '<input name="acting" type="hidden" value="' . $this->paymod_id . '" /> |
| 4538 |
<table class="customer_form" id="' . $this->paymod_id . '">'; |
| 4539 |
if ( ! empty( $cardlast4 ) ) { |
| 4540 |
$html .= ' |
| 4541 |
<tr> |
| 4542 |
<th scope="row">' . __( 'The last four digits of your card number', 'usces' ) . '</th> |
| 4543 |
<td colspan="2"><p>' . $cardlast4 . '</p></td> |
| 4544 |
</tr>'; |
| 4545 |
} |
| 4546 |
$cardno_attention = apply_filters( 'usces_filter_cardno_attention', __( '(Single-byte numbers only)', 'usces' ) . '<div class="attention">' . __( '* Please do not enter symbols or letters other than numbers such as space (blank), hyphen (-) between numbers.', 'usces' ) . '</div>' ); |
| 4547 |
$html .= ' |
| 4548 |
<tr> |
| 4549 |
<th scope="row">' . __( 'card number', 'usces' ) . '</th> |
| 4550 |
<td colspan="2"><input name="cardno" id="cardno" type="tel" value="' . $cardno . '" />' . $cardno_attention . '</td> |
| 4551 |
</tr>'; |
| 4552 |
if ( 'on' === $acting_opts['seccd'] ) { |
| 4553 |
$seccd_attention = apply_filters( 'usces_filter_seccd_attention', __( '(Single-byte numbers only)', 'usces' ) ); |
| 4554 |
$html .= ' |
| 4555 |
<tr> |
| 4556 |
<th scope="row">' . __( 'security code', 'usces' ) . '</th> |
| 4557 |
<td colspan="2"><input name="seccd" id="seccd" type="tel" value="' . $seccd . '" />' . $seccd_attention . '</td> |
| 4558 |
</tr>'; |
| 4559 |
} |
| 4560 |
$html .= ' |
| 4561 |
<tr> |
| 4562 |
<th scope="row">' . __( 'Card expiration', 'usces' ) . '</th> |
| 4563 |
<td colspan="2"> |
| 4564 |
<select id="expmm"> |
| 4565 |
<option value=""' . selected( empty( $expmm ), true, false ) . '>--</option>'; |
| 4566 |
for ( $i = 1; $i <= 12; $i++ ) { |
| 4567 |
$html .= ' |
| 4568 |
<option value="' . sprintf( '%02d', $i ) . '"' . selected( (int) $expmm, $i, false ) . '>' . sprintf( '%2d', $i ) . '</option>'; |
| 4569 |
} |
| 4570 |
$html .= ' |
| 4571 |
</select>' . __( 'month', 'usces' ) . ' |
| 4572 |
<select id="expyy"> |
| 4573 |
<option value=""' . selected( empty( $expyy ), true, false ) . '>----</option>'; |
| 4574 |
for ( $i = 0; $i < 15; $i++ ) { |
| 4575 |
$year = date_i18n( 'Y' ) + $i; |
| 4576 |
$html .= ' |
| 4577 |
<option value="' . $year . '"' . selected( (int) $expyy, (int) $year, false ) . '>' . $year . '</option>'; |
| 4578 |
} |
| 4579 |
$html .= ' |
| 4580 |
</select>' . __( 'year', 'usces' ) . ' |
| 4581 |
</td> |
| 4582 |
</tr>'; |
| 4583 |
|
| 4584 |
$cardname_attention = apply_filters( 'usces_filter_cardname_attention', __( '(Alphabetic characters only)', 'usces' ) . '<div class="attention">' . __( '* Use a space to separate the first and last name, and enter all characters in uppercase.', 'usces' ) . '</div>' ); |
| 4585 |
$html .= ' |
| 4586 |
<tr> |
| 4587 |
<th scope="row">' . __( 'Card name', 'usces' ) . '</th> |
| 4588 |
<td colspan="2"><input name="cardname" id="cardname" type="text" value="" />' . $cardname_attention . '</td> |
| 4589 |
</tr> |
| 4590 |
</table>'; |
| 4591 |
} |
| 4592 |
|
| 4593 |
if ( empty( $usces->error_message ) && isset( $_GET['re-enter'] ) && isset( $_GET['ResponseCd'] ) ) { |
| 4594 |
if ( 'NG' === wp_unslash( $_GET['ResponseCd'] ) ) { |
| 4595 |
$usces->error_message = __( 'Credit card information is not appropriate.', 'usces' ); |
| 4596 |
} |
| 4597 |
} |
| 4598 |
} |
| 4599 |
|
| 4600 |
$update_settlement_url = add_query_arg( |
| 4601 |
array( |
| 4602 |
'usces_page' => $usces->page, |
| 4603 |
'settlement' => 1, |
| 4604 |
're-enter' => 1, |
| 4605 |
), |
| 4606 |
USCES_MEMBER_URL |
| 4607 |
); |
| 4608 |
if ( '' !== $done_message ) { |
| 4609 |
$script .= ' |
| 4610 |
<script type="text/javascript"> |
| 4611 |
jQuery.event.add( window, "load", function() { |
| 4612 |
alert("' . $done_message . '"); |
| 4613 |
}); |
| 4614 |
</script>'; |
| 4615 |
} |
| 4616 |
$error_message = apply_filters( 'usces_filter_member_update_settlement_error_message', $usces->error_message ); |
| 4617 |
|
| 4618 |
ob_start(); |
| 4619 |
get_header(); |
| 4620 |
if ( '' !== $script ) { |
| 4621 |
echo $script; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 4622 |
} |
| 4623 |
?> |
| 4624 |
<div id="content" class="two-column"> |
| 4625 |
<div class="catbox"> |
| 4626 |
<?php |
| 4627 |
if ( have_posts() ) : |
| 4628 |
usces_remove_filter(); |
| 4629 |
?> |
| 4630 |
<div class="post" id="wc_member_update_settlement"> |
| 4631 |
<?php |
| 4632 |
if ( $register ) : |
| 4633 |
?> |
| 4634 |
<h1 class="member_page_title"><?php esc_html_e( 'Credit card registration', 'usces' ); ?></h1> |
| 4635 |
<?php |
| 4636 |
else : |
| 4637 |
?> |
| 4638 |
<h1 class="member_page_title"><?php esc_html_e( 'Credit card update', 'usces' ); ?></h1> |
| 4639 |
<?php |
| 4640 |
endif; |
| 4641 |
?> |
| 4642 |
<div class="entry"> |
| 4643 |
<div id="memberpages"> |
| 4644 |
<div class="whitebox"> |
| 4645 |
<div id="memberinfo"> |
| 4646 |
<div class="header_explanation"></div> |
| 4647 |
<?php |
| 4648 |
if ( ! $deleted && ! $register ) : |
| 4649 |
?> |
| 4650 |
<p><?php esc_html_e( 'If you want to change the expiration date only, please the card number to the blank.', 'usces' ); ?></p> |
| 4651 |
<?php |
| 4652 |
endif; |
| 4653 |
?> |
| 4654 |
<div class="error_message"><?php echo wp_kses_post( $error_message ); ?></div> |
| 4655 |
<?php |
| 4656 |
if ( 'token' === $acting_opts['card_activate'] ) : |
| 4657 |
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 4658 |
endif; |
| 4659 |
?> |
| 4660 |
<form id="member-card-info" name="member_update_settlement" action="<?php echo esc_url( $update_settlement_url ); ?>" method="post" onKeyDown="if(event.keyCode == 13) {return false;}"> |
| 4661 |
<?php |
| 4662 |
if ( 'on' === $acting_opts['card_activate'] ) : |
| 4663 |
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 4664 |
endif; |
| 4665 |
?> |
| 4666 |
<div class="send"> |
| 4667 |
<input type="hidden" name="expmm" value="<?php echo esc_attr( $expmm ); ?>" /> |
| 4668 |
<input type="hidden" name="expyy" value="<?php echo esc_attr( $expyy ); ?>" /> |
| 4669 |
<?php |
| 4670 |
if ( 'token' === $acting_opts['card_activate'] ) : |
| 4671 |
?> |
| 4672 |
<input type="hidden" name="token" id="token" value="" /> |
| 4673 |
<input type="hidden" name="billingname" id="billingname" value="" /> |
| 4674 |
<?php |
| 4675 |
endif; |
| 4676 |
if ( 'on' === $acting_opts['sec3d_activate'] ) : |
| 4677 |
?> |
| 4678 |
<input type="hidden" name="billingemail" id="billingemail" value="<?php echo esc_attr( $member['mailaddress1'] ); ?>" /> |
| 4679 |
<input type="hidden" name="rand" id="rand" value="<?php echo esc_attr( usces_acting_key() ); ?>" /> |
| 4680 |
<?php |
| 4681 |
endif; |
| 4682 |
if ( $register ) : |
| 4683 |
?> |
| 4684 |
<input type="hidden" name="register" value="register" /> |
| 4685 |
<input type="button" id="card-register" class="card-register" value="<?php esc_attr_e( 'Register' ); ?>" /> |
| 4686 |
<?php |
| 4687 |
else : |
| 4688 |
if ( ! $deleted ) : |
| 4689 |
?> |
| 4690 |
<input type="hidden" name="update" value="update" /> |
| 4691 |
<input type="button" id="card-update" class="card-update" value="<?php esc_attr_e( 'Update' ); ?>" /> |
| 4692 |
<?php |
| 4693 |
endif; |
| 4694 |
endif; |
| 4695 |
?> |
| 4696 |
<input type="button" name="back" value="<?php esc_attr_e( 'Back to the member page.', 'usces' ); ?>" onclick="location.href='<?php echo esc_url( USCES_MEMBER_URL ); ?>'" /> |
| 4697 |
<input type="button" name="top" value="<?php esc_attr_e( 'Back to the top page.', 'usces' ); ?>" onclick="location.href='<?php echo esc_url( home_url() ); ?>'" /> |
| 4698 |
</div> |
| 4699 |
<?php wp_nonce_field( 'member_update_settlement', 'wc_nonce' ); ?> |
| 4700 |
</form> |
| 4701 |
<div class="footer_explanation"></div> |
| 4702 |
</div><!-- end of memberinfo --> |
| 4703 |
</div><!-- end of whitebox --> |
| 4704 |
</div><!-- end of memberpages --> |
| 4705 |
</div><!-- end of entry --> |
| 4706 |
</div><!-- end of post --> |
| 4707 |
<?php |
| 4708 |
else : |
| 4709 |
?> |
| 4710 |
<p><?php esc_html_e( 'Sorry, no posts matched your criteria.', 'usces' ); ?></p> |
| 4711 |
<?php |
| 4712 |
endif; |
| 4713 |
?> |
| 4714 |
</div><!-- end of catbox --> |
| 4715 |
</div><!-- end of content --> |
| 4716 |
<?php |
| 4717 |
$sidebar = apply_filters( 'usces_filter_member_update_settlement_page_sidebar', 'cartmember' ); |
| 4718 |
if ( ! empty( $sidebar ) ) { |
| 4719 |
get_sidebar( $sidebar ); |
| 4720 |
} |
| 4721 |
get_footer(); |
| 4722 |
$contents = ob_get_contents(); |
| 4723 |
ob_end_clean(); |
| 4724 |
|
| 4725 |
echo $contents; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 4726 |
} |
| 4727 |
} |
| 4728 |
|
| 4729 |
/** |
| 4730 |
* クレジットカード変更確認メール |
| 4731 |
*/ |
| 4732 |
public function send_update_settlement_mail() { |
| 4733 |
global $usces; |
| 4734 |
|
| 4735 |
$member = $usces->get_member(); |
| 4736 |
// $mail_data = $usces->options['mail_data']; |
| 4737 |
|
| 4738 |
$subject = apply_filters( 'usces_filter_send_update_settlement_mail_subject', __( 'Confirmation of credit card update', 'usces' ), $member ); |
| 4739 |
$mail_header = __( 'Your credit card information has been updated on the membership page.', 'usces' ) . "\r\n\r\n"; |
| 4740 |
// $mail_footer = $mail_data['footer']['thankyou']; |
| 4741 |
$mail_footer = get_option( 'blogname' ) . "\r\n"; |
| 4742 |
$name = usces_localized_name( $member['name1'], $member['name2'], 'return' ); |
| 4743 |
|
| 4744 |
$message = '--------------------------------' . "\r\n"; |
| 4745 |
$message .= __( 'Member ID', 'usces' ) . ' : ' . $member['ID'] . "\r\n"; |
| 4746 |
$message .= __( 'Name', 'usces' ) . ' : ' . sprintf( _x( '%s', 'honorific', 'usces' ), $name ) . "\r\n"; |
| 4747 |
$message .= __( 'e-mail adress', 'usces' ) . ' : ' . $member['mailaddress1'] . "\r\n"; |
| 4748 |
$message .= '--------------------------------' . "\r\n\r\n"; |
| 4749 |
$message .= __( 'If you have not requested this email, sorry to trouble you, but please contact us.', 'usces' ) . "\r\n\r\n"; |
| 4750 |
$message = apply_filters( 'usces_filter_send_update_settlement_mail_message', $message, $member ); |
| 4751 |
$message = apply_filters( 'usces_filter_send_update_settlement_mail_message_head', $mail_header, $member ) . $message . apply_filters( 'usces_filter_send_update_settlement_mail_message_foot', $mail_footer, $member ) . "\r\n"; |
| 4752 |
$message = sprintf( __( 'Dear %s', 'usces' ), $name ) . "\r\n\r\n" . $message; |
| 4753 |
|
| 4754 |
$send_para = array( |
| 4755 |
'to_name' => sprintf( _x( '%s', 'honorific', 'usces' ), $name ), |
| 4756 |
'to_address' => $member['mailaddress1'], |
| 4757 |
'from_name' => get_option( 'blogname' ), |
| 4758 |
'from_address' => $usces->options['sender_mail'], |
| 4759 |
'reply_name' => get_option( 'blogname' ), |
| 4760 |
'reply_to' => usces_get_first_order_mail(), |
| 4761 |
'return_path' => $usces->options['sender_mail'], |
| 4762 |
'subject' => $subject, |
| 4763 |
'message' => do_shortcode( $message ), |
| 4764 |
); |
| 4765 |
usces_send_mail( $send_para ); |
| 4766 |
|
| 4767 |
$admin_message = $mail_header; |
| 4768 |
$admin_message .= '--------------------------------' . "\r\n"; |
| 4769 |
$admin_message .= __( 'Member ID', 'usces' ) . ' : ' . $member['ID'] . "\r\n"; |
| 4770 |
$admin_message .= __( 'Name', 'usces' ) . ' : ' . sprintf( _x( '%s', 'honorific', 'usces' ), $name ) . "\r\n"; |
| 4771 |
$admin_message .= __( 'e-mail adress', 'usces' ) . ' : ' . $member['mailaddress1'] . "\r\n"; |
| 4772 |
$admin_message .= '--------------------------------' . "\r\n\r\n"; |
| 4773 |
if ( usces_have_member_continue_order( $member['ID'] ) ) { |
| 4774 |
$admin_message .= $this->message_continue_order( $member['ID'] ); |
| 4775 |
} |
| 4776 |
if ( usces_have_member_regular_order( $member['ID'] ) ) { |
| 4777 |
$admin_message .= $this->message_regular_order( $member['ID'] ); |
| 4778 |
} |
| 4779 |
$admin_message .= |
| 4780 |
"\r\n----------------------------------------------------\r\n" . |
| 4781 |
'REMOTE_ADDR : ' . $_SERVER['REMOTE_ADDR'] . |
| 4782 |
"\r\n----------------------------------------------------\r\n"; |
| 4783 |
|
| 4784 |
$admin_para = array( |
| 4785 |
'to_name' => apply_filters( 'usces_filter_bccmail_to_admin_name', 'Shop Admin' ), |
| 4786 |
'to_address' => $usces->options['order_mail'], |
| 4787 |
'from_name' => apply_filters( 'usces_filter_bccmail_from_admin_name', 'Welcart Auto BCC' ), |
| 4788 |
'from_address' => $usces->options['sender_mail'], |
| 4789 |
'reply_name' => get_option( 'blogname' ), |
| 4790 |
'reply_to' => usces_get_first_order_mail(), |
| 4791 |
'return_path' => $usces->options['sender_mail'], |
| 4792 |
'subject' => $subject . '( ' . sprintf( _x( '%s', 'honorific', 'usces' ), $name ) . ' )', |
| 4793 |
'message' => do_shortcode( $admin_message ), |
| 4794 |
); |
| 4795 |
usces_send_mail( $admin_para ); |
| 4796 |
} |
| 4797 |
|
| 4798 |
/** |
| 4799 |
* 契約中の自動継続課金� |
| 4800 |
報 |
| 4801 |
* |
| 4802 |
* @param int $member_id Member ID. |
| 4803 |
*/ |
| 4804 |
public function message_continue_order( $member_id ) { |
| 4805 |
global $usces, $wpdb; |
| 4806 |
|
| 4807 |
$message = ''; |
| 4808 |
$query = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}usces_continuation WHERE `con_member_id` = %d AND `con_acting` = %s AND `con_status` = 'continuation'", $member_id, 'acting_welcart_card' ); |
| 4809 |
$continue_order = $wpdb->get_results( $query, ARRAY_A ); |
| 4810 |
if ( 0 < count( $continue_order ) ) { |
| 4811 |
$message .= '--------------------------------' . "\r\n"; |
| 4812 |
$message .= __( 'Auto-continuation charging Information under Contract with a credit card', 'usces' ) . "\r\n"; |
| 4813 |
foreach ( $continue_order as $continue_data ) { |
| 4814 |
$con_id = $continue_data['con_id']; |
| 4815 |
$con_order_id = $continue_data['con_order_id']; |
| 4816 |
$message .= __( 'Order number', 'usces' ) . ' : ' . $con_order_id; |
| 4817 |
$status = $this->get_latest_status( $member_id, $con_order_id ); |
| 4818 |
if ( ! empty( $status ) ) { |
| 4819 |
$next_charging = ( empty( $continue_data['con_next_contracting'] ) ) ? dlseller_next_charging( $con_order_id ) : $continue_data['con_next_contracting']; |
| 4820 |
$message .= ' ( ' . __( 'Next Withdrawal Date', 'dlseller' ) . ' : ' . date_i18n( __( 'Y/m/d' ), strtotime( $next_charging ) ); |
| 4821 |
if ( 0 < (int) $continue_data['con_interval'] ) { |
| 4822 |
$next_contracting = ( empty( $continue_data['con_next_contracting'] ) ) ? dlseller_next_contracting( $con_order_id ) : $continue_data['con_next_contracting']; |
| 4823 |
$message .= ', ' . __( 'Renewal Date', 'dlseller' ) . ' : ' . date_i18n( __( 'Y/m/d' ), strtotime( $next_contracting ) ); |
| 4824 |
} |
| 4825 |
$message .= ' )'; |
| 4826 |
if ( 'OK' !== $status ) { |
| 4827 |
$message .= ' ' . __( 'Condition', 'dlseller' ) . ' : ' . __( 'Settlement error', 'usces' ); |
| 4828 |
$log_data = $this->get_acting_log( $con_order_id ); |
| 4829 |
if ( $log_data && 0 < count( $log_data ) ) { |
| 4830 |
$acting_data = usces_unserialize( $log_data[0]['log'] ); |
| 4831 |
$trans_id = ( isset( $acting_data['MerchantFree1'] ) ) ? $acting_data['MerchantFree1'] : ''; |
| 4832 |
} else { |
| 4833 |
$trans_id = $usces->get_order_meta_value( 'trans_id', $con_order_id ); |
| 4834 |
} |
| 4835 |
if ( $trans_id ) { |
| 4836 |
$message .= ' ( ' . __( 'Transaction ID', 'usces' ) . ' : ' . $trans_id . ' )'; |
| 4837 |
} |
| 4838 |
} |
| 4839 |
} |
| 4840 |
$message .= "\r\n"; |
| 4841 |
} |
| 4842 |
$message .= '--------------------------------' . "\r\n\r\n"; |
| 4843 |
} |
| 4844 |
return $message; |
| 4845 |
} |
| 4846 |
|
| 4847 |
/** |
| 4848 |
* 契約中の定期購� |
| 4849 |
�� |
| 4850 |
報 |
| 4851 |
* |
| 4852 |
* @param int $member_id Member ID. |
| 4853 |
*/ |
| 4854 |
public function message_regular_order( $member_id ) { |
| 4855 |
global $usces, $wpdb; |
| 4856 |
|
| 4857 |
$message = ''; |
| 4858 |
$regular_table_name = $wpdb->prefix . 'usces_regular'; |
| 4859 |
$regular_detail_table_name = $wpdb->prefix . 'usces_regular_detail'; |
| 4860 |
$order_table_name = $wpdb->prefix . 'usces_order'; |
| 4861 |
$order_meta_table_name = $wpdb->prefix . 'usces_order_meta'; |
| 4862 |
|
| 4863 |
$query = $wpdb->prepare( "SELECT r.reg_id, r.reg_payment_name, d.regdet_schedule_date FROM {$regular_detail_table_name} AS `d` RIGHT JOIN {$regular_table_name} AS `r` ON r.reg_id = d.reg_id WHERE r.reg_mem_id = %d AND d.regdet_condition = 'continuation' GROUP BY r.reg_id", $member_id ); |
| 4864 |
$regular_order = $wpdb->get_results( $query, ARRAY_A ); |
| 4865 |
if ( 0 < count( $regular_order ) ) { |
| 4866 |
foreach ( $regular_order as $regular_data ) { |
| 4867 |
$payment = $usces->getPayments( $regular_data['reg_payment_name'] ); |
| 4868 |
if ( 'acting_welcart_card' !== $payment['settlement'] ) { |
| 4869 |
continue; |
| 4870 |
} |
| 4871 |
$reg_id = $regular_data['reg_id']; |
| 4872 |
$message .= __( 'Regular ID', 'autodelivery' ) . ' : ' . $reg_id; |
| 4873 |
$query = $wpdb->prepare( |
| 4874 |
"SELECT o.ID AS `order_id`, meta.meta_value AS `deco_id`, DATE_FORMAT( order_date, %s ) AS `date` |
| 4875 |
FROM {$order_table_name} AS `o` |
| 4876 |
LEFT JOIN {$order_meta_table_name} AS `meta` ON o.ID = meta.order_id AND meta.meta_key = 'dec_order_id' |
| 4877 |
LEFT JOIN {$regular_table_name} ON o.ID = reg_order_id |
| 4878 |
WHERE reg_id = %d |
| 4879 |
UNION ALL |
| 4880 |
SELECT o1.ID AS `order_id`, meta1.meta_value AS `deco_id`, DATE_FORMAT( order_date, %s ) AS `date` |
| 4881 |
FROM {$order_table_name} AS `o1` |
| 4882 |
LEFT JOIN {$order_meta_table_name} AS `meta1` ON o1.ID = meta1.order_id AND meta1.meta_key = 'dec_order_id' |
| 4883 |
LEFT JOIN {$order_meta_table_name} AS `meta2` ON o1.ID = meta2.order_id AND meta2.meta_key = 'regular_id' |
| 4884 |
WHERE meta2.meta_value = %d |
| 4885 |
ORDER BY order_id DESC, date DESC", |
| 4886 |
'%Y-%m-%d', |
| 4887 |
$reg_id, |
| 4888 |
'%Y-%m-%d', |
| 4889 |
$reg_id |
| 4890 |
); |
| 4891 |
$regular_order_data = $wpdb->get_results( $query, ARRAY_A ); |
| 4892 |
if ( 0 < count( $regular_order_data ) ) { |
| 4893 |
$reg_order_id = $regular_order_data[0]['order_id']; |
| 4894 |
$status = $this->get_latest_status( $member_id, $reg_order_id ); |
| 4895 |
if ( ! empty( $status ) && 'OK' === $status ) { |
| 4896 |
if ( $this->isdate( $regular_data['regdet_schedule_date'] ) ) { |
| 4897 |
$message .= ' ( ' . __( 'Scheduled order date', 'autodelivery' ) . ' : ' . date_i18n( __( 'Y/m/d' ), strtotime( $regular_data['regdet_schedule_date'] ) ) . ' )'; |
| 4898 |
} |
| 4899 |
} else { |
| 4900 |
$message .= ' ' . __( 'Condition', 'autodelivery' ) . ' : ' . __( 'Settlement error', 'usces' ); |
| 4901 |
$trans_id = $usces->get_order_meta_value( 'trans_id', $reg_order_id ); |
| 4902 |
if ( $trans_id ) { |
| 4903 |
$message .= ' ( ' . __( 'Transaction ID', 'usces' ) . ' : ' . $trans_id . ' )'; |
| 4904 |
} |
| 4905 |
} |
| 4906 |
$message .= "\r\n"; |
| 4907 |
} |
| 4908 |
} |
| 4909 |
if ( '' !== $message ) { |
| 4910 |
$message = '--------------------------------' . "\r\n" |
| 4911 |
. __( 'Subscription Information under Contract with a credit card', 'usces' ) . "\r\n" |
| 4912 |
. $message |
| 4913 |
. '--------------------------------' . "\r\n\r\n"; |
| 4914 |
} |
| 4915 |
} |
| 4916 |
|
| 4917 |
return $message; |
| 4918 |
} |
| 4919 |
|
| 4920 |
/** |
| 4921 |
* 利用可能な支払方法 |
| 4922 |
* usces_filter_the_continue_payment_method |
| 4923 |
* |
| 4924 |
* @param array $payment_method Payment method. |
| 4925 |
* @return array |
| 4926 |
*/ |
| 4927 |
public function continuation_payment_method( $payment_method ) { |
| 4928 |
$acting_opts = $this->get_acting_settings(); |
| 4929 |
if ( 'on' === $acting_opts['quickpay'] ) { |
| 4930 |
$payment_method[] = 'acting_welcart_card'; |
| 4931 |
} |
| 4932 |
return $payment_method; |
| 4933 |
} |
| 4934 |
|
| 4935 |
/** |
| 4936 |
* 利用可能な支払方法 |
| 4937 |
* dlseller_filter_the_payment_method_restriction |
| 4938 |
* wcad_filter_the_payment_method_restriction |
| 4939 |
* |
| 4940 |
* @param array $payments_restriction Payment method. |
| 4941 |
* @param string $payments_value Input value. |
| 4942 |
* @return array |
| 4943 |
*/ |
| 4944 |
public function payment_method_restriction( $payments_restriction, $payments_value ) { |
| 4945 |
$acting_opts = $this->get_acting_settings(); |
| 4946 |
if ( ( usces_have_regular_order() || usces_have_continue_charge() ) && usces_is_login() && 'on' === $acting_opts['quickpay'] ) { |
| 4947 |
$payments = usces_get_system_option( 'usces_payment_method', 'settlement' ); |
| 4948 |
$payments_restriction[] = $payments['acting_welcart_card']; |
| 4949 |
foreach ( (array) $payments_restriction as $key => $value ) { |
| 4950 |
$sort[ $key ] = $value['sort']; |
| 4951 |
} |
| 4952 |
array_multisort( $sort, SORT_ASC, $payments_restriction ); |
| 4953 |
} |
| 4954 |
return $payments_restriction; |
| 4955 |
} |
| 4956 |
|
| 4957 |
/** |
| 4958 |
* 「初回引落し日」 |
| 4959 |
* dlseller_filter_first_charging |
| 4960 |
* |
| 4961 |
* @param object $time Datetime. |
| 4962 |
* @param int $post_id Post ID. |
| 4963 |
* @param array $usces_item Item data. |
| 4964 |
* @param int $order_id Order number. |
| 4965 |
* @param array $continue_data Continuation data. |
| 4966 |
* @return object |
| 4967 |
*/ |
| 4968 |
public function first_charging_date( $time, $post_id, $usces_item, $order_id, $continue_data ) { |
| 4969 |
if ( 99 === (int) $usces_item['item_chargingday'] ) { |
| 4970 |
if ( empty( $order_id ) ) { |
| 4971 |
$today = date_i18n( 'Y-m-d', current_time( 'timestamp' ) ); |
| 4972 |
list( $year, $month, $day ) = explode( '-', $today ); |
| 4973 |
$time = mktime( 0, 0, 0, (int) $month, (int) $day, (int) $year ); |
| 4974 |
} |
| 4975 |
} |
| 4976 |
return $time; |
| 4977 |
} |
| 4978 |
|
| 4979 |
/** |
| 4980 |
* 継続課金会員リスト「有効期限」 |
| 4981 |
* dlseller_filter_continue_member_list_limitofcard |
| 4982 |
* |
| 4983 |
* @param string $limitofcard Card expiration date. |
| 4984 |
* @param int $member_id Member ID. |
| 4985 |
* @param int $order_id Order number. |
| 4986 |
* @param array $meta_data Continuation data. |
| 4987 |
* @return string |
| 4988 |
*/ |
| 4989 |
public function continue_member_list_limitofcard( $limitofcard, $member_id, $order_id, $meta_data ) { |
| 4990 |
if ( isset( $meta_data['acting'] ) ) { |
| 4991 |
if ( version_compare( WCEX_DLSELLER_VERSION, '3.0-beta', '<=' ) ) { |
| 4992 |
$payment = usces_get_payments_by_name( $meta_data['acting'] ); |
| 4993 |
$acting = $payment['settlement']; |
| 4994 |
} else { |
| 4995 |
$acting = $meta_data['acting']; |
| 4996 |
} |
| 4997 |
if ( 'acting_welcart_card' !== $acting ) { |
| 4998 |
return $limitofcard; |
| 4999 |
} |
| 5000 |
|
| 5001 |
$acting_opts = $this->get_acting_settings(); |
| 5002 |
if ( 'on' !== $acting_opts['quickpay'] ) { |
| 5003 |
return $limitofcard; |
| 5004 |
} |
| 5005 |
|
| 5006 |
$kaiin_id = $this->get_quick_kaiin_id( $member_id ); |
| 5007 |
$kaiin_pass = $this->get_quick_pass( $member_id ); |
| 5008 |
|
| 5009 |
if ( ! empty( $kaiin_id ) && ! empty( $kaiin_pass ) ) { |
| 5010 |
/* e-SCOTT 会員� |
| 5011 |
�会 */ |
| 5012 |
$response_member = $this->escott_member_reference( $member_id, $kaiin_id, $kaiin_pass ); |
| 5013 |
if ( 'OK' === $response_member['ResponseCd'] ) { |
| 5014 |
$expyy = substr( date_i18n( 'Y', current_time( 'timestamp' ) ), 0, 2 ) . substr( $response_member['CardExp'], 0, 2 ); |
| 5015 |
$expmm = substr( $response_member['CardExp'], 2, 2 ); |
| 5016 |
$limit = $expyy . $expmm; |
| 5017 |
$now = date_i18n( 'Ym', current_time( 'timestamp', 0 ) ); |
| 5018 |
$limitofcard = $expmm . '/' . substr( $response_member['CardExp'], 0, 2 ); |
| 5019 |
if ( $limit <= $now ) { |
| 5020 |
$limitofcard .= '<br /><a href="javascript:void(0)" onClick="uscesMail.getMailData( \'' . $member_id . '\', \'' . $order_id . '\' )">' . __( 'Update Request Email', 'dlseller' ) . '</a>'; |
| 5021 |
} |
| 5022 |
} |
| 5023 |
} else { |
| 5024 |
$limitofcard = ''; |
| 5025 |
} |
| 5026 |
} |
| 5027 |
return $limitofcard; |
| 5028 |
} |
| 5029 |
|
| 5030 |
/** |
| 5031 |
* 継続課金会員リスト「契約」 |
| 5032 |
* dlseller_filter_continue_member_list_continue_status |
| 5033 |
* |
| 5034 |
* @param string $status Continuation status. |
| 5035 |
* @param int $member_id Member ID. |
| 5036 |
* @param int $order_id Order number. |
| 5037 |
* @param array $meta_data Continuation data. |
| 5038 |
* @return string |
| 5039 |
*/ |
| 5040 |
public function continue_member_list_continue_status( $status, $member_id, $order_id, $meta_data ) { |
| 5041 |
return $status; |
| 5042 |
} |
| 5043 |
|
| 5044 |
/** |
| 5045 |
* 継続課金会員リスト「状� |
| 5046 |
�」 |
| 5047 |
* dlseller_filter_continue_member_list_condition |
| 5048 |
* |
| 5049 |
* @param string $condition Continuation condition. |
| 5050 |
* @param int $member_id Member ID. |
| 5051 |
* @param int $order_id Order number. |
| 5052 |
* @param array $meta_data Continuation data. |
| 5053 |
* @return string |
| 5054 |
*/ |
| 5055 |
public function continue_member_list_condition( $condition, $member_id, $order_id, $meta_data ) { |
| 5056 |
global $usces; |
| 5057 |
|
| 5058 |
$order_data = $usces->get_order_data( $order_id, 'direct' ); |
| 5059 |
$payment = $usces->getPayments( $order_data['order_payment_name'] ); |
| 5060 |
if ( isset( $payment['settlement'] ) && 'acting_welcart_card' === $payment['settlement'] ) { |
| 5061 |
$url = admin_url( 'admin.php?page=usces_continue&continue_action=settlement&member_id=' . $member_id . '&order_id=' . $order_id ); |
| 5062 |
$condition = '<a href="' . $url . '">' . __( 'Detail', 'usces' ) . '</a>'; |
| 5063 |
|
| 5064 |
if ( 'continuation' === $meta_data['status'] ) { |
| 5065 |
$status = $this->get_latest_status( $member_id, $order_id ); |
| 5066 |
if ( ! empty( $status ) && 'OK' !== $status ) { |
| 5067 |
$condition .= '<div class="acting-status card-error">' . __( 'Settlement error', 'usces' ) . '</div>'; |
| 5068 |
} |
| 5069 |
} |
| 5070 |
} |
| 5071 |
return $condition; |
| 5072 |
} |
| 5073 |
|
| 5074 |
/** |
| 5075 |
* 継続課金会員決済状況ページ表示 |
| 5076 |
* dlseller_action_continue_member_list_page |
| 5077 |
* |
| 5078 |
* @param string $continue_action Continuation action. |
| 5079 |
*/ |
| 5080 |
public function continue_member_list_page( $continue_action ) { |
| 5081 |
if ( 'settlement' === $continue_action ) { |
| 5082 |
$member_id = filter_input( INPUT_GET, 'member_id' ); |
| 5083 |
$order_id = filter_input( INPUT_GET, 'order_id' ); |
| 5084 |
if ( ! is_null( $member_id ) && ! is_null( $order_id ) ) { |
| 5085 |
$this->continue_member_settlement_info_page( $member_id, $order_id ); |
| 5086 |
exit(); |
| 5087 |
} |
| 5088 |
} |
| 5089 |
} |
| 5090 |
|
| 5091 |
/** |
| 5092 |
* 継続課金会員決済状況ページ |
| 5093 |
* |
| 5094 |
* @param int $member_id Member ID. |
| 5095 |
* @param int $order_id Order number. |
| 5096 |
*/ |
| 5097 |
public function continue_member_settlement_info_page( $member_id, $order_id ) { |
| 5098 |
global $usces; |
| 5099 |
|
| 5100 |
if ( version_compare( WCEX_DLSELLER_VERSION, '3.0-beta', '<=' ) ) { |
| 5101 |
$continue_data = usces_unserialize( $usces->get_member_meta_value( 'continuepay_' . $order_id, $member_id ) ); |
| 5102 |
} else { |
| 5103 |
$continue_data = $this->get_continuation_data( $order_id, $member_id ); |
| 5104 |
} |
| 5105 |
$curent_url = $_SERVER['REQUEST_URI']; |
| 5106 |
$navibutton = '<a href="' . esc_url( $_SERVER['HTTP_REFERER'] ) . '" class="back-list"><span class="dashicons dashicons-list-view"></span>' . __( 'Back to the continue members list', 'dlseller' ) . '</a>'; |
| 5107 |
|
| 5108 |
$order_data = $usces->get_order_data( $order_id, 'direct' ); |
| 5109 |
if ( ! $order_data ) { |
| 5110 |
return; |
| 5111 |
} |
| 5112 |
|
| 5113 |
$member_info = $usces->get_member_info( $member_id ); |
| 5114 |
$name = usces_localized_name( $member_info['mem_name1'], $member_info['mem_name2'], 'return' ); |
| 5115 |
$acting_data = usces_unserialize( $usces->get_order_meta_value( 'acting_welcart_card', $order_id ) ); |
| 5116 |
|
| 5117 |
$payment = $usces->getPayments( $order_data['order_payment_name'] ); |
| 5118 |
if ( 'acting_welcart_card' !== $payment['settlement'] ) { |
| 5119 |
return; |
| 5120 |
} |
| 5121 |
|
| 5122 |
$contracted_date = ( empty( $continue_data['contractedday'] ) ) ? dlseller_next_contracting( $order_id ) : $continue_data['contractedday']; |
| 5123 |
if ( ! empty( $contracted_date ) ) { |
| 5124 |
list( $contracted_year, $contracted_month, $contracted_day ) = explode( '-', $contracted_date ); |
| 5125 |
} else { |
| 5126 |
$contracted_year = 0; |
| 5127 |
$contracted_month = 0; |
| 5128 |
$contracted_day = 0; |
| 5129 |
} |
| 5130 |
$charged_date = ( empty( $continue_data['chargedday'] ) ) ? dlseller_next_charging( $order_id ) : $continue_data['chargedday']; |
| 5131 |
if ( ! empty( $charged_date ) ) { |
| 5132 |
list( $charged_year, $charged_month, $charged_day ) = explode( '-', $charged_date ); |
| 5133 |
} else { |
| 5134 |
$charged_year = 0; |
| 5135 |
$charged_month = 0; |
| 5136 |
$charged_day = 0; |
| 5137 |
} |
| 5138 |
$year = substr( date_i18n( 'Y', current_time( 'timestamp' ) ), 0, 4 ); |
| 5139 |
$total_full_price = $order_data['order_item_total_price'] - $order_data['order_usedpoint'] + $order_data['order_discount'] + $order_data['order_shipping_charge'] + $order_data['order_cod_fee'] + $order_data['order_tax']; |
| 5140 |
|
| 5141 |
$log_data = $this->get_acting_log( $order_id ); |
| 5142 |
$num = ( $log_data ) ? count( $log_data ) + 1 : 1; |
| 5143 |
|
| 5144 |
$kaiin_id = $this->get_quick_kaiin_id( $member_id ); |
| 5145 |
$card = ( empty( $kaiin_id ) ) ? ' <span id="settlement-status"><span class="acting-status card-error">' . __( 'Card unregistered', 'usces' ) . '</span></span>' : ''; |
| 5146 |
?> |
| 5147 |
<div class="wrap"> |
| 5148 |
<div class="usces_admin"> |
| 5149 |
<h1>Welcart Management <?php esc_html_e( 'Continuation charging member information', 'dlseller' ); ?></h1> |
| 5150 |
<p class="version_info">Version <?php echo esc_html( WCEX_DLSELLER_VERSION ); ?></p> |
| 5151 |
<?php usces_admin_action_status(); ?> |
| 5152 |
<div class="edit_pagenav"><?php echo wp_kses_post( $navibutton ); ?></div> |
| 5153 |
<div id="datatable"> |
| 5154 |
<div id="tablesearch" class="usces_tablesearch"> |
| 5155 |
<div id="searchBox" style="display:block"> |
| 5156 |
<table class="search_table"> |
| 5157 |
<tr> |
| 5158 |
<td class="label"><?php esc_html_e( 'Continuation charging information', 'dlseller' ); ?></td> |
| 5159 |
<td> |
| 5160 |
<table class="order_info"> |
| 5161 |
<tr> |
| 5162 |
<th><?php esc_html_e( 'Member ID', 'dlseller' ); ?></th> |
| 5163 |
<td><?php echo esc_html( $member_id ); ?><?php echo wp_kses_post( $card ); ?></td> |
| 5164 |
<th><?php esc_html_e( 'Contractor name', 'dlseller' ); ?></th> |
| 5165 |
<td><?php echo esc_html( $name ); ?></td> |
| 5166 |
</tr> |
| 5167 |
<tr> |
| 5168 |
<th><?php esc_html_e( 'Order ID', 'dlseller' ); ?></th> |
| 5169 |
<td><?php echo esc_html( $order_id ); ?></td> |
| 5170 |
<th><?php esc_html_e( 'Application Date', 'dlseller' ); ?></th> |
| 5171 |
<td><?php echo esc_html( $order_data['order_date'] ); ?></td> |
| 5172 |
</tr> |
| 5173 |
<tr> |
| 5174 |
<th><?php esc_html_e( 'Renewal Date', 'dlseller' ); ?></th> |
| 5175 |
<td> |
| 5176 |
<select id="contracted-year"> |
| 5177 |
<option value="0"<?php selected( (int) $contracted_year, 0 ); ?>></option> |
| 5178 |
<?php for ( $i = 0; $i <= 10; $i++ ) : ?> |
| 5179 |
<option value="<?php echo esc_attr( $year + $i ); ?>"<?php selected( (int) $contracted_year, ( (int) $year + $i ) ); ?>><?php echo esc_html( (int) $year + $i ); ?></option> |
| 5180 |
<?php endfor; ?> |
| 5181 |
</select>-<select id="contracted-month"> |
| 5182 |
<option value="0"<?php selected( (int) $contracted_month, 0 ); ?>></option> |
| 5183 |
<?php for ( $i = 1; $i <= 12; $i++ ) : ?> |
| 5184 |
<option value="<?php printf( '%02d', $i ); ?>"<?php selected( (int) $contracted_month, $i ); ?>><?php printf( '%2d', $i ); ?></option> |
| 5185 |
<?php endfor; ?> |
| 5186 |
</select>-<select id="contracted-day"> |
| 5187 |
<option value="0"<?php selected( $contracted_day, 0 ); ?>></option> |
| 5188 |
<?php for ( $i = 1; $i <= 31; $i++ ) : ?> |
| 5189 |
<option value="<?php printf( '%02d', $i ); ?>"<?php selected( (int) $contracted_day, $i ); ?>><?php printf( '%2d', $i ); ?></option> |
| 5190 |
<?php endfor; ?> |
| 5191 |
</select> |
| 5192 |
</td> |
| 5193 |
<th><?php esc_html_e( 'Next Withdrawal Date', 'dlseller' ); ?></th> |
| 5194 |
<td> |
| 5195 |
<select id="charged-year"> |
| 5196 |
<option value="0"<?php selected( (int) $charged_year, 0 ); ?>></option> |
| 5197 |
<option value="<?php echo esc_attr( $year ); ?>"<?php selected( (int) $charged_year, (int) $year ); ?>><?php echo esc_html( $year ); ?></option> |
| 5198 |
<option value="<?php echo esc_attr( $year + 1 ); ?>"<?php selected( (int) $charged_year, ( (int) $year + 1 ) ); ?>><?php echo esc_html( (int) $year + 1 ); ?></option> |
| 5199 |
</select>-<select id="charged-month"> |
| 5200 |
<option value="0"<?php selected( (int) $charged_month, 0 ); ?>></option> |
| 5201 |
<?php for ( $i = 1; $i <= 12; $i++ ) : ?> |
| 5202 |
<option value="<?php printf( '%02d', $i ); ?>"<?php selected( (int) $charged_month, $i ); ?>><?php printf( '%2d', $i ); ?></option> |
| 5203 |
<?php endfor; ?> |
| 5204 |
</select>-<select id="charged-day"> |
| 5205 |
<option value="0"<?php selected( $charged_day, 0 ); ?>></option> |
| 5206 |
<?php for ( $i = 1; $i <= 31; $i++ ) : ?> |
| 5207 |
<option value="<?php printf( '%02d', $i ); ?>"<?php selected( (int) $charged_day, $i ); ?>><?php printf( '%2d', $i ); ?></option> |
| 5208 |
<?php endfor; ?> |
| 5209 |
</select> |
| 5210 |
</td> |
| 5211 |
</tr> |
| 5212 |
<tr> |
| 5213 |
<th><?php esc_html_e( 'Amount on order', 'usces' ); ?></th> |
| 5214 |
<td><?php usces_crform( $continue_data['order_price'], false ); ?></td> |
| 5215 |
<th><?php esc_html_e( 'Settlement amount', 'usces' ); ?></th> |
| 5216 |
<td><input type="text" id="price" style="text-align: right;" value="<?php usces_crform( $continue_data['price'], false, false, '', false ); ?>"><?php usces_crcode(); ?></td> |
| 5217 |
</tr> |
| 5218 |
<tr> |
| 5219 |
<th><?php esc_html_e( 'Status', 'dlseller' ); ?></th> |
| 5220 |
<td><select id="dlseller-status"> |
| 5221 |
<?php |
| 5222 |
ob_start(); |
| 5223 |
if ( 'continuation' === $continue_data['status'] ) : |
| 5224 |
?> |
| 5225 |
<option value="continuation" selected="selected"><?php esc_html_e( 'Continuation', 'dlseller' ); ?></option> |
| 5226 |
<option value="cancellation"><?php esc_html_e( 'Stop', 'dlseller' ); ?></option> |
| 5227 |
<?php |
| 5228 |
else : |
| 5229 |
?> |
| 5230 |
<option value="cancellation" selected="selected"><?php esc_html_e( 'Cancellation', 'dlseller' ); ?></option> |
| 5231 |
<option value="continuation"><?php esc_html_e( 'Resumption', 'dlseller' ); ?></option> |
| 5232 |
<?php |
| 5233 |
endif; |
| 5234 |
$dlseller_status_options = ob_get_contents(); |
| 5235 |
ob_end_clean(); |
| 5236 |
$dlseller_status_options = apply_filters( 'usces_filter_continuation_charging_status_options', $dlseller_status_options, $continue_data ); |
| 5237 |
wel_esc_script_e( $dlseller_status_options ); |
| 5238 |
?> |
| 5239 |
</select></td> |
| 5240 |
<td colspan="2"><input id="continuation-update" type="button" class="button button-primary" value="<?php esc_attr_e( 'Update' ); ?>" /></td> |
| 5241 |
</tr> |
| 5242 |
</table> |
| 5243 |
<?php do_action( 'usces_action_continuation_charging_information', $continue_data, $member_id, $order_id ); ?> |
| 5244 |
</td> |
| 5245 |
</tr> |
| 5246 |
</table> |
| 5247 |
</div><!-- searchBox --> |
| 5248 |
</div><!-- tablesearch --> |
| 5249 |
<table id="mainDataTable" class="new-table order-new-table"> |
| 5250 |
<thead> |
| 5251 |
<tr> |
| 5252 |
<th scope="col"> </th> |
| 5253 |
<th scope="col"><?php esc_html_e( 'Processing date', 'usces' ); ?></th> |
| 5254 |
<th scope="col"><?php esc_html_e( 'Transaction ID', 'usces' ); ?></th> |
| 5255 |
<th scope="col"><?php esc_html_e( 'Settlement amount', 'usces' ); ?></th> |
| 5256 |
<th scope="col"><?php esc_html_e( 'Processing classification', 'usces' ); ?></th> |
| 5257 |
<th scope="col"> </th> |
| 5258 |
</tr> |
| 5259 |
</thead> |
| 5260 |
<?php |
| 5261 |
foreach ( (array) $log_data as $log_row ) : |
| 5262 |
$log = $this->get_acting_latest_log( $log_row['log_key'], 'ALL' ); |
| 5263 |
if ( isset( $log['OperateId'] ) && isset( $log['ResponseCd'] ) && 'OK' === $log['ResponseCd'] ) { |
| 5264 |
$class = ' card-' . mb_strtolower( substr( $log['OperateId'], 1 ) ); |
| 5265 |
$status_name = $this->get_operate_name( $log['OperateId'] ); |
| 5266 |
$merchantfree1 = $log['MerchantFree1']; |
| 5267 |
$responsecd = ''; |
| 5268 |
$amount = ( isset( $log['Amount'] ) ) ? usces_crform( $log['Amount'], false, true, 'return', true ) : ''; |
| 5269 |
} else { |
| 5270 |
$class = ' card-error'; |
| 5271 |
$status_name = __( 'Settlement error', 'usces' ); |
| 5272 |
if ( isset( $log_row['log'] ) ) { |
| 5273 |
$log = usces_unserialize( $log_row['log'] ); |
| 5274 |
if ( isset( $log['MerchantFree1'] ) ) { |
| 5275 |
$merchantfree1 = $log['MerchantFree1']; |
| 5276 |
} else { |
| 5277 |
$log_key = explode( '_', $log_row['log_key'] ); |
| 5278 |
$merchantfree1 = ( isset( $log_key[1] ) ) ? $log_key[1] : '9999999999'; |
| 5279 |
} |
| 5280 |
$responsecd = $log['ResponseCd']; |
| 5281 |
$amount = ( isset( $log['Amount'] ) ) ? usces_crform( $log['Amount'], false, true, 'return', true ) : ''; |
| 5282 |
} else { |
| 5283 |
$log_key = explode( '_', $log_row['log_key'] ); |
| 5284 |
$merchantfree1 = ( isset( $log_key[1] ) ) ? $log_key[1] : '9999999999'; |
| 5285 |
$responsecd = 'NG'; |
| 5286 |
$amount = ''; |
| 5287 |
} |
| 5288 |
} |
| 5289 |
?> |
| 5290 |
<tbody> |
| 5291 |
<tr> |
| 5292 |
<td><?php echo esc_html( $num ); ?></td> |
| 5293 |
<td><?php echo esc_html( $log_row['datetime'] ); ?></td> |
| 5294 |
<td><?php echo esc_html( $merchantfree1 ); ?></td> |
| 5295 |
<td class="amount"><?php echo esc_html( $amount ); ?></td> |
| 5296 |
<?php |
| 5297 |
if ( ! empty( $status_name ) ) : |
| 5298 |
?> |
| 5299 |
<td><span id="settlement-status-<?php echo esc_attr( $num ); ?>"><span class="acting-status<?php echo esc_attr( $class ); ?>"><?php echo esc_html( $status_name ); ?></span></span></td> |
| 5300 |
<td> |
| 5301 |
<input type="button" id="settlement-information-<?php echo esc_attr( $merchantfree1 ); ?>-<?php echo esc_attr( $num ); ?>" class="button settlement-information" value="<?php esc_attr_e( 'Settlement info', 'usces' ); ?>"> |
| 5302 |
<input type="hidden" id="responsecd-<?php echo esc_attr( $merchantfree1 ); ?>-<?php echo esc_attr( $num ); ?>" value="<?php echo esc_attr( $responsecd ); ?>"> |
| 5303 |
</td> |
| 5304 |
<?php |
| 5305 |
else : |
| 5306 |
?> |
| 5307 |
<td> </td><td> </td> |
| 5308 |
<?php |
| 5309 |
endif; |
| 5310 |
?> |
| 5311 |
</tr> |
| 5312 |
</tbody> |
| 5313 |
<?php |
| 5314 |
$num--; |
| 5315 |
endforeach; |
| 5316 |
$trans_id = $usces->get_order_meta_value( 'trans_id', $order_id ); |
| 5317 |
$latest_log = $this->get_acting_latest_log( $order_id . '_' . $trans_id, 'ALL' ); |
| 5318 |
if ( $latest_log ) : |
| 5319 |
$class = ' card-' . mb_strtolower( substr( $latest_log['OperateId'], 1 ) ); |
| 5320 |
$status_name = $this->get_operate_name( $latest_log['OperateId'] ); |
| 5321 |
if ( isset( $latest_log['Amount'] ) ) { |
| 5322 |
$amount = usces_crform( $latest_log['Amount'], false, true, 'return', true ); |
| 5323 |
} elseif ( isset( $continue_data['order_price'] ) ) { |
| 5324 |
$amount = usces_crform( $continue_data['order_price'], false, true, 'return', true ); |
| 5325 |
} else { |
| 5326 |
$amount = ''; |
| 5327 |
} |
| 5328 |
?> |
| 5329 |
<tbody> |
| 5330 |
<tr> |
| 5331 |
<td>1</td> |
| 5332 |
<td><?php echo esc_html( $order_data['order_date'] ); ?></td> |
| 5333 |
<td><?php echo esc_html( $trans_id ); ?></td> |
| 5334 |
<td class="amount"><?php echo esc_html( $amount ); ?></td> |
| 5335 |
<?php |
| 5336 |
if ( ! empty( $status_name ) ) : |
| 5337 |
?> |
| 5338 |
<td><span id="settlement-status-1"><span class="acting-status<?php echo esc_attr( $class ); ?>"><?php echo esc_html( $status_name ); ?></span></span></td> |
| 5339 |
<td><input type="button" id="settlement-information-<?php echo esc_attr( $trans_id ); ?>-1" class="button settlement-information" value="<?php esc_attr_e( 'Settlement info', 'usces' ); ?>"></td> |
| 5340 |
<?php |
| 5341 |
else : |
| 5342 |
?> |
| 5343 |
<td> </td><td> </td> |
| 5344 |
<?php |
| 5345 |
endif; |
| 5346 |
?> |
| 5347 |
</tr> |
| 5348 |
</tbody> |
| 5349 |
<?php |
| 5350 |
endif; |
| 5351 |
?> |
| 5352 |
</table> |
| 5353 |
</div><!--datatable--> |
| 5354 |
<input name="member_id" type="hidden" id="member_id" value="<?php echo esc_attr( $member_id ); ?>" /> |
| 5355 |
<input name="order_id" type="hidden" id="order_id" value="<?php echo esc_attr( $order_id ); ?>" /> |
| 5356 |
<input name="usces_referer" type="hidden" id="usces_referer" value="<?php echo esc_url( $curent_url ); ?>" /> |
| 5357 |
<?php wp_nonce_field( 'order_edit', 'wc_nonce' ); ?> |
| 5358 |
</div><!--usces_admin--> |
| 5359 |
</div><!--wrap--> |
| 5360 |
<?php |
| 5361 |
$order_action = 'edit'; |
| 5362 |
$cart = array(); |
| 5363 |
$action_args = compact( 'order_action', 'order_id', 'cart' ); |
| 5364 |
$this->settlement_dialog( $order_data, $action_args ); |
| 5365 |
include ABSPATH . 'wp-admin/admin-footer.php'; |
| 5366 |
} |
| 5367 |
|
| 5368 |
/** |
| 5369 |
* 継続課金会員クレジットカード変更依頼メール |
| 5370 |
* dlseller_filter_card_update_mail |
| 5371 |
* |
| 5372 |
* @param string $message Message. |
| 5373 |
* @param int $member_id Member ID. |
| 5374 |
* @param int $order_id Order number. |
| 5375 |
* @return string |
| 5376 |
*/ |
| 5377 |
public function continue_member_card_update_mail( $message, $member_id, $order_id ) { |
| 5378 |
global $usces; |
| 5379 |
|
| 5380 |
$acting_opts = $this->get_acting_settings(); |
| 5381 |
if ( ! usces_is_membersystem_state() || 'on' !== $acting_opts['quickpay'] ) { |
| 5382 |
return $message; |
| 5383 |
} |
| 5384 |
|
| 5385 |
$kaiin_id = $this->get_quick_kaiin_id( $member_id ); |
| 5386 |
$kaiin_pass = $this->get_quick_pass( $member_id ); |
| 5387 |
|
| 5388 |
if ( ! empty( $kaiin_id ) && ! empty( $kaiin_pass ) ) { |
| 5389 |
/* e-SCOTT 会員� |
| 5390 |
�会 */ |
| 5391 |
$response_member = $this->escott_member_reference( $member_id, $kaiin_id, $kaiin_pass ); |
| 5392 |
if ( 'OK' === $response_member['ResponseCd'] ) { |
| 5393 |
$expyy = substr( date_i18n( 'Y', current_time( 'timestamp' ) ), 0, 2 ) . substr( $response_member['CardExp'], 0, 2 ); |
| 5394 |
$expmm = substr( $response_member['CardExp'], 2, 2 ); |
| 5395 |
|
| 5396 |
$now = date_i18n( 'Ym', current_time( 'timestamp', 0 ) ); |
| 5397 |
$member_info = $usces->get_member_info( $member_id ); |
| 5398 |
$mail_data = usces_mail_data(); |
| 5399 |
|
| 5400 |
$nonsessionurl = usces_url( 'cartnonsession', 'return' ); |
| 5401 |
$parts = parse_url( $nonsessionurl ); |
| 5402 |
if ( isset( $parts['query'] ) ) { |
| 5403 |
parse_str( $parts['query'], $query ); |
| 5404 |
} |
| 5405 |
if ( false !== strpos( $nonsessionurl, '/usces-cart' ) ) { |
| 5406 |
$nonsessionurl = str_replace( '/usces-cart', '/usces-member', $nonsessionurl ); |
| 5407 |
} elseif ( isset( $query['page_id'] ) && USCES_CART_NUMBER === $query['page_id'] ) { |
| 5408 |
$nonsessionurl = str_replace( 'page_id=' . USCES_CART_NUMBER, 'page_id=' . USCES_MEMBER_NUMBER, $nonsessionurl ); |
| 5409 |
} |
| 5410 |
$delim = ( false === strpos( $nonsessionurl, '?' ) ) ? '?' : '&'; |
| 5411 |
|
| 5412 |
$regd = $expyy . $expmm; |
| 5413 |
if ( $regd === $now ) { |
| 5414 |
$flag = 'NOW'; |
| 5415 |
} elseif ( $regd < $now ) { |
| 5416 |
$flag = 'PASSED'; |
| 5417 |
} else { |
| 5418 |
return $message; |
| 5419 |
} |
| 5420 |
|
| 5421 |
$exp = mktime( 0, 0, 0, $expmm, 1, $expyy ); |
| 5422 |
$limit = date_i18n( __( 'F, Y' ), $exp ); |
| 5423 |
$name = usces_localized_name( $member_info['mem_name1'], $member_info['mem_name2'], 'return' ); |
| 5424 |
|
| 5425 |
$message = __( 'Member ID', 'dlseller' ) . ' : ' . $member_id . "\n"; |
| 5426 |
$message .= __( 'Contractor name', 'dlseller' ) . ' : ' . sprintf( _x( '%s', 'honorific', 'usces' ), $name ) . "\n\n\n"; |
| 5427 |
$message .= __( 'Thank you very much for using our service.', 'dlseller' ) . "\r\n\r\n"; |
| 5428 |
$message .= __( 'Please be sure to check this notification because it is an important contact for continued use of the service under contract.', 'dlseller' ) . "\r\n\r\n"; |
| 5429 |
$message .= __( '---------------------------------------------------------', 'dlseller' ) . "\r\n"; |
| 5430 |
$message .= sprintf( __( 'Currently registered credit card expiration date is %s, ', 'dlseller' ), $limit ) . "\r\n"; |
| 5431 |
if ( 'NOW' === $flag ) { |
| 5432 |
$message .= __( 'So you keep on this you will not be able to pay next month.', 'dlseller' ) . "\r\n"; |
| 5433 |
} else { |
| 5434 |
$message .= __( 'So your payment of this month is outstanding payment.', 'dlseller' ) . "\r\n"; |
| 5435 |
} |
| 5436 |
$message .= __( '---------------------------------------------------------', 'dlseller' ) . "\r\n\r\n"; |
| 5437 |
$message .= __( 'If you have received a new credit card, ', 'dlseller' ) . "\r\n"; |
| 5438 |
$message .= __( 'Please click the URL below and update the card information during this month.', 'dlseller' ) . "\r\n"; |
| 5439 |
$message .= __( 'Sorry for troubling you, please process it.', 'dlseller' ) . "\r\n\r\n\r\n"; |
| 5440 |
$message .= $nonsessionurl . $delim . 'dlseller_card_update=login&dlseller_up_mode=1&dlseller_order_id=' . $order_id . "\r\n"; |
| 5441 |
$message .= __( 'If the card information update procedure failed, please contact us at the following email address.', 'dlseller' ) . "\r\n\r\n"; |
| 5442 |
$message .= __( 'Thank you.', 'dlseller' ) . "\r\n\r\n\r\n"; |
| 5443 |
$message .= $mail_data['footer']['ordermail']; |
| 5444 |
$message = apply_filters( 'usces_filter_continue_member_card_update_mail', $message, $member_id, $member_info ); |
| 5445 |
if ( function_exists( 'usces_is_html_mail' ) && usces_is_html_mail() ) { |
| 5446 |
$message = do_shortcode( wpautop( $message ) ); |
| 5447 |
} |
| 5448 |
} |
| 5449 |
} |
| 5450 |
return $message; |
| 5451 |
} |
| 5452 |
|
| 5453 |
/** |
| 5454 |
* 自動継続課金処理 |
| 5455 |
* dlseller_action_do_continuation_charging |
| 5456 |
* |
| 5457 |
* @param string $today Today. |
| 5458 |
* @param int $member_id Member ID. |
| 5459 |
* @param int $order_id Order number. |
| 5460 |
* @param array $continue_data Continuation data. |
| 5461 |
*/ |
| 5462 |
public function auto_continuation_charging( $today, $member_id, $order_id, $continue_data ) { |
| 5463 |
global $usces; |
| 5464 |
|
| 5465 |
$acting_opts = $this->get_acting_settings(); |
| 5466 |
if ( ! usces_is_membersystem_state() || 'on' !== $acting_opts['quickpay'] ) { |
| 5467 |
return; |
| 5468 |
} |
| 5469 |
|
| 5470 |
if ( 0 >= $continue_data['price'] ) { |
| 5471 |
return; |
| 5472 |
} |
| 5473 |
|
| 5474 |
$order_data = $usces->get_order_data( $order_id, 'direct' ); |
| 5475 |
if ( ! $order_data || $usces->is_status( 'cancel', $order_data['order_status'] ) ) { |
| 5476 |
return; |
| 5477 |
} |
| 5478 |
|
| 5479 |
$payment = $usces->getPayments( $order_data['order_payment_name'] ); |
| 5480 |
if ( 'acting_welcart_card' !== $payment['settlement'] ) { |
| 5481 |
return; |
| 5482 |
} |
| 5483 |
|
| 5484 |
$kaiin_id = $this->get_quick_kaiin_id( $member_id ); |
| 5485 |
$kaiin_pass = $this->get_quick_pass( $member_id ); |
| 5486 |
$rand = usces_acting_key(); |
| 5487 |
|
| 5488 |
if ( ! empty( $kaiin_id ) && ! empty( $kaiin_pass ) ) { |
| 5489 |
$transaction_date = $this->get_transaction_date(); |
| 5490 |
$param_list = array(); |
| 5491 |
$params_member = array(); |
| 5492 |
$params = array(); |
| 5493 |
|
| 5494 |
/* � |
| 5495 |
�通部 */ |
| 5496 |
$param_list['MerchantId'] = $acting_opts['merchant_id']; |
| 5497 |
$param_list['MerchantPass'] = $acting_opts['merchant_pass']; |
| 5498 |
$param_list['TransactionDate'] = $transaction_date; |
| 5499 |
$param_list['MerchantFree1'] = $rand; |
| 5500 |
$param_list['MerchantFree2'] = $payment['settlement']; |
| 5501 |
$param_list['MerchantFree3'] = $this->merchantfree3; |
| 5502 |
$param_list['TenantId'] = $acting_opts['tenant_id']; |
| 5503 |
$params_member['send_url'] = $acting_opts['send_url_member']; |
| 5504 |
$params_member['param_list'] = array_merge( |
| 5505 |
$param_list, |
| 5506 |
array( |
| 5507 |
'OperateId' => '4MemRefM', |
| 5508 |
'KaiinId' => $kaiin_id, |
| 5509 |
'KaiinPass' => $kaiin_pass, |
| 5510 |
) |
| 5511 |
); |
| 5512 |
/* e-SCOTT 会員� |
| 5513 |
�会 */ |
| 5514 |
$response_member = $this->connection( $params_member ); |
| 5515 |
if ( 'OK' === $response_member['ResponseCd'] ) { |
| 5516 |
$params['send_url'] = $acting_opts['send_url']; |
| 5517 |
$params['param_list'] = array_merge( |
| 5518 |
$param_list, |
| 5519 |
array( |
| 5520 |
'OperateId' => $acting_opts['operateid_dlseller'], |
| 5521 |
'Amount' => usces_crform( $continue_data['price'], false, false, 'return', false ), |
| 5522 |
'PayType' => '01', |
| 5523 |
'KaiinId' => $kaiin_id, |
| 5524 |
'KaiinPass' => $kaiin_pass, |
| 5525 |
) |
| 5526 |
); |
| 5527 |
/* e-SCOTT 決済 */ |
| 5528 |
$response_data = $this->connection( $params ); |
| 5529 |
if ( ! isset( $response_data['Amount'] ) ) { |
| 5530 |
$response_data['Amount'] = $continue_data['price']; |
| 5531 |
} |
| 5532 |
$response_data = apply_filters( 'usces_filter_escott_auto_continuation_charging_history_log', $response_data, $member_id, $order_id, $continue_data ); |
| 5533 |
$this->save_acting_history_log( $response_data, $order_id . '_' . $rand ); |
| 5534 |
if ( 'OK' === $response_data['ResponseCd'] ) { |
| 5535 |
$cardlast4 = substr( $response_member['CardNo'], -4 ); |
| 5536 |
$expyy = substr( date_i18n( 'Y', current_time( 'timestamp' ) ), 0, 2 ) . substr( $response_member['CardExp'], 0, 2 ); |
| 5537 |
$expmm = substr( $response_member['CardExp'], 2, 2 ); |
| 5538 |
$response_data['acting'] = $this->acting_card; |
| 5539 |
$response_data['PayType'] = '01'; |
| 5540 |
$response_data['CardNo'] = $cardlast4; |
| 5541 |
$response_data['CardExp'] = $expyy . '/' . $expmm; |
| 5542 |
$this->save_acting_log( $response_data, $order_id . '_' . $rand ); |
| 5543 |
$this->auto_settlement_mail( $member_id, $order_id, $response_data, $continue_data ); |
| 5544 |
} else { |
| 5545 |
$responsecd = explode( '|', $response_data['ResponseCd'] ); |
| 5546 |
foreach ( (array) $responsecd as $cd ) { |
| 5547 |
$response_data[ $cd ] = $this->response_message( $cd ); |
| 5548 |
} |
| 5549 |
$log = array( |
| 5550 |
'acting' => $this->acting_card, |
| 5551 |
'key' => $rand, |
| 5552 |
'result' => $response_data['ResponseCd'], |
| 5553 |
'data' => $response_data, |
| 5554 |
); |
| 5555 |
usces_save_order_acting_error( $log ); |
| 5556 |
$this->save_acting_log( $response_data, $order_id . '_' . $rand ); |
| 5557 |
$this->auto_settlement_error_mail( $member_id, $order_id, $response_data, $continue_data ); |
| 5558 |
} |
| 5559 |
do_action( 'usces_action_auto_continuation_charging', $member_id, $order_id, $continue_data, $response_data ); |
| 5560 |
} else { |
| 5561 |
if ( ! isset( $response_member['Amount'] ) ) { |
| 5562 |
$response_member['Amount'] = $continue_data['price']; |
| 5563 |
} |
| 5564 |
$response_member = apply_filters( 'usces_filter_escott_auto_continuation_charging_history_log', $response_member, $member_id, $order_id, $continue_data ); |
| 5565 |
$this->save_acting_history_log( $response_member, $order_id . '_' . $rand ); |
| 5566 |
$responsecd = explode( '|', $response_member['ResponseCd'] ); |
| 5567 |
foreach ( (array) $responsecd as $cd ) { |
| 5568 |
$response_member[ $cd ] = $this->response_message( $cd ); |
| 5569 |
} |
| 5570 |
$log = array( |
| 5571 |
'acting' => $this->acting_card . '(member_process)', |
| 5572 |
'key' => $member_id, |
| 5573 |
'result' => $response_member['ResponseCd'], |
| 5574 |
'data' => $response_member, |
| 5575 |
); |
| 5576 |
usces_save_order_acting_error( $log ); |
| 5577 |
$this->save_acting_log( $response_member, $order_id . '_' . $rand ); |
| 5578 |
$this->auto_settlement_error_mail( $member_id, $order_id, $response_member, $continue_data ); |
| 5579 |
do_action( 'usces_action_auto_continuation_charging', $member_id, $order_id, $continue_data, $response_member ); |
| 5580 |
} |
| 5581 |
} else { |
| 5582 |
$logdata = array( |
| 5583 |
'KaiinId' => $kaiin_id, |
| 5584 |
'KaiinPass' => $kaiin_pass, |
| 5585 |
); |
| 5586 |
$log = array( |
| 5587 |
'acting' => $this->acting_card . '(member_process)', |
| 5588 |
'key' => $member_id, |
| 5589 |
'result' => 'MEMBER ERROR', |
| 5590 |
'data' => $logdata, |
| 5591 |
); |
| 5592 |
usces_save_order_acting_error( $log ); |
| 5593 |
$log['ResponseCd'] = 'NG'; |
| 5594 |
$log['MerchantFree1'] = $rand; |
| 5595 |
$this->save_acting_log( $log, $order_id . '_' . $rand ); |
| 5596 |
$this->auto_settlement_error_mail( $member_id, $order_id, $logdata, $continue_data ); |
| 5597 |
do_action( 'usces_action_auto_continuation_charging', $member_id, $order_id, $continue_data, $log ); |
| 5598 |
} |
| 5599 |
} |
| 5600 |
|
| 5601 |
/** |
| 5602 |
* 自動継続課金処理メール(正常) |
| 5603 |
* |
| 5604 |
* @param int $member_id Member ID. |
| 5605 |
* @param int $order_id Order number. |
| 5606 |
* @param array $response_data Response data. |
| 5607 |
* @param array $continue_data Continuation data. |
| 5608 |
*/ |
| 5609 |
public function auto_settlement_mail( $member_id, $order_id, $response_data, $continue_data ) { |
| 5610 |
global $usces; |
| 5611 |
|
| 5612 |
$acting_opts = $this->get_acting_settings(); |
| 5613 |
$order_data = $usces->get_order_data( $order_id, 'direct' ); |
| 5614 |
$mail_body = $this->auto_settlement_message( $member_id, $order_id, $order_data, $response_data, $continue_data, false ); |
| 5615 |
|
| 5616 |
if ( 'on' === $acting_opts['auto_settlement_mail'] ) { |
| 5617 |
$subject = apply_filters( 'usces_filter_escott_auto_settlement_mail_subject', __( 'Announcement of automatic continuing charging process', 'usces' ), $member_id, $order_id, $order_data, $response_data, $continue_data ); |
| 5618 |
$member_info = $usces->get_member_info( $member_id ); |
| 5619 |
$name = usces_localized_name( $member_info['mem_name1'], $member_info['mem_name2'], 'return' ); |
| 5620 |
$mail_data = usces_mail_data(); |
| 5621 |
$mail_header = ''; |
| 5622 |
if ( isset( $usces->options['put_customer_name'] ) && 1 === (int) $usces->options['put_customer_name'] ) { |
| 5623 |
$mail_header .= sprintf( __( 'Dear %s', 'usces' ), $name ) . "\r\n\r\n"; |
| 5624 |
} |
| 5625 |
$mail_header .= __( 'We will report automated accounting process was carried out as follows.', 'usces' ) . "\r\n\r\n"; |
| 5626 |
$mail_footer = __( 'If you have any questions, please contact us.', 'usces' ) . "\r\n\r\n" . $mail_data['footer']['thankyou']; |
| 5627 |
$message = apply_filters( 'usces_filter_escott_auto_settlement_mail_header', $mail_header, $member_id, $order_id, $order_data, $response_data, $continue_data ) . |
| 5628 |
apply_filters( 'usces_filter_escott_auto_settlement_mail_body', $mail_body, $member_id, $order_id, $order_data, $response_data, $continue_data ) . |
| 5629 |
apply_filters( 'usces_filter_escott_auto_settlement_mail_footer', $mail_footer, $member_id, $order_id, $order_data, $response_data, $continue_data ); |
| 5630 |
$headers = apply_filters( 'usces_filter_escott_auto_settlement_mail_headers', '' ); |
| 5631 |
$to_customer = array( |
| 5632 |
'to_name' => sprintf( _x( '%s', 'honorific', 'usces' ), $name ), |
| 5633 |
'to_address' => $member_info['mem_email'], |
| 5634 |
'from_name' => get_option( 'blogname' ), |
| 5635 |
'from_address' => $usces->options['sender_mail'], |
| 5636 |
'reply_name' => get_option( 'blogname' ), |
| 5637 |
'reply_to' => usces_get_first_order_mail(), |
| 5638 |
'return_path' => $usces->options['sender_mail'], |
| 5639 |
'subject' => $subject, |
| 5640 |
'message' => do_shortcode( $message ), |
| 5641 |
'headers' => $headers, |
| 5642 |
); |
| 5643 |
usces_send_mail( $to_customer ); |
| 5644 |
} |
| 5645 |
|
| 5646 |
$ok = ( empty( $this->continuation_charging_mail['OK'] ) ) ? 0 : $this->continuation_charging_mail['OK']; |
| 5647 |
$this->continuation_charging_mail['OK'] = $ok + 1; |
| 5648 |
$this->continuation_charging_mail['mail'][] = $mail_body; |
| 5649 |
} |
| 5650 |
|
| 5651 |
/** |
| 5652 |
* 自動継続課金処理メール(エラー) |
| 5653 |
* |
| 5654 |
* @param int $member_id Member ID. |
| 5655 |
* @param int $order_id Order number. |
| 5656 |
* @param array $response_data Response data. |
| 5657 |
* @param array $continue_data Continuation data. |
| 5658 |
*/ |
| 5659 |
public function auto_settlement_error_mail( $member_id, $order_id, $response_data, $continue_data ) { |
| 5660 |
global $usces; |
| 5661 |
|
| 5662 |
$acting_opts = $this->get_acting_settings(); |
| 5663 |
$order_data = $usces->get_order_data( $order_id, 'direct' ); |
| 5664 |
$mail_body = $this->auto_settlement_message( $member_id, $order_id, $order_data, $response_data, $continue_data, false ); |
| 5665 |
|
| 5666 |
if ( 'on' === $acting_opts['auto_settlement_mail'] ) { |
| 5667 |
$subject = apply_filters( 'usces_filter_escott_auto_settlement_error_mail_subject', __( 'Announcement of automatic continuing charging process', 'usces' ), $member_id, $order_id, $order_data, $response_data, $continue_data ); |
| 5668 |
$member_info = $usces->get_member_info( $member_id ); |
| 5669 |
$name = usces_localized_name( $member_info['mem_name1'], $member_info['mem_name2'], 'return' ); |
| 5670 |
$mail_data = usces_mail_data(); |
| 5671 |
$mail_header = ''; |
| 5672 |
if ( isset( $usces->options['put_customer_name'] ) && 1 === (int) $usces->options['put_customer_name'] ) { |
| 5673 |
$mail_header .= sprintf( __( 'Dear %s', 'usces' ), $name ) . "\r\n\r\n"; |
| 5674 |
} |
| 5675 |
$mail_header .= __( 'We will reported that an error occurred in automated accounting process.', 'usces' ) . "\r\n\r\n"; |
| 5676 |
$mail_footer = __( 'If you have any questions, please contact us.', 'usces' ) . "\r\n\r\n" . $mail_data['footer']['thankyou']; |
| 5677 |
$message = apply_filters( 'usces_filter_escott_auto_settlement_error_mail_header', $mail_header, $member_id, $order_id, $order_data, $response_data, $continue_data ) . |
| 5678 |
apply_filters( 'usces_filter_escott_auto_settlement_error_mail_body', $mail_body, $member_id, $order_id, $order_data, $response_data, $continue_data ) . |
| 5679 |
apply_filters( 'usces_filter_escott_auto_settlement_error_mail_footer', $mail_footer, $member_id, $order_id, $order_data, $response_data, $continue_data ); |
| 5680 |
$headers = apply_filters( 'usces_filter_escott_auto_settlement_error_mail_headers', '' ); |
| 5681 |
$to_customer = array( |
| 5682 |
'to_name' => sprintf( _x( '%s', 'honorific', 'usces' ), $name ), |
| 5683 |
'to_address' => $member_info['mem_email'], |
| 5684 |
'from_name' => get_option( 'blogname' ), |
| 5685 |
'from_address' => $usces->options['sender_mail'], |
| 5686 |
'reply_name' => get_option( 'blogname' ), |
| 5687 |
'reply_to' => usces_get_first_order_mail(), |
| 5688 |
'return_path' => $usces->options['sender_mail'], |
| 5689 |
'subject' => $subject, |
| 5690 |
'message' => do_shortcode( $message ), |
| 5691 |
'headers' => $headers, |
| 5692 |
); |
| 5693 |
usces_send_mail( $to_customer ); |
| 5694 |
} |
| 5695 |
|
| 5696 |
$error = ( empty( $this->continuation_charging_mail['NG'] ) ) ? 0 : $this->continuation_charging_mail['NG']; |
| 5697 |
$this->continuation_charging_mail['NG'] = $error + 1; |
| 5698 |
$this->continuation_charging_mail['mail'][] = $mail_body; |
| 5699 |
} |
| 5700 |
|
| 5701 |
/** |
| 5702 |
* 自動継続課金処理メール本文 |
| 5703 |
* |
| 5704 |
* @param int $member_id Member ID. |
| 5705 |
* @param int $order_id Order number. |
| 5706 |
* @param array $order_data Order data. |
| 5707 |
* @param array $response_data Response data. |
| 5708 |
* @param array $continue_data Continuation data. |
| 5709 |
* @param boolean $html HTML Mail. |
| 5710 |
* @return string |
| 5711 |
*/ |
| 5712 |
public function auto_settlement_message( $member_id, $order_id, $order_data, $response_data, $continue_data, $html = true ) { |
| 5713 |
global $usces; |
| 5714 |
|
| 5715 |
if ( usces_is_html_mail() && $html ) { |
| 5716 |
$message = $this->auto_settlement_message_htmlbody( $member_id, $order_id, $order_data, $response_data, $continue_data ); |
| 5717 |
} else { |
| 5718 |
$member_info = $usces->get_member_info( $member_id ); |
| 5719 |
$name = usces_localized_name( $member_info['mem_name1'], $member_info['mem_name2'], 'return' ); |
| 5720 |
$contracted_date = ( isset( $continue_data['contractedday'] ) ) ? $continue_data['contractedday'] : ''; |
| 5721 |
$charged_date = ( isset( $continue_data['chargedday'] ) ) ? $continue_data['chargedday'] : ''; |
| 5722 |
|
| 5723 |
$message = usces_mail_line( 2 ); |
| 5724 |
$message .= __( 'Order ID', 'dlseller' ) . ' : ' . $order_id . "\r\n"; |
| 5725 |
$message .= __( 'Application Date', 'dlseller' ) . ' : ' . $order_data['order_date'] . "\r\n"; |
| 5726 |
$message .= __( 'Member ID', 'dlseller' ) . ' : ' . $member_id . "\r\n"; |
| 5727 |
$message .= __( 'Contractor name', 'dlseller' ) . ' : ' . sprintf( _x( '%s', 'honorific', 'usces' ), $name ) . "\r\n"; |
| 5728 |
|
| 5729 |
$cart = usces_get_ordercartdata( $order_id ); |
| 5730 |
$cart_row = current( $cart ); |
| 5731 |
$item_name = $usces->getCartItemName_byOrder( $cart_row ); |
| 5732 |
$options = ( empty( $cart_row['options'] ) ) ? array() : $cart_row['options']; |
| 5733 |
$message .= __( 'Items', 'usces' ) . ' : ' . $item_name . "\r\n"; |
| 5734 |
if ( is_array( $options ) && count( $options ) > 0 ) { |
| 5735 |
$optstr = ''; |
| 5736 |
foreach ( $options as $key => $value ) { |
| 5737 |
if ( ! empty( $key ) ) { |
| 5738 |
$key = urldecode( $key ); |
| 5739 |
$value = maybe_unserialize( $value ); |
| 5740 |
if ( is_array( $value ) ) { |
| 5741 |
$c = ''; |
| 5742 |
$optstr .= '( ' . $key . ' : '; |
| 5743 |
foreach ( $value as $v ) { |
| 5744 |
$optstr .= $c . rawurldecode( $v ); |
| 5745 |
$c = ', '; |
| 5746 |
} |
| 5747 |
$optstr .= " )\r\n"; |
| 5748 |
} else { |
| 5749 |
$optstr .= '( ' . $key . ' : ' . rawurldecode( $value ) . " )\r\n"; |
| 5750 |
} |
| 5751 |
} |
| 5752 |
} |
| 5753 |
$message .= $optstr; |
| 5754 |
} |
| 5755 |
|
| 5756 |
$message .= __( 'Settlement amount', 'usces' ) . ' : ' . usces_crform( $continue_data['price'], true, false, 'return' ) . "\r\n"; |
| 5757 |
if ( isset( $response_data['reminder'] ) ) { |
| 5758 |
if ( ! empty( $charged_date ) ) { |
| 5759 |
$message .= __( 'Next Withdrawal Date', 'dlseller' ) . ' : ' . $charged_date . "\r\n"; |
| 5760 |
} |
| 5761 |
if ( ! empty( $contracted_date ) ) { |
| 5762 |
$message .= __( 'Renewal Date', 'dlseller' ) . ' : ' . $contracted_date . "\r\n"; |
| 5763 |
} |
| 5764 |
} else { |
| 5765 |
if ( isset( $response_data['MerchantFree1'] ) ) { |
| 5766 |
$message .= __( 'Transaction ID', 'usces' ) . ' : ' . $response_data['MerchantFree1'] . "\r\n"; |
| 5767 |
} |
| 5768 |
if ( isset( $response_data['TransactionId'] ) ) { |
| 5769 |
$message .= __( 'Sequence number', 'usces' ) . ' : ' . $response_data['TransactionId'] . "\r\n"; |
| 5770 |
} |
| 5771 |
if ( ! empty( $charged_date ) ) { |
| 5772 |
$message .= __( 'Next Withdrawal Date', 'dlseller' ) . ' : ' . $charged_date . "\r\n"; |
| 5773 |
} |
| 5774 |
if ( ! empty( $contracted_date ) ) { |
| 5775 |
$message .= __( 'Renewal Date', 'dlseller' ) . ' : ' . $contracted_date . "\r\n"; |
| 5776 |
} |
| 5777 |
$message .= "\r\n"; |
| 5778 |
if ( isset( $response_data['ResponseCd'] ) ) { |
| 5779 |
if ( 'OK' === $response_data['ResponseCd'] ) { |
| 5780 |
$message .= __( 'Result', 'usces' ) . ' : ' . __( 'Normal done', 'usces' ) . "\r\n"; |
| 5781 |
} else { |
| 5782 |
$message .= __( 'Result', 'usces' ) . ' : ' . __( 'Error', 'usces' ) . "\r\n"; |
| 5783 |
$responsecd = explode( '|', $response_data['ResponseCd'] ); |
| 5784 |
foreach ( (array) $responsecd as $cd ) { |
| 5785 |
$message .= $cd . ' : ' . $this->response_message( $cd ) . "\r\n"; |
| 5786 |
} |
| 5787 |
} |
| 5788 |
} else { |
| 5789 |
$message .= __( 'Result', 'usces' ) . ' : ' . __( 'Error', 'usces' ) . "\r\n"; |
| 5790 |
$message .= __( 'Credit card is not registered.', 'usces' ) . "\r\n"; |
| 5791 |
} |
| 5792 |
} |
| 5793 |
$message .= usces_mail_line( 2 ) . "\r\n"; |
| 5794 |
} |
| 5795 |
return $message; |
| 5796 |
} |
| 5797 |
|
| 5798 |
/** |
| 5799 |
* Automatic renewal billing process email body html |
| 5800 |
* |
| 5801 |
* @param int $member_id Member ID. |
| 5802 |
* @param int $order_id Order number. |
| 5803 |
* @param array $order_data Order data. |
| 5804 |
* @param array $response_data Response data. |
| 5805 |
* @param array $continue_data Continuation data. |
| 5806 |
* @return string |
| 5807 |
*/ |
| 5808 |
public function auto_settlement_message_htmlbody( $member_id, $order_id, $order_data, $response_data, $continue_data ) { |
| 5809 |
global $usces; |
| 5810 |
|
| 5811 |
$member_info = $usces->get_member_info( $member_id ); |
| 5812 |
$name = usces_localized_name( $member_info['mem_name1'], $member_info['mem_name2'], 'return' ); |
| 5813 |
$contracted_date = ( isset( $continue_data['contractedday'] ) ) ? $continue_data['contractedday'] : ''; |
| 5814 |
$charged_date = ( isset( $continue_data['chargedday'] ) ) ? $continue_data['chargedday'] : ''; |
| 5815 |
|
| 5816 |
$message = '<table style="font-size: 14px; margin-bottom: 30px; width: 100%; border-collapse: collapse; border: 1px solid #ddd;"><tbody>'; |
| 5817 |
$message .= '<tr><td style="background-color: #f9f9f9; padding: 12px; width: 33%; border: 1px solid #ddd; text-align: left;">'; |
| 5818 |
$message .= __( 'Order ID', 'dlseller' ); |
| 5819 |
$message .= '</td><td style="padding: 12px; width: 67%; border: 1px solid #ddd;">'; |
| 5820 |
$message .= $order_id; |
| 5821 |
$message .= '</td></tr>'; |
| 5822 |
|
| 5823 |
$message .= '<tr><td style="background-color: #f9f9f9; padding: 12px; width: 33%; border: 1px solid #ddd; text-align: left;">'; |
| 5824 |
$message .= __( 'Application Date', 'dlseller' ); |
| 5825 |
$message .= '</td><td style="padding: 12px; width: 67%; border: 1px solid #ddd;">'; |
| 5826 |
$message .= $order_data['order_date']; |
| 5827 |
$message .= '</td></tr>'; |
| 5828 |
|
| 5829 |
$message .= '<tr><td style="background-color: #f9f9f9; padding: 12px; width: 33%; border: 1px solid #ddd; text-align: left;">'; |
| 5830 |
$message .= __( 'Member ID', 'dlseller' ); |
| 5831 |
$message .= '</td><td style="padding: 12px; width: 67%; border: 1px solid #ddd;">'; |
| 5832 |
$message .= $member_id; |
| 5833 |
$message .= '</td></tr>'; |
| 5834 |
|
| 5835 |
$message .= '<tr><td style="background-color: #f9f9f9; padding: 12px; width: 33%; border: 1px solid #ddd; text-align: left;">'; |
| 5836 |
$message .= __( 'Contractor name', 'dlseller' ); |
| 5837 |
$message .= '</td><td style="padding: 12px; width: 67%; border: 1px solid #ddd;">'; |
| 5838 |
$message .= sprintf( _x( '%s', 'honorific', 'usces' ), $name ); |
| 5839 |
$message .= '</td></tr>'; |
| 5840 |
|
| 5841 |
$cart = usces_get_ordercartdata( $order_id ); |
| 5842 |
$cart_row = current( $cart ); |
| 5843 |
$item_name = $usces->getCartItemName_byOrder( $cart_row ); |
| 5844 |
$options = ( empty( $cart_row['options'] ) ) ? array() : $cart_row['options']; |
| 5845 |
$message .= '<tr><td style="background-color: #f9f9f9; padding: 12px; width: 33%; border: 1px solid #ddd; text-align: left;">'; |
| 5846 |
$message .= __( 'Items', 'usces' ); |
| 5847 |
$message .= '</td><td style="padding: 12px; width: 67%; border: 1px solid #ddd;">'; |
| 5848 |
$message .= $item_name; |
| 5849 |
if ( is_array( $options ) && count( $options ) > 0 ) { |
| 5850 |
$optstr = ''; |
| 5851 |
foreach ( $options as $key => $value ) { |
| 5852 |
if ( ! empty( $key ) ) { |
| 5853 |
$key = urldecode( $key ); |
| 5854 |
$value = maybe_unserialize( $value ); |
| 5855 |
if ( is_array( $value ) ) { |
| 5856 |
$c = ''; |
| 5857 |
$optstr .= '( ' . $key . ' : '; |
| 5858 |
foreach ( $value as $v ) { |
| 5859 |
$optstr .= $c . rawurldecode( $v ); |
| 5860 |
$c = ', '; |
| 5861 |
} |
| 5862 |
$optstr .= ' )<br>'; |
| 5863 |
} else { |
| 5864 |
$optstr .= '( ' . $key . ' : ' . rawurldecode( $value ) . ' )<br>'; |
| 5865 |
} |
| 5866 |
} |
| 5867 |
} |
| 5868 |
$message .= $optstr; |
| 5869 |
} |
| 5870 |
$message .= '</td></tr>'; |
| 5871 |
|
| 5872 |
$message .= '<tr><td style="background-color: #f9f9f9; padding: 12px; width: 33%; border: 1px solid #ddd; text-align: left;">'; |
| 5873 |
$message .= __( 'Settlement amount', 'usces' ); |
| 5874 |
$message .= '</td><td style="padding: 12px; width: 67%; border: 1px solid #ddd;">'; |
| 5875 |
$message .= usces_crform( $continue_data['price'], true, false, 'return' ); |
| 5876 |
$message .= '</td></tr>'; |
| 5877 |
if ( isset( $response_data['reminder'] ) ) { |
| 5878 |
if ( ! empty( $charged_date ) ) { |
| 5879 |
$message .= '<tr><td style="background-color: #f9f9f9; padding: 12px; width: 33%; border: 1px solid #ddd; text-align: left;">'; |
| 5880 |
$message .= __( 'Next Withdrawal Date', 'dlseller' ); |
| 5881 |
$message .= '</td><td style="padding: 12px; width: 67%; border: 1px solid #ddd;">'; |
| 5882 |
$message .= $charged_date; |
| 5883 |
$message .= '</td></tr>'; |
| 5884 |
} |
| 5885 |
if ( ! empty( $contracted_date ) ) { |
| 5886 |
$message .= '<tr><td style="background-color: #f9f9f9; padding: 12px; width: 33%; border: 1px solid #ddd; text-align: left;">'; |
| 5887 |
$message .= __( 'Renewal Date', 'dlseller' ); |
| 5888 |
$message .= '</td><td style="padding: 12px; width: 67%; border: 1px solid #ddd;">'; |
| 5889 |
$message .= $contracted_date; |
| 5890 |
$message .= '</td></tr>'; |
| 5891 |
} |
| 5892 |
} else { |
| 5893 |
if ( isset( $response_data['MerchantFree1'] ) ) { |
| 5894 |
$message .= '<tr><td style="background-color: #f9f9f9; padding: 12px; width: 33%; border: 1px solid #ddd; text-align: left;">'; |
| 5895 |
$message .= __( 'Transaction ID', 'usces' ); |
| 5896 |
$message .= '</td><td style="padding: 12px; width: 67%; border: 1px solid #ddd;">'; |
| 5897 |
$message .= $response_data['MerchantFree1']; |
| 5898 |
$message .= '</td></tr>'; |
| 5899 |
} |
| 5900 |
if ( isset( $response_data['TransactionId'] ) ) { |
| 5901 |
$message .= '<tr><td style="background-color: #f9f9f9; padding: 12px; width: 33%; border: 1px solid #ddd; text-align: left;">'; |
| 5902 |
$message .= __( 'Sequence number', 'usces' ); |
| 5903 |
$message .= '</td><td style="padding: 12px; width: 67%; border: 1px solid #ddd;">'; |
| 5904 |
$message .= $response_data['TransactionId']; |
| 5905 |
$message .= '</td></tr>'; |
| 5906 |
} |
| 5907 |
if ( ! empty( $charged_date ) ) { |
| 5908 |
$message .= '<tr><td style="background-color: #f9f9f9; padding: 12px; width: 33%; border: 1px solid #ddd; text-align: left;">'; |
| 5909 |
$message .= __( 'Next Withdrawal Date', 'dlseller' ); |
| 5910 |
$message .= '</td><td style="padding: 12px; width: 67%; border: 1px solid #ddd;">'; |
| 5911 |
$message .= $charged_date; |
| 5912 |
$message .= '</td></tr>'; |
| 5913 |
} |
| 5914 |
if ( ! empty( $contracted_date ) ) { |
| 5915 |
$message .= '<tr><td style="background-color: #f9f9f9; padding: 12px; width: 33%; border: 1px solid #ddd; text-align: left;">'; |
| 5916 |
$message .= __( 'Renewal Date', 'dlseller' ); |
| 5917 |
$message .= '</td><td style="padding: 12px; width: 67%; border: 1px solid #ddd;">'; |
| 5918 |
$message .= $contracted_date; |
| 5919 |
$message .= '</td></tr>'; |
| 5920 |
} |
| 5921 |
if ( isset( $response_data['ResponseCd'] ) ) { |
| 5922 |
if ( 'OK' === $response_data['ResponseCd'] ) { |
| 5923 |
$message .= '<tr><td style="background-color: #f9f9f9; padding: 12px; width: 33%; border: 1px solid #ddd; text-align: left;">'; |
| 5924 |
$message .= __( 'Result', 'usces' ); |
| 5925 |
$message .= '</td><td style="padding: 12px; width: 67%; border: 1px solid #ddd;">'; |
| 5926 |
$message .= __( 'Normal done', 'usces' ); |
| 5927 |
$message .= '</td></tr>'; |
| 5928 |
} else { |
| 5929 |
$message .= '<tr><td style="background-color: #f9f9f9; padding: 12px; width: 33%; border: 1px solid #ddd; text-align: left;">'; |
| 5930 |
$message .= __( 'Result', 'usces' ); |
| 5931 |
$message .= '</td><td style="padding: 12px; width: 67%; border: 1px solid #ddd;">'; |
| 5932 |
$message .= __( 'Error', 'usces' ); |
| 5933 |
$responsecd = explode( '|', $response_data['ResponseCd'] ); |
| 5934 |
foreach ( (array) $responsecd as $cd ) { |
| 5935 |
$message .= $cd . ' : ' . $this->response_message( $cd ) . '<br>'; |
| 5936 |
} |
| 5937 |
$message .= '</td></tr>'; |
| 5938 |
} |
| 5939 |
} else { |
| 5940 |
$message .= '<tr><td style="background-color: #f9f9f9; padding: 12px; width: 33%; border: 1px solid #ddd; text-align: left;">'; |
| 5941 |
$message .= __( 'Result', 'usces' ); |
| 5942 |
$message .= '</td><td style="padding: 12px; width: 67%; border: 1px solid #ddd;">'; |
| 5943 |
$message .= __( 'Error', 'usces' ) . '<br>'; |
| 5944 |
$message .= __( 'Credit card is not registered.', 'usces' ); |
| 5945 |
$message .= '</td></tr>'; |
| 5946 |
} |
| 5947 |
} |
| 5948 |
$message .= '</tbody></table>'; |
| 5949 |
return $message; |
| 5950 |
} |
| 5951 |
|
| 5952 |
/** |
| 5953 |
* 自動継続課金処理 |
| 5954 |
* dlseller_action_do_continuation |
| 5955 |
* |
| 5956 |
* @param string $today Today. |
| 5957 |
* @param array $todays_charging Charged data. |
| 5958 |
*/ |
| 5959 |
public function do_auto_continuation( $today, $todays_charging ) { |
| 5960 |
global $usces; |
| 5961 |
|
| 5962 |
if ( empty( $todays_charging ) ) { |
| 5963 |
return; |
| 5964 |
} |
| 5965 |
|
| 5966 |
$ok = ( empty( $this->continuation_charging_mail['OK'] ) ) ? 0 : $this->continuation_charging_mail['OK']; |
| 5967 |
$error = ( empty( $this->continuation_charging_mail['NG'] ) ) ? 0 : $this->continuation_charging_mail['NG']; |
| 5968 |
$admin_subject = apply_filters( 'usces_filter_escott_auto_settlement_mail_admin_subject', __( 'Automatic Continuing Charging Process Result', 'usces' ) . ' ' . $today, $today ); |
| 5969 |
$admin_footer = apply_filters( 'usces_filter_escott_auto_settlement_mail_admin_mail_footer', __( 'For details, please check on the administration panel > Continuous charge member list > Continuous charge member information.', 'usces' ) ); |
| 5970 |
$admin_message = __( 'Report that automated accounting process has been completed.', 'usces' ) . "\r\n\r\n" |
| 5971 |
. __( 'Processing date', 'usces' ) . ' : ' . date_i18n( 'Y-m-d H:i:s', current_time( 'timestamp' ) ) . "\r\n" |
| 5972 |
. __( 'Normal done', 'usces' ) . ' : ' . $ok . "\r\n" |
| 5973 |
. __( 'Abnormal done', 'usces' ) . ' : ' . $error . "\r\n\r\n"; |
| 5974 |
foreach ( (array) $this->continuation_charging_mail['mail'] as $mail ) { |
| 5975 |
$admin_message .= $mail . "\r\n"; |
| 5976 |
} |
| 5977 |
$admin_message .= $admin_footer . "\r\n"; |
| 5978 |
|
| 5979 |
$to_admin = array( |
| 5980 |
'to_name' => apply_filters( 'usces_filter_bccmail_to_admin_name', 'Shop Admin' ), |
| 5981 |
'to_address' => $usces->options['order_mail'], |
| 5982 |
'from_name' => apply_filters( 'usces_filter_bccmail_from_admin_name', 'Welcart Auto BCC' ), |
| 5983 |
'from_address' => $usces->options['sender_mail'], |
| 5984 |
'reply_name' => get_option( 'blogname' ), |
| 5985 |
'reply_to' => usces_get_first_order_mail(), |
| 5986 |
'return_path' => $usces->options['sender_mail'], |
| 5987 |
'subject' => $admin_subject, |
| 5988 |
'message' => do_shortcode( $admin_message ), |
| 5989 |
); |
| 5990 |
usces_send_mail( $to_admin ); |
| 5991 |
unset( $this->continuation_charging_mail ); |
| 5992 |
} |
| 5993 |
|
| 5994 |
/** |
| 5995 |
* 課金日通知メール |
| 5996 |
* dlseller_filter_reminder_mail_body |
| 5997 |
* |
| 5998 |
* @param string $mail_body Message body. |
| 5999 |
* @param int $order_id Order number. |
| 6000 |
* @param array $continue_data Continuation data. |
| 6001 |
*/ |
| 6002 |
public function reminder_mail_body( $mail_body, $order_id, $continue_data ) { |
| 6003 |
global $usces; |
| 6004 |
|
| 6005 |
$member_id = $continue_data['member_id']; |
| 6006 |
$order_id = $continue_data['order_id']; |
| 6007 |
$order_data = $usces->get_order_data( $order_id, 'direct' ); |
| 6008 |
$response_data = array( 'reminder' => 'reminder' ); |
| 6009 |
$mail_body = $this->auto_settlement_message( $member_id, $order_id, $order_data, $response_data, $continue_data ); |
| 6010 |
return $mail_body; |
| 6011 |
} |
| 6012 |
|
| 6013 |
/** |
| 6014 |
* 契約更新日通知メール |
| 6015 |
* dlseller_filter_contract_renewal_mail_body |
| 6016 |
* |
| 6017 |
* @param string $mail_body Message body. |
| 6018 |
* @param int $order_id Order number. |
| 6019 |
* @param array $continue_data Continuation data. |
| 6020 |
*/ |
| 6021 |
public function contract_renewal_mail_body( $mail_body, $order_id, $continue_data ) { |
| 6022 |
global $usces; |
| 6023 |
|
| 6024 |
$member_id = $continue_data['member_id']; |
| 6025 |
$order_data = $usces->get_order_data( $order_id, 'direct' ); |
| 6026 |
$response_data = array( 'reminder' => 'contract_renewal' ); |
| 6027 |
$mail_body = $this->auto_settlement_message( $member_id, $order_id, $order_data, $response_data, $continue_data ); |
| 6028 |
return $mail_body; |
| 6029 |
} |
| 6030 |
|
| 6031 |
/** |
| 6032 |
* 利用可能な支払方法 |
| 6033 |
* wcad_filter_available_regular_payment_method |
| 6034 |
* |
| 6035 |
* @param array $payment_method Payment method. |
| 6036 |
* @return array |
| 6037 |
*/ |
| 6038 |
public function available_regular_payment_method( $payment_method ) { |
| 6039 |
$acting_opts = $this->get_acting_settings(); |
| 6040 |
if ( isset( $acting_opts['quickpay'] ) && 'on' === $acting_opts['quickpay'] ) { |
| 6041 |
$payment_method[] = 'acting_welcart_card'; |
| 6042 |
} |
| 6043 |
return $payment_method; |
| 6044 |
} |
| 6045 |
|
| 6046 |
/** |
| 6047 |
* 発送� |
| 6048 |
�リスト利用可能決済 |
| 6049 |
* wcad_filter_shippinglist_acting |
| 6050 |
* |
| 6051 |
* @param string $acting Payment method. |
| 6052 |
* @return string |
| 6053 |
*/ |
| 6054 |
public function set_shippinglist_acting( $acting ) { |
| 6055 |
$acting = 'acting_welcart_card'; |
| 6056 |
return $acting; |
| 6057 |
} |
| 6058 |
|
| 6059 |
/** |
| 6060 |
* 定期購� |
| 6061 |
�決済処理 |
| 6062 |
* wcad_action_reg_auto_orderdata |
| 6063 |
* |
| 6064 |
* @param array $args Compact array( $cart, $entry, $order_id, $member_id, $payments, $charging_type, $total_amount, $reg_id, $order_date ). |
| 6065 |
*/ |
| 6066 |
public function register_auto_orderdata( $args ) { |
| 6067 |
global $usces; |
| 6068 |
extract( $args ); // phpcs:ignore |
| 6069 |
|
| 6070 |
$acting_opts = $this->get_acting_settings(); |
| 6071 |
if ( ! usces_is_membersystem_state() || 'on' !== $acting_opts['quickpay'] ) { |
| 6072 |
return; |
| 6073 |
} |
| 6074 |
|
| 6075 |
if ( 0 >= $total_amount ) { |
| 6076 |
return; |
| 6077 |
} |
| 6078 |
|
| 6079 |
$acting_flg = $payments['settlement']; |
| 6080 |
if ( 'acting_welcart_card' !== $payments['settlement'] ) { |
| 6081 |
return; |
| 6082 |
} |
| 6083 |
|
| 6084 |
$settltment_errmsg = ''; |
| 6085 |
$kaiin_id = $this->get_quick_kaiin_id( $member_id ); |
| 6086 |
$kaiin_pass = $this->get_quick_pass( $member_id ); |
| 6087 |
$rand = usces_acting_key(); |
| 6088 |
|
| 6089 |
if ( ! empty( $kaiin_id ) && ! empty( $kaiin_pass ) ) { |
| 6090 |
$transaction_date = $this->get_transaction_date(); |
| 6091 |
$param_list = array(); |
| 6092 |
$params_member = array(); |
| 6093 |
$params = array(); |
| 6094 |
|
| 6095 |
/* � |
| 6096 |
�通部 */ |
| 6097 |
$param_list['MerchantId'] = $acting_opts['merchant_id']; |
| 6098 |
$param_list['MerchantPass'] = $acting_opts['merchant_pass']; |
| 6099 |
$param_list['TransactionDate'] = $transaction_date; |
| 6100 |
$param_list['MerchantFree1'] = $rand; |
| 6101 |
$param_list['MerchantFree2'] = 'acting_welcart_card'; |
| 6102 |
$param_list['MerchantFree3'] = $this->merchantfree3; |
| 6103 |
$param_list['TenantId'] = $acting_opts['tenant_id']; |
| 6104 |
$params_member['send_url'] = $acting_opts['send_url_member']; |
| 6105 |
$params_member['param_list'] = array_merge( |
| 6106 |
$param_list, |
| 6107 |
array( |
| 6108 |
'OperateId' => '4MemRefM', |
| 6109 |
'KaiinId' => $kaiin_id, |
| 6110 |
'KaiinPass' => $kaiin_pass, |
| 6111 |
) |
| 6112 |
); |
| 6113 |
/* e-SCOTT 会員� |
| 6114 |
�会 */ |
| 6115 |
$response_member = $this->connection( $params_member ); |
| 6116 |
if ( 'OK' === $response_member['ResponseCd'] ) { |
| 6117 |
$params['send_url'] = $acting_opts['send_url']; |
| 6118 |
$params['param_list'] = array_merge( |
| 6119 |
$param_list, |
| 6120 |
array( |
| 6121 |
'OperateId' => $acting_opts['operateid'], |
| 6122 |
'Amount' => $total_amount, |
| 6123 |
'PayType' => '01', |
| 6124 |
'KaiinId' => $kaiin_id, |
| 6125 |
'KaiinPass' => $kaiin_pass, |
| 6126 |
) |
| 6127 |
); |
| 6128 |
/* e-SCOTT 決済 */ |
| 6129 |
$response_data = $this->connection( $params ); |
| 6130 |
if ( ! isset( $response_data['Amount'] ) ) { |
| 6131 |
$response_data['Amount'] = $total_amount; |
| 6132 |
} |
| 6133 |
$response_data = apply_filters( 'usces_filter_escott_auto_register_orderdata_history_log', $response_data, $member_id, $order_id ); |
| 6134 |
$this->save_acting_history_log( $response_data, $order_id . '_' . $rand ); |
| 6135 |
if ( 'OK' === $response_data['ResponseCd'] ) { |
| 6136 |
$usces->set_order_meta_value( 'trans_id', $rand, $order_id ); |
| 6137 |
$usces->set_order_meta_value( 'wc_trans_id', $rand, $order_id ); |
| 6138 |
$cardlast4 = substr( $response_member['CardNo'], -4 ); |
| 6139 |
$expyy = substr( date_i18n( 'Y', current_time( 'timestamp' ) ), 0, 2 ) . substr( $response_member['CardExp'], 0, 2 ); |
| 6140 |
$expmm = substr( $response_member['CardExp'], 2, 2 ); |
| 6141 |
$response_data['acting'] = $this->acting_card; |
| 6142 |
$response_data['PayType'] = '01'; |
| 6143 |
$response_data['CardNo'] = $cardlast4; |
| 6144 |
$response_data['CardExp'] = $expyy . '/' . $expmm; |
| 6145 |
$usces->set_order_meta_value( $acting_flg, usces_serialize( $response_data ), $order_id ); |
| 6146 |
} else { |
| 6147 |
$settltment_errmsg = __( '[Regular purchase] Settlement was not completed.', 'autodelivery' ); |
| 6148 |
$responsecd = explode( '|', $response_data['ResponseCd'] ); |
| 6149 |
foreach ( (array) $responsecd as $cd ) { |
| 6150 |
$response_data[ $cd ] = $this->response_message( $cd ); |
| 6151 |
} |
| 6152 |
$log = array( |
| 6153 |
'acting' => $this->acting_card, |
| 6154 |
'key' => $rand, |
| 6155 |
'result' => $response_data['ResponseCd'], |
| 6156 |
'data' => $response_data, |
| 6157 |
); |
| 6158 |
usces_save_order_acting_error( $log ); |
| 6159 |
} |
| 6160 |
do_action( 'usces_action_register_auto_orderdata', $args, $response_data ); |
| 6161 |
} else { |
| 6162 |
if ( ! isset( $response_member['Amount'] ) ) { |
| 6163 |
$response_member['Amount'] = $total_amount; |
| 6164 |
} |
| 6165 |
$response_member = apply_filters( 'usces_filter_escott_auto_register_orderdata_history_log', $response_member, $member_id, $order_id ); |
| 6166 |
$this->save_acting_history_log( $response_member, $order_id . '_' . $rand ); |
| 6167 |
$settltment_errmsg = __( '[Regular purchase] Member information acquisition error.', 'autodelivery' ); |
| 6168 |
$responsecd = explode( '|', $response_member['ResponseCd'] ); |
| 6169 |
foreach ( (array) $responsecd as $cd ) { |
| 6170 |
$response_member[ $cd ] = $this->response_message( $cd ); |
| 6171 |
} |
| 6172 |
$log = array( |
| 6173 |
'acting' => $this->acting_card . '(member_process)', |
| 6174 |
'key' => $member_id, |
| 6175 |
'result' => $response_member['ResponseCd'], |
| 6176 |
'data' => $response_member, |
| 6177 |
); |
| 6178 |
usces_save_order_acting_error( $log ); |
| 6179 |
do_action( 'usces_action_register_auto_orderdata', $args, $response_member ); |
| 6180 |
} |
| 6181 |
} else { |
| 6182 |
$settltment_errmsg = __( '[Regular purchase] Member information acquisition error.', 'autodelivery' ); |
| 6183 |
$logdata = array( |
| 6184 |
'KaiinId' => $kaiin_id, |
| 6185 |
'KaiinPass' => $kaiin_pass, |
| 6186 |
); |
| 6187 |
$log = array( |
| 6188 |
'acting' => $this->acting_card . '(member_process)', |
| 6189 |
'key' => $member_id, |
| 6190 |
'result' => 'MEMBER ERROR', |
| 6191 |
'data' => $logdata, |
| 6192 |
); |
| 6193 |
usces_save_order_acting_error( $log ); |
| 6194 |
do_action( 'usces_action_register_auto_orderdata', $args, $log ); |
| 6195 |
} |
| 6196 |
if ( '' !== $settltment_errmsg ) { |
| 6197 |
$settlement = array( |
| 6198 |
'settltment_status' => __( 'Failure', 'autodelivery' ), |
| 6199 |
'settltment_errmsg' => $settltment_errmsg, |
| 6200 |
); |
| 6201 |
$usces->set_order_meta_value( $acting_flg, usces_serialize( $settlement ), $order_id ); |
| 6202 |
wcad_settlement_error_mail( $order_id, $settltment_errmsg ); |
| 6203 |
} |
| 6204 |
} |
| 6205 |
|
| 6206 |
/** |
| 6207 |
* 決済ログ出力 |
| 6208 |
* |
| 6209 |
* @param array $log Log data. |
| 6210 |
* @param string $log_key [order_id]_[trans_id]. |
| 6211 |
* @return boolean |
| 6212 |
*/ |
| 6213 |
private function save_acting_log( $log, $log_key ) { |
| 6214 |
global $wpdb; |
| 6215 |
|
| 6216 |
$datetime = current_time( 'mysql' ); |
| 6217 |
$query = $wpdb->prepare( "INSERT INTO {$wpdb->prefix}usces_log ( `datetime`, `log`, `log_type`, `log_key` ) VALUES ( %s, %s, %s, %s )", |
| 6218 |
$datetime, |
| 6219 |
usces_serialize( $log ), |
| 6220 |
'acting_welcart', |
| 6221 |
$log_key |
| 6222 |
); |
| 6223 |
$res = $wpdb->query( $query ); // phpcs:ignore |
| 6224 |
return $res; |
| 6225 |
} |
| 6226 |
|
| 6227 |
/** |
| 6228 |
* 決済ログ取得 |
| 6229 |
* |
| 6230 |
* @param int $order_id Order number. |
| 6231 |
* @param string $log_key [order_id]_[trans_id]. |
| 6232 |
* @return array |
| 6233 |
*/ |
| 6234 |
public function get_acting_log( $order_id, $log_key = '' ) { |
| 6235 |
global $wpdb; |
| 6236 |
|
| 6237 |
if ( ! empty( $log_key ) ) { |
| 6238 |
$query = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}usces_log WHERE `log_type` = 'acting_welcart' AND `log_key` = %s ORDER BY datetime DESC", $log_key ); |
| 6239 |
} else { |
| 6240 |
$query = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}usces_log WHERE `log_type` = 'acting_welcart' AND `log_key` LIKE %s ORDER BY datetime DESC", $wpdb->esc_like( $order_id . '_' ) . '%' ); |
| 6241 |
} |
| 6242 |
$log_data = $wpdb->get_results( $query, ARRAY_A ); // phpcs:ignore |
| 6243 |
return $log_data; |
| 6244 |
} |
| 6245 |
|
| 6246 |
/** |
| 6247 |
* 決済ログ更新 |
| 6248 |
* |
| 6249 |
* @param array $log Log data. |
| 6250 |
* @param string $log_key [order_id]_[trans_id]. |
| 6251 |
* @return boolean |
| 6252 |
*/ |
| 6253 |
private function update_acting_log( $log, $log_key ) { |
| 6254 |
global $wpdb; |
| 6255 |
|
| 6256 |
$datetime = current_time( 'mysql' ); |
| 6257 |
$query = $wpdb->prepare( "UPDATE {$wpdb->prefix}usces_log SET `datetime` = %s, `log` = %s WHERE `log_type` = %s AND `log_key` = %s", |
| 6258 |
$datetime, |
| 6259 |
usces_serialize( $log ), |
| 6260 |
'acting_welcart', |
| 6261 |
$log_key |
| 6262 |
); |
| 6263 |
$res = $wpdb->query( $query ); // phpcs:ignore |
| 6264 |
return $res; |
| 6265 |
} |
| 6266 |
|
| 6267 |
/** |
| 6268 |
* 決済履歴ログ出力 |
| 6269 |
* |
| 6270 |
* @param array $log Log data. |
| 6271 |
* @param string $log_key [order_id]_[trans_id]. |
| 6272 |
* @return boolean |
| 6273 |
*/ |
| 6274 |
private function save_acting_history_log( $log, $log_key ) { |
| 6275 |
global $wpdb; |
| 6276 |
|
| 6277 |
$datetime = current_time( 'mysql' ); |
| 6278 |
$query = $wpdb->prepare( "INSERT INTO {$wpdb->prefix}usces_log ( `datetime`, `log`, `log_type`, `log_key` ) VALUES ( %s, %s, %s, %s )", |
| 6279 |
$datetime, |
| 6280 |
usces_serialize( $log ), |
| 6281 |
'acting_welcart_history', |
| 6282 |
$log_key |
| 6283 |
); |
| 6284 |
$res = $wpdb->query( $query ); // phpcs:ignore |
| 6285 |
return $res; |
| 6286 |
} |
| 6287 |
|
| 6288 |
/** |
| 6289 |
* 決済履歴ログ取得 |
| 6290 |
* |
| 6291 |
* @param string $log_key [order_id]_[trans_id]. |
| 6292 |
* @return array |
| 6293 |
*/ |
| 6294 |
public function get_acting_history_log( $log_key ) { |
| 6295 |
global $wpdb; |
| 6296 |
|
| 6297 |
$query = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}usces_log WHERE `log_type` = 'acting_welcart_history' AND `log_key` = %s ORDER BY datetime DESC", $log_key ); |
| 6298 |
$log_data = $wpdb->get_results( $query, ARRAY_A ); // phpcs:ignore |
| 6299 |
return $log_data; |
| 6300 |
} |
| 6301 |
|
| 6302 |
/** |
| 6303 |
* 決済処理取得 |
| 6304 |
* |
| 6305 |
* @param string $log_key [order_id]_[trans_id]. |
| 6306 |
* @return string |
| 6307 |
*/ |
| 6308 |
private function get_acting_operateid( $log_key ) { |
| 6309 |
$operateid = ''; |
| 6310 |
$latest_log = $this->get_acting_latest_log( $log_key, 'OK' ); |
| 6311 |
if ( isset( $latest_log['OperateId'] ) ) { |
| 6312 |
$operateid = $latest_log['OperateId']; |
| 6313 |
} |
| 6314 |
return $operateid; |
| 6315 |
} |
| 6316 |
|
| 6317 |
/** |
| 6318 |
* 初回決済処理取得 |
| 6319 |
* |
| 6320 |
* @param string $log_key [order_id]_[trans_id]. |
| 6321 |
* @return string |
| 6322 |
*/ |
| 6323 |
private function get_acting_first_operateid( $log_key ) { |
| 6324 |
global $wpdb; |
| 6325 |
|
| 6326 |
$query = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}usces_log WHERE `log_type` = 'acting_welcart_history' AND `log_key` = %s ORDER BY datetime ASC", $log_key ); |
| 6327 |
$log_data = $wpdb->get_results( $query, ARRAY_A ); // phpcs:ignore |
| 6328 |
if ( $log_data ) { |
| 6329 |
$log = usces_unserialize( $log_data[0]['log'] ); |
| 6330 |
$operateid = ( isset( $log['OperateId'] ) ) ? $log['OperateId'] : ''; |
| 6331 |
} else { |
| 6332 |
$operateid = ''; |
| 6333 |
} |
| 6334 |
return $operateid; |
| 6335 |
} |
| 6336 |
|
| 6337 |
/** |
| 6338 |
* 決済履歴 |
| 6339 |
* |
| 6340 |
* @param string $log_key [order_id]_[trans_id]. |
| 6341 |
* @return string |
| 6342 |
*/ |
| 6343 |
private function settlement_history( $log_key ) { |
| 6344 |
$html = ''; |
| 6345 |
$log_data = $this->get_acting_history_log( $log_key ); |
| 6346 |
if ( $log_data ) { |
| 6347 |
$num = count( $log_data ); |
| 6348 |
$html = '<table class="settlement-history"> |
| 6349 |
<thead class="settlement-history-head"> |
| 6350 |
<tr><th></th><th>' . __( 'Processing date', 'usces' ) . '</th><th>' . __( 'Sequence number', 'usces' ) . '</th><th>' . __( 'Processing classification', 'usces' ) . '</th><th>' . __( 'Amount', 'usces' ) . '</th><th>' . __( 'Result', 'usces' ) . '</th></tr> |
| 6351 |
</thead> |
| 6352 |
<tbody class="settlement-history-body">'; |
| 6353 |
foreach ( (array) $log_data as $data ) { |
| 6354 |
$log = usces_unserialize( $data['log'] ); |
| 6355 |
$class = ( 'OK' !== $log['ResponseCd'] ) ? ' error' : ''; |
| 6356 |
$operate_name = ( isset( $log['OperateId'] ) ) ? $this->get_operate_name( $log['OperateId'] ) : ''; |
| 6357 |
$amount = ( isset( $log['Amount'] ) ) ? usces_crform( $log['Amount'], false, true, 'return', true ) : ''; |
| 6358 |
$html .= '<tr> |
| 6359 |
<td class="num">' . $num . '</td> |
| 6360 |
<td class="datetime">' . $data['datetime'] . '</td> |
| 6361 |
<td class="transactionid">' . $log['TransactionId'] . '</td> |
| 6362 |
<td class="operateid">' . $operate_name . '</td> |
| 6363 |
<td class="amount">' . $amount . '</td> |
| 6364 |
<td class="responsecd' . $class . '">' . $log['ResponseCd'] . '</td> |
| 6365 |
</tr>'; |
| 6366 |
$num--; |
| 6367 |
} |
| 6368 |
$html .= '</tbody> |
| 6369 |
</table>'; |
| 6370 |
} |
| 6371 |
return $html; |
| 6372 |
} |
| 6373 |
|
| 6374 |
/** |
| 6375 |
* 最新処理取得 |
| 6376 |
* |
| 6377 |
* @param string $log_key [order_id]_[trans_id]. |
| 6378 |
* @param string $responsecd ResponseCd. |
| 6379 |
* @return array |
| 6380 |
*/ |
| 6381 |
public function get_acting_latest_log( $log_key, $responsecd = 'OK' ) { |
| 6382 |
$latest_log = array(); |
| 6383 |
$log_data = $this->get_acting_history_log( $log_key ); |
| 6384 |
if ( $log_data ) { |
| 6385 |
if ( 'OK' === $responsecd ) { |
| 6386 |
$reauth = false; |
| 6387 |
foreach ( (array) $log_data as $data ) { |
| 6388 |
$log = usces_unserialize( $data['log'] ); |
| 6389 |
if ( isset( $log['ResponseCd'] ) ) { |
| 6390 |
if ( 'OK' === $log['ResponseCd'] && in_array( $log['OperateId'], $this->reauth_status ) ) { |
| 6391 |
$reauth = true; |
| 6392 |
} else { |
| 6393 |
if ( $reauth ) { |
| 6394 |
if ( 'OK' === $log['ResponseCd'] && in_array( $log['OperateId'], $this->primarily_status ) ) { |
| 6395 |
$latest_log = $log; |
| 6396 |
break; |
| 6397 |
} |
| 6398 |
} else { |
| 6399 |
if ( 'OK' === $log['ResponseCd'] && in_array( $log['OperateId'], $this->latest_status ) ) { |
| 6400 |
$latest_log = $log; |
| 6401 |
break; |
| 6402 |
} |
| 6403 |
} |
| 6404 |
} |
| 6405 |
} |
| 6406 |
} |
| 6407 |
} else { |
| 6408 |
$latest_log = usces_unserialize( $log_data[0]['log'] ); |
| 6409 |
} |
| 6410 |
} |
| 6411 |
return $latest_log; |
| 6412 |
} |
| 6413 |
|
| 6414 |
/** |
| 6415 |
* 最新処理ステータス取得 |
| 6416 |
* |
| 6417 |
* @param int $member_id Member ID. |
| 6418 |
* @param int $order_id Order number. |
| 6419 |
* @return string |
| 6420 |
*/ |
| 6421 |
public function get_latest_status( $member_id, $order_id ) { |
| 6422 |
global $usces; |
| 6423 |
|
| 6424 |
$status = ''; |
| 6425 |
$log_data = $this->get_acting_log( $order_id ); |
| 6426 |
if ( $log_data && 0 < count( $log_data ) ) { |
| 6427 |
$acting_data = usces_unserialize( $log_data[0]['log'] ); |
| 6428 |
$trans_id = ( isset( $acting_data['MerchantFree1'] ) ) ? $acting_data['MerchantFree1'] : ''; |
| 6429 |
} else { |
| 6430 |
$trans_id = $usces->get_order_meta_value( 'trans_id', $order_id ); |
| 6431 |
} |
| 6432 |
if ( $trans_id ) { |
| 6433 |
$latest_log = $this->get_acting_latest_log( $order_id . '_' . $trans_id, 'ALL' ); |
| 6434 |
$status = ( isset( $latest_log['ResponseCd'] ) ) ? $latest_log['ResponseCd'] : 'NG'; |
| 6435 |
} |
| 6436 |
return $status; |
| 6437 |
} |
| 6438 |
|
| 6439 |
/** |
| 6440 |
* 処理区分名称取得 |
| 6441 |
* |
| 6442 |
* @param string $log_key [order_id]_[trans_id]. |
| 6443 |
* @return string |
| 6444 |
*/ |
| 6445 |
private function get_acting_status_name( $log_key ) { |
| 6446 |
$status_name = ''; |
| 6447 |
$log_data = $this->get_acting_history_log( $log_key ); |
| 6448 |
if ( $log_data ) { |
| 6449 |
$log = usces_unserialize( $log_data[0]['log'] ); |
| 6450 |
if ( isset( $log['OperateId'] ) ) { |
| 6451 |
$status_name = $this->get_operate_name( $log['OperateId'] ); |
| 6452 |
} |
| 6453 |
} |
| 6454 |
return $status_name; |
| 6455 |
} |
| 6456 |
|
| 6457 |
/** |
| 6458 |
* 銀聯取引ステータス取得 |
| 6459 |
* |
| 6460 |
* @param string $status Status. |
| 6461 |
* @return string |
| 6462 |
*/ |
| 6463 |
protected function get_unionpay_status_name( $status ) { |
| 6464 |
$status_name = ''; |
| 6465 |
switch ( trim( $status ) ) { |
| 6466 |
case 1: /* 売上確定済 */ |
| 6467 |
$status_name = __( 'Sales confirmed', 'usces' ); |
| 6468 |
break; |
| 6469 |
case 2: /* 取消済 */ |
| 6470 |
$status_name = __( 'Canceled', 'usces' ); |
| 6471 |
break; |
| 6472 |
case 3: /* 返品済 */ |
| 6473 |
$status_name = __( 'Returned', 'usces' ); |
| 6474 |
break; |
| 6475 |
case 4: /* 参� |
| 6476 |
�処理済 */ |
| 6477 |
$status_name = __( 'Reference processed', 'usces' ); |
| 6478 |
break; |
| 6479 |
case 97: /* NG(詳細不明) */ |
| 6480 |
$status_name = __( 'NG (details unknown)', 'usces' ); |
| 6481 |
break; |
| 6482 |
case 98: /* レスポンス不明 */ |
| 6483 |
$status_name = __( 'Unknown response', 'usces' ); |
| 6484 |
break; |
| 6485 |
case 99: |
| 6486 |
$status_name = 'NG'; |
| 6487 |
break; |
| 6488 |
} |
| 6489 |
return $status_name; |
| 6490 |
} |
| 6491 |
|
| 6492 |
/** |
| 6493 |
* 期限切れチェック |
| 6494 |
* |
| 6495 |
* @param int $order_id Order number. |
| 6496 |
* @param string $trans_id Transaction ID. |
| 6497 |
* @return boolean |
| 6498 |
*/ |
| 6499 |
private function check_paylimit( $order_id, $trans_id ) { |
| 6500 |
global $usces; |
| 6501 |
|
| 6502 |
$expiration = false; |
| 6503 |
$receipted = false; |
| 6504 |
$log_data = $this->get_acting_history_log( $order_id . '_' . $trans_id ); |
| 6505 |
if ( $log_data ) { |
| 6506 |
foreach ( (array) $log_data as $data ) { |
| 6507 |
$log = usces_unserialize( $data['log'] ); |
| 6508 |
if ( isset( $log['OperateId'] ) && 'receipted' === $log['OperateId'] ) { |
| 6509 |
$receipted = true; |
| 6510 |
break; |
| 6511 |
} |
| 6512 |
} |
| 6513 |
} |
| 6514 |
if ( $receipted ) { |
| 6515 |
return false; |
| 6516 |
} |
| 6517 |
$today = date_i18n( 'YmdHi', current_time( 'timestamp' ) ); |
| 6518 |
$acting_data = usces_unserialize( $usces->get_order_meta_value( 'acting_welcart_conv', $order_id ) ); |
| 6519 |
if ( ! empty( $acting_data['PayLimit'] ) && $today > $acting_data['PayLimit'] ) { |
| 6520 |
$expiration = true; |
| 6521 |
} |
| 6522 |
return $expiration; |
| 6523 |
} |
| 6524 |
|
| 6525 |
/** |
| 6526 |
* 削除済みチェック |
| 6527 |
* |
| 6528 |
* @param string $log_key [order_id]_[trans_id]. |
| 6529 |
* @return boolean |
| 6530 |
*/ |
| 6531 |
private function check_deleted( $log_key ) { |
| 6532 |
$deleted = false; |
| 6533 |
$log_data = $this->get_acting_history_log( $log_key ); |
| 6534 |
if ( $log_data ) { |
| 6535 |
foreach ( (array) $log_data as $data ) { |
| 6536 |
$log = usces_unserialize( $data['log'] ); |
| 6537 |
if ( isset( $log['OperateId'] ) && '2Del' === $log['OperateId'] ) { |
| 6538 |
$deleted = true; |
| 6539 |
break; |
| 6540 |
} |
| 6541 |
} |
| 6542 |
} |
| 6543 |
return $deleted; |
| 6544 |
} |
| 6545 |
|
| 6546 |
/** |
| 6547 |
* 継続課金会員データ取得 |
| 6548 |
* |
| 6549 |
* @param int $order_id Order number. |
| 6550 |
* @param int $member_id Member ID. |
| 6551 |
* @return array |
| 6552 |
*/ |
| 6553 |
private function get_continuation_data( $order_id, $member_id ) { |
| 6554 |
global $wpdb; |
| 6555 |
|
| 6556 |
$query = $wpdb->prepare( "SELECT |
| 6557 |
`con_acting` AS `acting`, |
| 6558 |
`con_order_price` AS `order_price`, |
| 6559 |
`con_price` AS `price`, |
| 6560 |
`con_next_charging` AS `chargedday`, |
| 6561 |
`con_next_contracting` AS `contractedday`, |
| 6562 |
`con_startdate` AS `startdate`, |
| 6563 |
`con_status` AS `status` |
| 6564 |
FROM {$wpdb->prefix}usces_continuation |
| 6565 |
WHERE con_order_id = %d AND con_member_id = %d", |
| 6566 |
$order_id, |
| 6567 |
$member_id |
| 6568 |
); |
| 6569 |
$data = $wpdb->get_row( $query, ARRAY_A ); // phpcs:ignore |
| 6570 |
return $data; |
| 6571 |
} |
| 6572 |
|
| 6573 |
/** |
| 6574 |
* 継続課金会員データ更新 |
| 6575 |
* |
| 6576 |
* @param int $order_id Order number. |
| 6577 |
* @param int $member_id Member ID. |
| 6578 |
* @param array $data Continuation data. |
| 6579 |
* @param boolean $stop Stop continuous billing. |
| 6580 |
* @return boolean |
| 6581 |
*/ |
| 6582 |
private function update_continuation_data( $order_id, $member_id, $data, $stop = false ) { |
| 6583 |
global $wpdb; |
| 6584 |
|
| 6585 |
if ( $stop ) { |
| 6586 |
$query = $wpdb->prepare( "UPDATE {$wpdb->prefix}usces_continuation SET |
| 6587 |
`con_status` = 'cancellation' |
| 6588 |
WHERE `con_order_id` = %d AND `con_member_id` = %d", |
| 6589 |
$order_id, |
| 6590 |
$member_id |
| 6591 |
); |
| 6592 |
} else { |
| 6593 |
$query = $wpdb->prepare( "UPDATE {$wpdb->prefix}usces_continuation SET |
| 6594 |
`con_price` = %f, |
| 6595 |
`con_next_charging` = %s, |
| 6596 |
`con_next_contracting` = %s, |
| 6597 |
`con_status` = %s |
| 6598 |
WHERE `con_order_id` = %d AND `con_member_id` = %d", |
| 6599 |
$data['price'], |
| 6600 |
$data['chargedday'], |
| 6601 |
$data['contractedday'], |
| 6602 |
$data['status'], |
| 6603 |
$order_id, |
| 6604 |
$member_id |
| 6605 |
); |
| 6606 |
} |
| 6607 |
$res = $wpdb->query( $query ); // phpcs:ignore |
| 6608 |
return $res; |
| 6609 |
} |
| 6610 |
|
| 6611 |
/** |
| 6612 |
* 日付チェック |
| 6613 |
* |
| 6614 |
* @param object $date DateTime. |
| 6615 |
* @return boolean |
| 6616 |
*/ |
| 6617 |
private function isdate( $date ) { |
| 6618 |
if ( empty( $date ) ) { |
| 6619 |
return false; |
| 6620 |
} |
| 6621 |
try { |
| 6622 |
new DateTime( $date ); |
| 6623 |
list( $year, $month, $day ) = explode( '-', $date ); |
| 6624 |
$res = checkdate( (int) $month, (int) $day, (int) $year ); |
| 6625 |
return $res; |
| 6626 |
} catch ( Exception $e ) { |
| 6627 |
return false; |
| 6628 |
} |
| 6629 |
} |
| 6630 |
|
| 6631 |
/** |
| 6632 |
* 支払方法 |
| 6633 |
* usces_fiter_the_payment_method |
| 6634 |
* |
| 6635 |
* @param array $payments Payment data. |
| 6636 |
* @return array |
| 6637 |
*/ |
| 6638 |
public function payment_method( $payments ) { |
| 6639 |
global $usces; |
| 6640 |
|
| 6641 |
$conv_exclusion = false; |
| 6642 |
$atodene_exclusion = false; |
| 6643 |
|
| 6644 |
if ( usces_have_regular_order() ) { |
| 6645 |
$conv_exclusion = true; |
| 6646 |
|
| 6647 |
} elseif ( usces_have_continue_charge() ) { |
| 6648 |
$conv_exclusion = true; |
| 6649 |
$atodene_exclusion = true; |
| 6650 |
|
| 6651 |
} else { |
| 6652 |
$acting_opts = $this->get_acting_settings(); |
| 6653 |
if ( 'on' === $acting_opts['atodene_byitem'] ) { /* 商品ごとの可否が有効 */ |
| 6654 |
$cart = $usces->cart->get_cart(); |
| 6655 |
foreach ( $cart as $cart_row ) { |
| 6656 |
$product = wel_get_product( $cart_row['post_id'] ); |
| 6657 |
$atodene_propriety = $product['atodene_propriety']; |
| 6658 |
if ( 1 === (int) $atodene_propriety ) { |
| 6659 |
$atodene_exclusion = true; |
| 6660 |
break; |
| 6661 |
} |
| 6662 |
} |
| 6663 |
} |
| 6664 |
} |
| 6665 |
|
| 6666 |
if ( $conv_exclusion ) { |
| 6667 |
foreach ( $payments as $key => $payment ) { |
| 6668 |
if ( $this->acting_flg_conv === $payment['settlement'] ) { |
| 6669 |
unset( $payments[ $key ] ); |
| 6670 |
} |
| 6671 |
} |
| 6672 |
} |
| 6673 |
if ( $atodene_exclusion ) { |
| 6674 |
foreach ( $payments as $key => $payment ) { |
| 6675 |
if ( $this->acting_flg_atodene === $payment['settlement'] ) { |
| 6676 |
unset( $payments[ $key ] ); |
| 6677 |
} |
| 6678 |
} |
| 6679 |
} |
| 6680 |
|
| 6681 |
return $payments; |
| 6682 |
} |
| 6683 |
|
| 6684 |
/** |
| 6685 |
* ATODENE CSVアップロード |
| 6686 |
* usces_after_cart_instant |
| 6687 |
*/ |
| 6688 |
public function atodene_upload() { |
| 6689 |
if ( isset( $_POST['page'] ) && 'atodene_results_csv' === wp_unslash( $_POST['page'] ) && isset( $_POST['action'] ) && 'atodene_upload' === wp_unslash( $_POST['action'] ) ) { |
| 6690 |
$path = WP_CONTENT_DIR . '/uploads/'; |
| 6691 |
$workfile = $_FILES['atodene_upcsv']['tmp_name']; |
| 6692 |
if ( ! is_uploaded_file( $workfile ) ) { |
| 6693 |
$message = __( 'The file was not uploaded.', 'usces' ); |
| 6694 |
wp_redirect( |
| 6695 |
add_query_arg( |
| 6696 |
array( |
| 6697 |
'page' => 'usces_orderlist', |
| 6698 |
'usces_status' => 'error', |
| 6699 |
'usces_message' => urlencode( $message ), |
| 6700 |
'order_action' => 'atodene_upload', |
| 6701 |
), |
| 6702 |
USCES_ADMIN_URL |
| 6703 |
) |
| 6704 |
); |
| 6705 |
exit(); |
| 6706 |
} |
| 6707 |
|
| 6708 |
list( $fname, $fext ) = explode( '.', $_FILES['atodene_upcsv']['name'], 2 ); |
| 6709 |
if ( 'csv' !== $fext ) { |
| 6710 |
$message = __( 'The file is not supported.', 'usces' ) . $fname . '.' . $fext; |
| 6711 |
wp_redirect( |
| 6712 |
add_query_arg( |
| 6713 |
array( |
| 6714 |
'page' => 'usces_orderlist', |
| 6715 |
'usces_status' => 'error', |
| 6716 |
'usces_message' => urlencode( $message ), |
| 6717 |
'order_action' => 'atodene_upload', |
| 6718 |
), |
| 6719 |
USCES_ADMIN_URL |
| 6720 |
) |
| 6721 |
); |
| 6722 |
exit(); |
| 6723 |
} |
| 6724 |
|
| 6725 |
$new_filename = base64_encode( $fname . '_' . time() . '.' . $fext ); |
| 6726 |
if ( ! move_uploaded_file( $_FILES['atodene_upcsv']['tmp_name'], $path . $new_filename ) ) { |
| 6727 |
$message = __( 'The file was not stored.', 'usces' ) . $_FILES['atodene_upcsv']['name']; |
| 6728 |
wp_redirect( |
| 6729 |
add_query_arg( |
| 6730 |
array( |
| 6731 |
'page' => 'usces_orderlist', |
| 6732 |
'usces_status' => 'error', |
| 6733 |
'usces_message' => urlencode( $message ), |
| 6734 |
'order_action' => 'atodene_upload', |
| 6735 |
), |
| 6736 |
USCES_ADMIN_URL |
| 6737 |
) |
| 6738 |
); |
| 6739 |
exit(); |
| 6740 |
} |
| 6741 |
|
| 6742 |
wp_redirect( |
| 6743 |
add_query_arg( |
| 6744 |
array( |
| 6745 |
'page' => 'usces_orderlist', |
| 6746 |
'usces_status' => 'none', |
| 6747 |
'usces_message' => '', |
| 6748 |
'order_action' => 'upload_atodene_results', |
| 6749 |
'atodene_upfile' => urlencode( $new_filename ), |
| 6750 |
'wc_nonce' => wp_create_nonce( 'order_list' ), |
| 6751 |
), |
| 6752 |
USCES_ADMIN_URL |
| 6753 |
) |
| 6754 |
); |
| 6755 |
exit(); |
| 6756 |
} |
| 6757 |
} |
| 6758 |
|
| 6759 |
/** |
| 6760 |
* ATODENE CSV出力・CSVアップロード |
| 6761 |
* usces_action_order_list_page |
| 6762 |
* |
| 6763 |
* @param string $order_action Order action. |
| 6764 |
*/ |
| 6765 |
public function output_atodene_csv( $order_action ) { |
| 6766 |
switch ( $order_action ) { |
| 6767 |
case 'download_atodene_register': |
| 6768 |
$this->download_atodene_register(); |
| 6769 |
break; |
| 6770 |
case 'download_atodene_update': |
| 6771 |
$this->download_atodene_update(); |
| 6772 |
break; |
| 6773 |
case 'download_atodene_report': |
| 6774 |
$this->download_atodene_report(); |
| 6775 |
break; |
| 6776 |
case 'upload_atodene_results': |
| 6777 |
if ( isset( $_GET['atodene_upfile'] ) && ! WCUtils::is_blank( wp_unslash( $_GET['atodene_upfile'] ) ) ) { |
| 6778 |
$res = $this->upload_atodene_results(); |
| 6779 |
$_GET['usces_status'] = ( isset( $res['status'] ) ) ? $res['status'] : ''; |
| 6780 |
$_GET['usces_message'] = ( isset( $res['message'] ) ) ? $res['message'] : ''; |
| 6781 |
} |
| 6782 |
break; |
| 6783 |
} |
| 6784 |
} |
| 6785 |
|
| 6786 |
/** |
| 6787 |
* ATODENE アクションボタン |
| 6788 |
* usces_action_order_list_searchbox_bottom |
| 6789 |
*/ |
| 6790 |
public function action_atodene_button() { |
| 6791 |
?> |
| 6792 |
<input type="button" id="dl_atodene_register_csv" class="searchbutton button" value="<?php esc_attr_e( 'ATODENE transaction registration CSV output', 'usces' ); ?>" /> |
| 6793 |
<!--<input type="button" id="dl_atodene_update_csv" class="searchbutton" value="<?php esc_attr_e( 'ATODENE transaction batch change and cancel CSV output', 'usces' ); ?>" />--> |
| 6794 |
<input type="button" id="up_atodene_results_csv" class="searchbutton button" value="<?php esc_attr_e( 'ATODENE credit review result CSV upload', 'usces' ); ?>" /> |
| 6795 |
<input type="button" id="dl_atodene_report_csv" class="searchbutton button" value="<?php esc_attr_e( 'ATODENE shipping report registration CSV output', 'usces' ); ?>" /> |
| 6796 |
<?php |
| 6797 |
} |
| 6798 |
|
| 6799 |
/** |
| 6800 |
* ATODENE CSVアップロードダイアログ |
| 6801 |
* usces_action_order_list_footer |
| 6802 |
*/ |
| 6803 |
public function order_list_footer() { |
| 6804 |
?> |
| 6805 |
<div id="atodene_upload_dialog" class="upload_dialog" style="display:none;"> |
| 6806 |
<p><?php _e( "Upload the prescribed CSV file and import credit screening results.<br />Please choose a file, and press 'Start of capture'.", 'usces' ); ?></p> |
| 6807 |
<form action="<?php echo esc_url( USCES_ADMIN_URL ); ?>" method="post" enctype="multipart/form-data" name="atodene_upform" id="atodene_upform"> |
| 6808 |
<fieldset> |
| 6809 |
<p><input name="atodene_upcsv" type="file" class="filename" /></p> |
| 6810 |
</fieldset> |
| 6811 |
<p><input name="atodene_uploadcsv" type="submit" class="button" value="<?php esc_attr_e( 'Start of capture', 'usces' ); ?>" /></p> |
| 6812 |
<input name="page" type="hidden" value="atodene_results_csv" /> |
| 6813 |
<input name="action" type="hidden" value="atodene_upload" /> |
| 6814 |
</form> |
| 6815 |
</div> |
| 6816 |
<?php |
| 6817 |
} |
| 6818 |
|
| 6819 |
/** |
| 6820 |
* ATODENE CSVダウンロードダイアログ |
| 6821 |
* usces_filter_order_list_page_js |
| 6822 |
* |
| 6823 |
* @param string $html HTML. |
| 6824 |
* @return string |
| 6825 |
*/ |
| 6826 |
public function order_list_page_js( $html ) { |
| 6827 |
$html .= ' |
| 6828 |
$(document).on( "click", "#dl_atodene_register_csv", function() { |
| 6829 |
if( $("input[name*=\'listcheck\']:checked").length == 0 ) { |
| 6830 |
alert( "' . __( 'Choose the data.', 'usces' ) . '" ); |
| 6831 |
$("#orderlistaction").val(""); |
| 6832 |
return false; |
| 6833 |
} |
| 6834 |
var listcheck = ""; |
| 6835 |
$("input[name*=\'listcheck\']").each( function( i ) { |
| 6836 |
if( $(this).prop("checked") ) { |
| 6837 |
listcheck += "&listcheck["+i+"]="+$(this).val(); |
| 6838 |
} |
| 6839 |
}); |
| 6840 |
location.href = "' . USCES_ADMIN_URL . '?page=usces_orderlist&order_action=download_atodene_register"+listcheck+"&noheader=true&_nonce=' . wp_create_nonce( 'csv_nonce' ) . '"; |
| 6841 |
});'; |
| 6842 |
|
| 6843 |
$html .= ' |
| 6844 |
$(document).on( "click", "#dl_atodene_report_csv", function() { |
| 6845 |
if( $("input[name*=\'listcheck\']:checked").length == 0 ) { |
| 6846 |
alert("' . __( 'Choose the data.', 'usces' ) . '"); |
| 6847 |
$("#orderlistaction").val(""); |
| 6848 |
return false; |
| 6849 |
} |
| 6850 |
var listcheck = ""; |
| 6851 |
$("input[name*=\'listcheck\']").each( function( i ) { |
| 6852 |
if( $(this).prop("checked") ) { |
| 6853 |
listcheck += "&listcheck["+i+"]="+$(this).val(); |
| 6854 |
} |
| 6855 |
}); |
| 6856 |
location.href = "' . USCES_ADMIN_URL . '?page=usces_orderlist&order_action=download_atodene_report"+listcheck+"&noheader=true&_nonce=' . wp_create_nonce( 'csv_nonce' ) . '"; |
| 6857 |
}); |
| 6858 |
|
| 6859 |
$(document).on( "click", "#up_atodene_results_csv", function() { |
| 6860 |
$("#atodene_upload_dialog").dialog({ |
| 6861 |
bgiframe: true, |
| 6862 |
autoOpen: false, |
| 6863 |
title: "' . __( 'Credit Review Result CSV Capture', 'usces' ) . '", |
| 6864 |
height: 350, |
| 6865 |
width: 550, |
| 6866 |
modal: true, |
| 6867 |
buttons: { |
| 6868 |
"' . __( 'Close' ) . '": function() { |
| 6869 |
$(this).dialog("close"); |
| 6870 |
} |
| 6871 |
}, |
| 6872 |
close: function() { |
| 6873 |
} |
| 6874 |
}).dialog("open"); |
| 6875 |
});'; |
| 6876 |
|
| 6877 |
return $html; |
| 6878 |
} |
| 6879 |
|
| 6880 |
/** |
| 6881 |
* ATODENE アクションステータス |
| 6882 |
* usces_order_list_action_status |
| 6883 |
* |
| 6884 |
* @param string $status Status. |
| 6885 |
* @return string |
| 6886 |
*/ |
| 6887 |
public function order_list_action_status( $status ) { |
| 6888 |
if ( isset( $_GET['order_action'] ) && ( 'atodene_upload' === filter_input( INPUT_GET, 'order_action', FILTER_DEFAULT ) || 'upload_atodene_results' === filter_input( INPUT_GET, 'order_action', FILTER_DEFAULT ) ) && isset( $_GET['usces_status'] ) && ! empty( $_GET['usces_status'] ) ) { |
| 6889 |
$status = filter_input( INPUT_GET, 'usces_status' ); |
| 6890 |
} |
| 6891 |
return $status; |
| 6892 |
} |
| 6893 |
|
| 6894 |
/** |
| 6895 |
* ATODENE アクションステータスメッセージ |
| 6896 |
* usces_order_list_action_message |
| 6897 |
* |
| 6898 |
* @param string $message Message. |
| 6899 |
* @return string |
| 6900 |
*/ |
| 6901 |
public function order_list_action_message( $message ) { |
| 6902 |
if ( isset( $_GET['order_action'] ) && ( 'atodene_upload' === filter_input( INPUT_GET, 'order_action', FILTER_DEFAULT ) || 'upload_atodene_results' === filter_input( INPUT_GET, 'order_action', FILTER_DEFAULT ) ) && isset( $_GET['usces_message'] ) && ! empty( $_GET['usces_message'] ) ) { |
| 6903 |
$message = urldecode( filter_input( INPUT_GET, 'usces_message' ) ); |
| 6904 |
} |
| 6905 |
return $message; |
| 6906 |
} |
| 6907 |
|
| 6908 |
/** |
| 6909 |
* ATODENE 運送会社名 |
| 6910 |
* usces_filter_deli_comps |
| 6911 |
* |
| 6912 |
* @param array $deli_comps Delivery company. |
| 6913 |
* @return array |
| 6914 |
*/ |
| 6915 |
public function delivery_company_name( $deli_comps ) { |
| 6916 |
$deli_comps = array( |
| 6917 |
'佐川急便', |
| 6918 |
'ヤマト運輸', |
| 6919 |
'クロネコメール便', |
| 6920 |
'ゆうパック', |
| 6921 |
'レターパック', |
| 6922 |
'福山通運', |
| 6923 |
'西濃運輸', |
| 6924 |
); |
| 6925 |
$deli_comps = apply_filters( 'usces_filter_deli_comps_atodene', $deli_comps ); |
| 6926 |
return $deli_comps; |
| 6927 |
} |
| 6928 |
|
| 6929 |
/** |
| 6930 |
* 後払い決済の可否 |
| 6931 |
* usces_item_master_second_section |
| 6932 |
* |
| 6933 |
* @param string $second_section Second section area. |
| 6934 |
* @param int $post_id Post ID. |
| 6935 |
* @return string |
| 6936 |
*/ |
| 6937 |
public function edit_item_atodene_byitem( $second_section, $post_id ) { |
| 6938 |
global $usces; |
| 6939 |
|
| 6940 |
$division = $usces->getItemDivision( $post_id ); |
| 6941 |
$charging_type = $usces->getItemChargingType( $post_id ); |
| 6942 |
$acting_opts = $this->get_acting_settings(); |
| 6943 |
if ( 'shipped' === $division && 'continue' !== $charging_type && 'on' === $acting_opts['atodene_byitem'] ) { /* 商品ごとの可否が有効 */ |
| 6944 |
$product = wel_get_product( $post_id ); |
| 6945 |
$atodene_propriety = $product['atodene_propriety']; |
| 6946 |
$checked = ( 1 === (int) $atodene_propriety ) ? array( '', ' checked="checked"' ) : array( ' checked="checked"', '' ); |
| 6947 |
$second_section .= ' |
| 6948 |
<tr> |
| 6949 |
<th>' . __( 'Atobarai Propriety', 'usces' ) . '</th> |
| 6950 |
<td> |
| 6951 |
<label for="atodene_propriety_0"><input name="atodene_propriety" id="atodene_propriety_0" type="radio" value="0"' . $checked[0] . '>' . __( 'available', 'usces' ) . '</label> |
| 6952 |
<label for="atodene_propriety_1"><input name="atodene_propriety" id="atodene_propriety_1" type="radio" value="1"' . $checked[1] . '>' . __( 'not available', 'usces' ) . '</label> |
| 6953 |
</td> |
| 6954 |
</tr>'; |
| 6955 |
} |
| 6956 |
return $second_section; |
| 6957 |
} |
| 6958 |
|
| 6959 |
/** |
| 6960 |
* 後払い決済の可否更新 |
| 6961 |
* usces_action_save_product |
| 6962 |
* |
| 6963 |
* @param int $post_id Post ID. |
| 6964 |
* @param array $post Post data. |
| 6965 |
*/ |
| 6966 |
public function save_item_atodene_byitem( $post_id, $post ) { |
| 6967 |
/* This process has moved to item_post.php 1567. */ |
| 6968 |
|
| 6969 |
// if ( isset( $_POST['atodene_propriety'] ) ) { |
| 6970 |
// update_post_meta( $post_id, 'atodene_propriety', $_POST['atodene_propriety'] ); |
| 6971 |
// } |
| 6972 |
} |
| 6973 |
|
| 6974 |
/** |
| 6975 |
* 接続しない決済モジュール |
| 6976 |
* usces_filter_nonacting_settlements |
| 6977 |
* |
| 6978 |
* @param array $nonacting_settlements Non-working settlement module.. |
| 6979 |
* @return array |
| 6980 |
*/ |
| 6981 |
public function nonacting_settlements( $nonacting_settlements ) { |
| 6982 |
if ( ! in_array( 'acting_welcart_atodene', $nonacting_settlements ) ) { |
| 6983 |
$nonacting_settlements[] = 'acting_welcart_atodene'; |
| 6984 |
} |
| 6985 |
return $nonacting_settlements; |
| 6986 |
} |
| 6987 |
|
| 6988 |
/** |
| 6989 |
* 利用可能な支払方法 |
| 6990 |
* wcad_filter_the_payment_method_restriction |
| 6991 |
* |
| 6992 |
* @param array $payments_restriction Payment method. |
| 6993 |
* @param string $payments_value Input value. |
| 6994 |
* @return array |
| 6995 |
*/ |
| 6996 |
public function payment_method_restriction_atodene( $payments_restriction, $payments_value ) { |
| 6997 |
global $usces; |
| 6998 |
|
| 6999 |
$acting_opts = $this->get_acting_settings(); |
| 7000 |
if ( usces_have_regular_order() ) { |
| 7001 |
$atodene_exclusion = false; |
| 7002 |
if ( 'on' === $acting_opts['atodene_byitem'] ) { /* 商品ごとの可否が有効 */ |
| 7003 |
$cart = $usces->cart->get_cart(); |
| 7004 |
foreach ( $cart as $cart_row ) { |
| 7005 |
$product = wel_get_product( $cart_row['post_id'] ); |
| 7006 |
$atodene_propriety = $product['atodene_propriety']; |
| 7007 |
if ( 1 === (int) $atodene_propriety ) { |
| 7008 |
$atodene_exclusion = true; |
| 7009 |
break; |
| 7010 |
} |
| 7011 |
} |
| 7012 |
} |
| 7013 |
if ( ! $atodene_exclusion ) { |
| 7014 |
$payments = usces_get_system_option( 'usces_payment_method', 'settlement' ); |
| 7015 |
$payments_restriction[] = $payments['acting_welcart_atodene']; |
| 7016 |
foreach ( (array) $payments_restriction as $key => $value ) { |
| 7017 |
$sort[ $key ] = $value['sort']; |
| 7018 |
} |
| 7019 |
array_multisort( $sort, SORT_ASC, $payments_restriction ); |
| 7020 |
} |
| 7021 |
} |
| 7022 |
return $payments_restriction; |
| 7023 |
} |
| 7024 |
|
| 7025 |
/** |
| 7026 |
* ATODENE 取引登録CSV出力 |
| 7027 |
*/ |
| 7028 |
public function download_atodene_register() { |
| 7029 |
global $usces; |
| 7030 |
|
| 7031 |
$acting_opts = $this->get_acting_settings(); |
| 7032 |
$filename = mb_convert_encoding( __( 'ATODENE_transaction_', 'usces' ), 'SJIS', 'UTF-8' ) . date_i18n( 'YmdHis', current_time( 'timestamp' ) ) . '.csv'; |
| 7033 |
|
| 7034 |
$line = '"ご購� |
| 7035 |
�店受注番号","購� |
| 7036 |
�� |
| 7037 |
注文日","会社名","部署名","氏名","氏名(フリガナ)","郵便番号","住所","電話番号","メールアドレス","� |
| 7038 |
�送� |
| 7039 |
�会社名","� |
| 7040 |
�送� |
| 7041 |
�部署名","� |
| 7042 |
�送� |
| 7043 |
�氏名","� |
| 7044 |
�送� |
| 7045 |
�氏名(フリガナ)","� |
| 7046 |
�送� |
| 7047 |
�郵便番号","� |
| 7048 |
�送� |
| 7049 |
�住所","� |
| 7050 |
�送� |
| 7051 |
�電話番号","請求書送付方法","予備領域1","予備領域2","予備領域3","顧客請求総額(税込)","明細名(商品名)","単価(税込)","数量"' . "\r\n"; |
| 7052 |
|
| 7053 |
$ids = $_GET['listcheck']; |
| 7054 |
foreach ( (array) $ids as $order_id ) { |
| 7055 |
$order_data = $usces->get_order_data( $order_id, 'direct' ); |
| 7056 |
$payment = $usces->getPayments( $order_data['order_payment_name'] ); |
| 7057 |
if ( 'acting_welcart_atodene' !== $payment['settlement'] ) { |
| 7058 |
continue; |
| 7059 |
} |
| 7060 |
|
| 7061 |
$delivery = usces_unserialize( $order_data['order_delivery'] ); |
| 7062 |
$cart = usces_get_ordercartdata( $order_id ); |
| 7063 |
|
| 7064 |
$order_date = substr( $order_data['order_date'], 0, 10 ); |
| 7065 |
$date = str_replace( '-', '/', $order_date ); |
| 7066 |
|
| 7067 |
$company = $usces->get_order_meta_value( 'cscs_company', $order_id ); |
| 7068 |
$order_name = $order_data['order_name1'] . $order_data['order_name2']; |
| 7069 |
$order_kana = mb_convert_kana( $order_data['order_name3'], 'ak', 'UTF-8' ) . mb_convert_kana( $order_data['order_name4'], 'ak', 'UTF-8' ); |
| 7070 |
$order_zip = str_replace( 'ー', '', mb_convert_kana( $order_data['order_zip'], 'a', 'UTF-8' ) ); |
| 7071 |
$order_post = str_replace( '-', '', $order_zip ); |
| 7072 |
$order_address = $order_data['order_pref'] . $order_data['order_address1']; |
| 7073 |
if ( ! empty( $order_data['order_address2'] ) ) { |
| 7074 |
$order_address .= mb_convert_kana( $order_data['order_address2'], 'ak', 'UTF-8' ); |
| 7075 |
} |
| 7076 |
if ( ! empty( $order_data['order_address3'] ) ) { |
| 7077 |
$order_address .= mb_convert_kana( $order_data['order_address3'], 'ak', 'UTF-8' ); |
| 7078 |
} |
| 7079 |
$order_tel = $order_data['order_tel']; |
| 7080 |
$email = $order_data['order_email']; |
| 7081 |
|
| 7082 |
$shipto_company = $usces->get_order_meta_value( 'csde_company', $order_id ); |
| 7083 |
$shipto_name = $delivery['name1'] . $delivery['name2']; |
| 7084 |
$shipto_kana = mb_convert_kana( $delivery['name3'], 'ak', 'UTF-8' ) . mb_convert_kana( $delivery['name4'], 'ak', 'UTF-8' ); |
| 7085 |
$shipto_zip = str_replace( 'ー', '', mb_convert_kana( $delivery['zipcode'], 'a', 'UTF-8' ) ); |
| 7086 |
$shipto_post = str_replace( '-', '', $delivery['zipcode'] ); |
| 7087 |
$shipto_address = $delivery['pref'] . $delivery['address1']; |
| 7088 |
if ( ! empty( $delivery['address2'] ) ) { |
| 7089 |
$shipto_address .= mb_convert_kana( $delivery['address2'], 'ak', 'UTF-8' ); |
| 7090 |
} |
| 7091 |
if ( ! empty( $delivery['address3'] ) ) { |
| 7092 |
$shipto_address .= mb_convert_kana( $delivery['address3'], 'ak', 'UTF-8' ); |
| 7093 |
} |
| 7094 |
$shipto_tel = $delivery['tel']; |
| 7095 |
|
| 7096 |
$amount = $order_data['order_item_total_price'] - $order_data['order_usedpoint'] + $order_data['order_discount'] + $order_data['order_shipping_charge'] + $order_data['order_cod_fee'] + $order_data['order_tax']; |
| 7097 |
|
| 7098 |
$line .= '"' . $order_id . '",' . |
| 7099 |
'"' . $date . '",' . |
| 7100 |
'"' . $company . '","",' . |
| 7101 |
'"' . $order_name . '",' . |
| 7102 |
'"' . $order_kana . '",' . |
| 7103 |
'"' . $order_post . '",' . |
| 7104 |
'"' . $order_address . '",' . |
| 7105 |
'"' . $order_tel . '",' . |
| 7106 |
'"' . $email . '",' . |
| 7107 |
'"' . $shipto_company . '","",' . |
| 7108 |
'"' . $shipto_name . '",' . |
| 7109 |
'"' . $shipto_kana . '",' . |
| 7110 |
'"' . $shipto_post . '",' . |
| 7111 |
'"' . $shipto_address . '",' . |
| 7112 |
'"' . $shipto_tel . '",' . |
| 7113 |
'"' . $acting_opts['atodene_billing_method'] . '","","","",' . |
| 7114 |
'"' . $amount . '",'; |
| 7115 |
|
| 7116 |
$row = 1; |
| 7117 |
foreach ( $cart as $cart_row ) { |
| 7118 |
if ( 1 < $row ) { |
| 7119 |
$line .= '"","","","","","","","","","","","","","","","","","","","","","",'; |
| 7120 |
} |
| 7121 |
$line .= '"' . $cart_row['item_name'] . '",'; |
| 7122 |
$line .= '"' . usces_crform( $cart_row['price'], false, false, 'return', false ) . '",'; |
| 7123 |
$line .= '"' . $cart_row['quantity'] . '"' . "\r\n"; |
| 7124 |
$row++; |
| 7125 |
} |
| 7126 |
|
| 7127 |
if ( 0 !== (int) $order_data['order_discount'] ) { |
| 7128 |
$line .= '"","","","","","","","","","","","","","","","","","","","","","",'; |
| 7129 |
$line .= '"' . apply_filters( 'usces_confirm_discount_label', __( 'Discount', 'usces' ), $order_id ) . '",'; |
| 7130 |
$line .= '"' . usces_crform( $cart_row['order_discount'], false, false, 'return', false ) . '","1"' . "\r\n"; |
| 7131 |
} |
| 7132 |
|
| 7133 |
if ( usces_is_tax_display() && 'products' === usces_get_tax_target() && 'exclude' === usces_get_tax_mode() ) { |
| 7134 |
$line .= '"","","","","","","","","","","","","","","","","","","","","","",'; |
| 7135 |
$line .= '"' . usces_tax_label( $order_data, 'return' ) . '",'; |
| 7136 |
$line .= '"' . usces_crform( $order_data['order_tax'], false, false, 'return', false ) . '","1"' . "\r\n"; |
| 7137 |
} |
| 7138 |
|
| 7139 |
if ( usces_is_member_system() && usces_is_member_system_point() && 0 === (int) usces_point_coverage() && 0 !== (int) $order_data['order_usedpoint'] ) { |
| 7140 |
$line .= '"","","","","","","","","","","","","","","","","","","","","","",'; |
| 7141 |
$line .= '"' . __( 'use of points', 'usces' ) . '",'; |
| 7142 |
$line .= '"' . usces_crform( $order_data['order_usedpoint'], false, false, 'return', false ) . '","1"' . "\r\n"; |
| 7143 |
} |
| 7144 |
|
| 7145 |
if ( 0 < $order_data['order_shipping_charge'] ) { |
| 7146 |
$line .= '"","","","","","","","","","","","","","","","","","","","","","",'; |
| 7147 |
$line .= '"' . __( 'Shipping', 'usces' ) . '",'; |
| 7148 |
$line .= '"' . usces_crform( $order_data['order_shipping_charge'], false, false, 'return', false ) . '","1"' . "\r\n"; |
| 7149 |
} |
| 7150 |
|
| 7151 |
if ( 0 < $order_data['order_cod_fee'] ) { |
| 7152 |
$line .= '"","","","","","","","","","","","","","","","","","","","","","",'; |
| 7153 |
$line .= '"' . apply_filters( 'usces_filter_cod_label', __( 'COD fee', 'usces' ) ) . '",'; |
| 7154 |
$line .= '"' . usces_crform( $order_data['order_cod_fee'], false, false, 'return', false ) . '","1"' . "\r\n"; |
| 7155 |
} |
| 7156 |
|
| 7157 |
if ( usces_is_tax_display() && 'all' === usces_get_tax_target() && 'exclude' === usces_get_tax_mode() ) { |
| 7158 |
$line .= '"","","","","","","","","","","","","","","","","","","","","","",'; |
| 7159 |
$line .= '"' . usces_tax_label( $order_data, 'return' ) . '",'; |
| 7160 |
$line .= '"' . usces_crform( $order_data['order_tax'], false, false, 'return', false ) . '","1"' . "\r\n"; |
| 7161 |
} |
| 7162 |
|
| 7163 |
if ( usces_is_member_system() && usces_is_member_system_point() && 1 === (int) usces_point_coverage() && 0 !== (int) $order_data['order_usedpoint'] ) { |
| 7164 |
$line .= '"","","","","","","","","","","","","","","","","","","","","","",'; |
| 7165 |
$line .= '"' . __( 'use of points', 'usces' ) . '",'; |
| 7166 |
$line .= '"' . usces_crform( $order_data['order_usedpoint'], false, false, 'return', false ) . '","1"' . "\r\n"; |
| 7167 |
} |
| 7168 |
} |
| 7169 |
|
| 7170 |
header( 'Content-Type: application/octet-stream' ); |
| 7171 |
header( "Content-disposition: attachment; filename=$filename" ); |
| 7172 |
mb_http_output( 'pass' ); |
| 7173 |
print( mb_convert_encoding( $line, 'SJIS-win', 'UTF-8' ) ); // phpcs:ignore |
| 7174 |
exit(); |
| 7175 |
} |
| 7176 |
|
| 7177 |
/** |
| 7178 |
* ATODENE 取引一括変更・キャンセルCSV出力 |
| 7179 |
*/ |
| 7180 |
public function download_atodene_update() { |
| 7181 |
exit(); |
| 7182 |
} |
| 7183 |
|
| 7184 |
/** |
| 7185 |
* ATODENE 出荷報告登録CSV出力 |
| 7186 |
*/ |
| 7187 |
public function download_atodene_report() { |
| 7188 |
global $usces; |
| 7189 |
|
| 7190 |
$acting_opts = $this->get_acting_settings(); |
| 7191 |
$filename = mb_convert_encoding( __( 'ATODENE_shippingreport_', 'usces' ), 'SJIS', 'UTF-8' ) . date_i18n( 'YmdHis', current_time( 'timestamp' ) ) . '.csv'; |
| 7192 |
|
| 7193 |
$line = '"運送会社名","� |
| 7194 |
�送伝票番号","購� |
| 7195 |
�� |
| 7196 |
注文日","お問合せ番号","ご購� |
| 7197 |
�店受注番号","氏名","予備� |
| 7198 |
目","� |
| 7199 |
�送� |
| 7200 |
�氏名","� |
| 7201 |
�送� |
| 7202 |
�住所","顧客請求金額(税込)","請求書送付方法","審査結果"' . "\r\n"; |
| 7203 |
|
| 7204 |
$ids = $_GET['listcheck']; |
| 7205 |
foreach ( (array) $ids as $order_id ) { |
| 7206 |
$order_data = $usces->get_order_data( $order_id, 'direct' ); |
| 7207 |
$payment = $usces->getPayments( $order_data['order_payment_name'] ); |
| 7208 |
if ( 'acting_welcart_atodene' !== $payment['settlement'] ) { |
| 7209 |
continue; |
| 7210 |
} |
| 7211 |
|
| 7212 |
$delivery_company = $usces->get_order_meta_value( 'delivery_company', $order_id ); |
| 7213 |
$tracking_number = $usces->get_order_meta_value( apply_filters( 'usces_filter_tracking_meta_key', 'tracking_number' ), $order_id ); |
| 7214 |
$atodene_number = $usces->get_order_meta_value( 'atodene_number', $order_id ); |
| 7215 |
|
| 7216 |
if ( ! empty( $delivery_company ) && ! empty( $tracking_number ) && ! empty( $atodene_number ) ) { |
| 7217 |
$line .= '"' . $delivery_company . '",' . |
| 7218 |
'"' . $tracking_number . '","",' . |
| 7219 |
'"' . $atodene_number . '",' . |
| 7220 |
'"' . $order_id . '","","","","","","",""' . "\r\n"; |
| 7221 |
} |
| 7222 |
} |
| 7223 |
|
| 7224 |
header( 'Content-Type: application/octet-stream' ); |
| 7225 |
header( "Content-disposition: attachment; filename=$filename" ); |
| 7226 |
mb_http_output( 'pass' ); |
| 7227 |
print( mb_convert_encoding( $line, 'SJIS-win', 'UTF-8' ) ); // phpcs:ignore |
| 7228 |
exit(); |
| 7229 |
} |
| 7230 |
|
| 7231 |
/** |
| 7232 |
* ATODENE 与信審査結果CSV取込 |
| 7233 |
* |
| 7234 |
* @return array |
| 7235 |
*/ |
| 7236 |
public function upload_atodene_results() { |
| 7237 |
global $usces, $wpdb; |
| 7238 |
|
| 7239 |
$res = array(); |
| 7240 |
$path = WP_CONTENT_DIR . '/uploads/'; |
| 7241 |
|
| 7242 |
if ( isset( $_GET['atodene_upfile'] ) && ! WCUtils::is_blank( filter_input( INPUT_GET, 'atodene_upfile', FILTER_DEFAULT ) ) && isset( $_GET['order_action'] ) && 'upload_atodene_results' === filter_input( INPUT_GET, 'order_action', FILTER_DEFAULT ) ) { |
| 7243 |
$file_name = urldecode( filter_input( INPUT_GET, 'atodene_upfile' ) ); |
| 7244 |
$decode_filename = base64_decode( $file_name ); |
| 7245 |
if ( ! file_exists( $path . $file_name ) ) { |
| 7246 |
$res['status'] = 'error'; |
| 7247 |
$res['message'] = __( 'CSV file does not exist.', 'usces' ) . esc_html( $decode_filename ); |
| 7248 |
return( $res ); |
| 7249 |
} |
| 7250 |
} |
| 7251 |
|
| 7252 |
$wpdb->query( 'SET SQL_BIG_SELECTS=1' ); |
| 7253 |
set_time_limit( 3600 ); |
| 7254 |
|
| 7255 |
define( 'COL_ORDER_ID', 0 ); /* ご購� |
| 7256 |
�店受注番号 */ |
| 7257 |
define( 'COL_ATODINE_NUMBER', 1 ); /* お問合せ番号 */ |
| 7258 |
define( 'COL_NAME', 2 ); /* 氏名 */ |
| 7259 |
define( 'COL_AMOUNT', 3 ); /* 顧客請求金額(税込) */ |
| 7260 |
define( 'COL_BILLING_METHOD', 4 ); /* 請求書送付方法(別送/同梱) */ |
| 7261 |
define( 'COL_RESULTS', 5 ); /* 与信審査結果(OK/NG/保留/審査中) */ |
| 7262 |
|
| 7263 |
if ( ! ( $fpo = fopen( $path . $file_name, 'r' ) ) ) { |
| 7264 |
$res['status'] = 'error'; |
| 7265 |
$res['message'] = __( 'A file does not open.', 'usces' ) . esc_html( $decode_filename ); |
| 7266 |
return $res; |
| 7267 |
} |
| 7268 |
|
| 7269 |
$orglines = array(); |
| 7270 |
$sp = ','; |
| 7271 |
|
| 7272 |
$fname_parts = explode( '.', $decode_filename ); |
| 7273 |
if ( 'csv' !== end( $fname_parts ) ) { |
| 7274 |
$res['status'] = 'error'; |
| 7275 |
$res['message'] = __( 'This file is not in the CSV file.', 'usces' ) . esc_html( $decode_filename ); |
| 7276 |
return $res; |
| 7277 |
} |
| 7278 |
|
| 7279 |
$buf = ''; |
| 7280 |
while ( ! feof( $fpo ) ) { |
| 7281 |
$temp = fgets( $fpo, 10240 ); |
| 7282 |
if ( 0 === strlen( $temp ) ) { |
| 7283 |
continue; |
| 7284 |
} |
| 7285 |
$orglines[] = str_replace( '"', '', $temp ); |
| 7286 |
} |
| 7287 |
fclose( $fpo ); |
| 7288 |
|
| 7289 |
foreach ( $orglines as $sjisline ) { |
| 7290 |
$line = mb_convert_encoding( $sjisline, 'UTF-8', 'SJIS' ); |
| 7291 |
list( $order_id, $atodene_number, $name, $amount, $billing_method, $atodene_results ) = explode( $sp, $line ); |
| 7292 |
if ( ! is_numeric( $order_id ) ) { |
| 7293 |
continue; |
| 7294 |
} |
| 7295 |
$order_data = $usces->get_order_data( $order_id, 'direct' ); |
| 7296 |
if ( $order_data ) { |
| 7297 |
$atodene_results = mb_convert_kana( $atodene_results, 'r', 'UTF-8' ); |
| 7298 |
if ( 'OK' === trim( $atodene_results ) ) { |
| 7299 |
$res = usces_change_order_receipt( (int) $order_id, 'receipted' ); |
| 7300 |
usces_action_acting_getpoint( (int) $order_id ); |
| 7301 |
} |
| 7302 |
if ( ! empty( $atodene_number ) ) { |
| 7303 |
$usces->set_order_meta_value( 'atodene_number', trim( $atodene_number ), (int) $order_id ); |
| 7304 |
} |
| 7305 |
if ( ! empty( $atodene_results ) ) { |
| 7306 |
$usces->set_order_meta_value( 'atodene_results', trim( $atodene_results ), (int) $order_id ); |
| 7307 |
} |
| 7308 |
} |
| 7309 |
} |
| 7310 |
unlink( $path . $file_name ); |
| 7311 |
|
| 7312 |
return $res; |
| 7313 |
} |
| 7314 |
|
| 7315 |
/** |
| 7316 |
* Temporary storage of session data. |
| 7317 |
* usces_filter_save_order_acting_data |
| 7318 |
* |
| 7319 |
* @param array $data Session data. |
| 7320 |
* @return array |
| 7321 |
*/ |
| 7322 |
public function save_order_acting_data( $data ) { |
| 7323 |
if ( isset( $_POST['_nonce'] ) ) { |
| 7324 |
$data['_nonce'] = filter_input( INPUT_POST, '_nonce' ); |
| 7325 |
} |
| 7326 |
return $data; |
| 7327 |
} |
| 7328 |
|
| 7329 |
/** |
| 7330 |
* Save admin log. |
| 7331 |
* |
| 7332 |
* @since 2.7.2 |
| 7333 |
* @see admin_ajax() |
| 7334 |
* @param integer $order_id The order id. |
| 7335 |
* @param string $log_key The log key. |
| 7336 |
* @return void |
| 7337 |
*/ |
| 7338 |
private function save_admin_log( $order_id, $log_key ) { |
| 7339 |
$latest_log = array(); |
| 7340 |
$log_data = $this->get_acting_history_log( $log_key ); |
| 7341 |
if ( ! empty( $log_data ) ) { |
| 7342 |
$latest_log = current( $log_data ); |
| 7343 |
} |
| 7344 |
|
| 7345 |
Logger::log( $order_id, 'orderedit', 'update', array( 'acting_welcart_card' => $latest_log ) ); |
| 7346 |
} |
| 7347 |
} |
| 7348 |
|