Last active
July 18, 2025 11:50
-
-
Save vladutilie/b050f7e49ce10f2912b8c25eefd00cdf to your computer and use it in GitHub Desktop.
Revisions
-
vladutilie revised this gist
Jul 18, 2025 . 1 changed file with 4 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,8 +10,10 @@ function ( \Netopia_Payment_Request_Abstract $mobilpay_instance, int $order_id ) $amount = 123; // Amount based on some products from the $order. /** * The destination seller account (SAC) ID and the amount that will be transferred to that seller account. * The currency will always be that of the originating request. * * The rest of the amount will go in the Netopia main account. */ $netopia_instance->split->destinations = array( array( @@ -20,15 +22,7 @@ function ( \Netopia_Payment_Request_Abstract $mobilpay_instance, int $order_id ) ), ); error_log( print_r( array( 'amount_1' => $amount_1 ), true ) ); return $netopia_instance; }, -
vladutilie revised this gist
Jul 18, 2025 . 1 changed file with 7 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,28 +2,21 @@ add_filter( 'netopia_payment_request_params', function ( \Netopia_Payment_Request_Abstract $mobilpay_instance, int $order_id ) { require_once get_stylesheet_directory() . '/inc/classes/class-netopia-payment-split.php'; $netopia_instance->split = new Inc\Classes\Netopia_Payment_Split(); $order = wc_get_order( $order_id ); $amount = 123; // Amount based on some products from the $order. /** * The destination seller account ID and the amount that will be transferred to that seller account. * The currency will always be that of the originating request. */ $netopia_instance->split->destinations = array( array( 'id' => 'netopia-sac-id', 'amount' => $amount / 100, ), ); @@ -37,7 +30,7 @@ function ( \Netopia_Payment_Request_Abstract $mobilpay_instance, int $order_id ) ) ); return $netopia_instance; }, 10, 2 -
vladutilie revised this gist
Jul 18, 2025 . No changes.There are no files selected for viewing
-
vladutilie revised this gist
Jul 7, 2025 . No changes.There are no files selected for viewing
-
vladutilie created this gist
Jul 7, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ <?php add_filter( 'netopia_payment_request_params', function ( \Netopia_Payment_Request_Abstract $mobilpay_instance, int $order_id ) { require_once get_stylesheet_directory() . '/inc/classes/Split.php'; $mobilpay_instance->split = new Inc\Classes\Mobilpay_Payment_Split(); $order = wc_get_order( $order_id ); $percent = 0.15; // Split the payment by 15%. $total = round( $order->get_total() * 100 ); $amount_1 = round( $total * $percent ); $amount_2 = $total - $amount_1; /** * The destination seller account ID and the amount that will be transferred to that seller account. * The currency will always be that of the originating request. */ $mobilpay_instance->split->destinations = array( array( 'id' => 'netopia-merchant-1-id', 'amount' => $amount_1 / 100, ), array( 'id' => 'netopia-merchant-2-id', 'amount' => $amount_2 / 100, ), ); error_log( print_r( array( 'amount_1' => $amount_1, 'amount_2' => $amount_2, ), true ) ); return $mobilpay_instance; }, 10, 2 );