Changeset 3199420
- Timestamp:
- 11/29/2024 12:10:04 PM (16 months ago)
- Location:
- payaza/trunk
- Files:
-
- 3 edited
-
includes/class-wc-gateway-payaza.php (modified) (2 diffs)
-
payaza.php (modified) (2 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
payaza/trunk/includes/class-wc-gateway-payaza.php
r3185786 r3199420 337 337 'default' => '', 338 338 ), 339 'autocomplete_order' => array(340 'title' => __( 'Autocomplete Order After Payment', 'woo-payaza' ),341 'label' => __( 'Autocomplete Order', 'woo-payaza' ),342 'type' => 'checkbox',343 'class' => 'wc-payaza-autocomplete-order',344 'description' => __( 'If enabled, the order will be marked as complete after successful payment', 'woo-payaza' ),345 'default' => 'no',346 'desc_tip' => true,347 ),339 //'autocomplete_order' => array( 340 // 'title' => __( 'Autocomplete Order After Payment', 'woo-payaza' ), 341 // 'label' => __( 'Autocomplete Order', 'woo-payaza' ), 342 // 'type' => 'checkbox', 343 // 'class' => 'wc-payaza-autocomplete-order', 344 // 'description' => __( 'If enabled, the order will be marked as complete after successful payment', 'woo-payaza' ), 345 // 'default' => 'no', 346 // 'desc_tip' => true, 347 //), 348 348 'remove_cancel_order_button' => array( 349 349 'title' => __( 'Remove Cancel Order & Restore Cart Button', 'woo-payaza' ), … … 429 429 'connection_mode' => $this->testmode ? 'Test' : 'Live', 430 430 ); 431 432 $email = $order->get_billing_email(); 433 $first_name = $order->get_billing_first_name(); 434 $last_name = $order->get_billing_last_name(); 435 $phone_number = $order->get_billing_phone(); 436 $amount = $order->get_total() * 100; 437 $txnref = $order_id . '_' . time(); 438 $the_order_id = $order->get_id(); 439 $the_order_key = $order->get_order_key(); 440 $currency = $order->get_currency(); 441 442 if ( $the_order_id == $order_id && $the_order_key == $order_key ) { 443 $payaza_params['email'] = $email; 444 $payaza_params['first_name'] = $first_name; 445 $payaza_params['last_name'] = $last_name; 446 $payaza_params['phone_number'] = $phone_number; 447 $payaza_params['amount'] = absint( $amount ); 448 $payaza_params['txnref'] = $txnref; 449 $payaza_params['currency'] = $currency; 450 } 431 if ( is_checkout_pay_page() && get_query_var( 'order-pay' ) ) { 432 433 $email = $order->get_billing_email(); 434 $first_name = $order->get_billing_first_name(); 435 $last_name = $order->get_billing_last_name(); 436 $phone_number = $order->get_billing_phone(); 437 $amount = $order->get_total() * 100; 438 $txnref = $order_id . '_' . time(); 439 $the_order_id = $order->get_id(); 440 $the_order_key = $order->get_order_key(); 441 $currency = $order->get_currency(); 442 443 444 445 if ( $the_order_id == $order_id && $the_order_key == $order_key ) { 446 447 $payaza_params['email'] = $email; 448 $payaza_params['first_name'] = $first_name; 449 $payaza_params['last_name'] = $last_name; 450 $payaza_params['phone_number'] = $phone_number; 451 $payaza_params['amount'] = $amount; 452 $payaza_params['txnref'] = $txnref; 453 $payaza_params['currency'] = $currency; 454 455 456 457 } 458 459 // $email = $order->get_billing_email(); 460 // $first_name = $order->get_billing_first_name(); 461 // $last_name = $order->get_billing_last_name(); 462 // $phone_number = $order->get_billing_phone(); 463 // $amount = $order->get_total() * 100; 464 // $txnref = $order_id . '_' . time(); 465 // $the_order_id = $order->get_id(); 466 // $the_order_key = $order->get_order_key(); 467 // $currency = $order->get_currency(); 468 469 // if ( $the_order_id == $order_id && $the_order_key == $order_key ) { 470 // $payaza_params['email'] = $email; 471 // $payaza_params['first_name'] = $first_name; 472 // $payaza_params['last_name'] = $last_name; 473 // $payaza_params['phone_number'] = $phone_number; 474 // $payaza_params['amount'] = absint( $amount ); 475 // $payaza_params['txnref'] = $txnref; 476 // $payaza_params['currency'] = $currency; 477 // } 451 478 452 479 update_post_meta( $order_id, '_payaza_txn_ref', $txnref ); 453 $order->save(); 454 480 } 455 481 wp_localize_script( 'wc_payaza', 'wc_payaza_params', $payaza_params ); 456 482 457 483 // Simulate payment success for testing. Replace with actual payment success check. 458 $payment_success = true;459 460 if ( $payment_success ) {461 $order->payment_complete( $txnref );462 $order->add_order_note( sprintf( __( 'Payment via Payaza successful (Transaction Reference: %s)', 'woo-payaza' ), $txnref ) );463 464 if ( $this->is_autocomplete_order_enabled( $order ) ) {465 $order->update_status( 'completed' );466 }467 WC()->cart->empty_cart();468 function_exists( 'wc_reduce_stock_levels' ) ? wc_reduce_stock_levels( $order_id ) : $order->reduce_order_stock();469 } else {470 $order->update_status( 'on-hold', __( 'Payment is pending. Please confirm payment with Payaza.', 'woo-payaza' ) );471 }484 //$payment_success = true; 485 486 //if ( $payment_success ) { 487 // $order->payment_complete( $txnref ); 488 // $order->add_order_note( sprintf( __( 'Payment via Payaza successful (Transaction Reference: %s)', 'woo-payaza' ), $txnref ) ); 489 490 // if ( $this->is_autocomplete_order_enabled( $order ) ) { 491 // $order->update_status( 'completed' ); 492 //} 493 // WC()->cart->empty_cart(); 494 // function_exists( 'wc_reduce_stock_levels' ) ? wc_reduce_stock_levels( $order_id ) : $order->reduce_order_stock(); 495 //} else { 496 // $order->update_status( 'on-hold', __( 'Payment is pending. Please confirm payment with Payaza.', 'woo-payaza' ) ); 497 //} 472 498 473 499 // Redirect to the WooCommerce "Thank You" page 474 return array(475 'result' => 'success',476 'redirect' => $order->get_checkout_payment_url(true),477 );500 //return array( 501 // 'result' => 'success', 502 // 'redirect' => $order->get_checkout_payment_url(true), 503 //); 478 504 } 479 505 -
payaza/trunk/payaza.php
r3185789 r3199420 4 4 * Plugin URI: https://payaza.africa 5 5 * Description: WooCommerce checkout 6 * Version: 0.2. 66 * Version: 0.2.7 7 7 * Author: Okenwa Kevin Ikwan 8 8 * License: GPL-2.0+ … … 25 25 define( 'WC_PAYAZA_URL', untrailingslashit( plugins_url( '/', __FILE__ ) ) ); 26 26 27 define( 'WC_PAYAZA_VERSION', '0.2. 6' );27 define( 'WC_PAYAZA_VERSION', '0.2.7' ); 28 28 29 29 /** -
payaza/trunk/readme.txt
r3185789 r3199420 2 2 Contributors: okenwa500 3 3 Tags: payaza, woocommerce, payment gateway,supports all currency 4 Stable tag: 0.2. 64 Stable tag: 0.2.7 5 5 Requires at least: 6.2 6 6 Tested up to: 6.6
Note: See TracChangeset
for help on using the changeset viewer.