Skip to content

Commit

Permalink
phpcs fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel217D committed Dec 29, 2023
1 parent 7007816 commit 4425989
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 27 deletions.
8 changes: 4 additions & 4 deletions includes/Actions/Subscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,10 @@ public function scheduled_subscription_payment( float $amount_to_charge, WC_Orde
throw new Exception( $result->get_error_message(), $result->get_error_code() );
}

// Fix for subscriptions can create the invoice
sleep(5);
if($renewal_order->get_status() == 'pending'){
sleep(5);
// Fix for subscriptions can create the invoice.
sleep( 5 );
if ( $renewal_order->get_status() === 'pending' ) {
sleep( 5 );
}

// Instant settle.
Expand Down
19 changes: 9 additions & 10 deletions includes/Admin/MetaBoxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,11 @@ public function add_meta_boxes() {
? wc_get_page_screen_id( 'shop-order' )
: 'shop_order';

$order_id = !empty($_GET['id']) ? $_GET['id'] : $_GET['post'];
$order = wc_get_order( $order_id );
if($order){
$order_id = ! empty( $_REQUEST['id'] ) ? $_REQUEST['id'] : 0;
$order = wc_get_order( $order_id );
if ( $order ) {
$order_data = $order->get_data();


if ( empty( $order ) || ! rp_is_order_paid_via_reepay( $order ) ) {
return;
}
Expand Down Expand Up @@ -127,12 +126,12 @@ public function generate_meta_box_content_customer( $x, array $meta ) {
* @var WC_Order $order
* @var ReepayCheckout $gateway
*/
$order = $meta['args']['order'];
$order = $meta['args']['order'];
$order_data = $order->get_data();

if ( ! empty( $order->get_meta( '_reepay_order' ) ) && 0 !== $order_data['parent_id'] ) {
$parent_order = wc_get_order( $order_data['parent_id'] );
$handle = $parent_order->get_meta('_reepay_customer');
$handle = $parent_order->get_meta( '_reepay_customer' );
} else {
$handle = $order->get_meta( '_reepay_customer' );
}
Expand Down Expand Up @@ -209,14 +208,14 @@ public function generate_meta_box_content_subscription( $x, array $meta ) {
* @var WC_Order $order
* @var ReepayCheckout $gateway
*/
$order = $meta['args']['order'];
$gateway = $meta['args']['gateway'];
$order = $meta['args']['order'];
$gateway = $meta['args']['gateway'];
$order_data = $order->get_data();

if ( ! empty( $order->get_meta( '_reepay_order' ) ) && 0 !== $order_data['parent_id'] ) {
$parent_order = wc_get_order( $order_data['parent_id'] );
$handle = $parent_order->get_meta( '_reepay_subscription_handle' );
$plan = $parent_order->get_meta( '_reepay_subscription_plan' );
$handle = $parent_order->get_meta( '_reepay_subscription_handle' );
$plan = $parent_order->get_meta( '_reepay_subscription_plan' );
} elseif ( $order->get_meta( '_reepay_renewal' ) ) {
$handle = $order->get_meta( '_reepay_subscription_handle_parent' );
$plan = $order->get_meta( '_reepay_subscription_plan' );
Expand Down
2 changes: 1 addition & 1 deletion includes/Gateways/ReepayCheckout.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function __construct() {
$this->payment_methods = $this->settings['payment_methods'] ?: $this->payment_methods;
$this->skip_order_lines = $this->settings['skip_order_lines'] ?: $this->skip_order_lines;
$this->failed_webhooks_email = $this->settings['failed_webhooks_email'] ?: $this->failed_webhooks_email;
$this->handle_failover = !empty($this->settings['handle_failover']) ?: $this->handle_failover;
$this->handle_failover = ! empty( $this->settings['handle_failover'] ) ?: $this->handle_failover;

if ( 'yes' === $this->save_cc ) {
$this->supports[] = 'add_payment_method';
Expand Down
2 changes: 1 addition & 1 deletion includes/Gateways/ReepayGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ public function process_payment( $order_id ) {
);
}

$have_sub = (class_exists( WC_Reepay_Renewals::class ) && WC_Reepay_Renewals::is_order_contain_subscription( $order )) || wcs_cart_have_subscription();
$have_sub = ( class_exists( WC_Reepay_Renewals::class ) && WC_Reepay_Renewals::is_order_contain_subscription( $order ) ) || wcs_cart_have_subscription();

$only_items_lines = array();

Expand Down
4 changes: 2 additions & 2 deletions includes/OrderFlow/Webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ public function process( array $data ) {
if ( $order && order_contains_subscription( $order ) ) {
WC_Subscriptions_Manager::activate_subscriptions_for_order( $order );

if(! empty( $data['payment_method'] )){
if ( ! empty( $data['payment_method'] ) ) {
try {
$token = ReepayTokens::reepay_save_token( $order, $data['payment_method'] );
ReepayTokens::assign_payment_token( $order, $token );
Expand Down Expand Up @@ -514,7 +514,7 @@ private static function unlock_order( $order_id ) {
private static function wait_for_unlock( int $order_id ): bool {
set_time_limit( 0 );

$order = wc_get_order( $order_id );
$order = wc_get_order( $order_id );
$is_locked = (bool) $order->get_meta( '_reepay_locked' );
$needs_reload = false;
$attempts = 0;
Expand Down
1 change: 0 additions & 1 deletion includes/Tokens/ReepayTokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public static function assign_payment_token( WC_Order $order, $token ) {

if ( $token->get_id() ) {


// Reload order.
$order = wc_get_order( $order->get_id() );
// Delete tokens if exist.
Expand Down
16 changes: 8 additions & 8 deletions templates/meta-boxes/invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
?>

<ul class="order_action order_action_reepay_subscriotions clearfix">
<input type="hidden" id="reepay_order_id" data-order-id="<?php echo $order_id ?>"/>
<input type="hidden" id="reepay_order_total_authorized" value="<?php echo $order_data['authorized_amount'] ?>"/>
<input type="hidden" id="reepay_order_total_settled" value="<?php echo $order_data['settled_amount'] ?>"/>
<input type="hidden" id="reepay_order_total" data-order-total="<?php echo $order->get_total() ?>" value="<?php echo $order->get_total() . ' ' . get_woocommerce_currency_symbol($order->get_currency()); ?>"/>
<input type="hidden" id="reepay_order_id" data-order-id="<?php echo $order_id; ?>"/>
<input type="hidden" id="reepay_order_total_authorized" value="<?php echo $order_data['authorized_amount']; ?>"/>
<input type="hidden" id="reepay_order_total_settled" value="<?php echo $order_data['settled_amount']; ?>"/>
<input type="hidden" id="reepay_order_total" data-order-total="<?php echo $order->get_total(); ?>" value="<?php echo $order->get_total() . ' ' . get_woocommerce_currency_symbol( $order->get_currency() ); ?>"/>
<li class="reepay-admin-section-li-header-small">
<?php echo __( 'Invoice handle', 'reepay-subscriptions-for-woocommerce' ); ?>
</li>
Expand Down Expand Up @@ -74,7 +74,7 @@ class="reepay-admin-card-logo"/>
<span class='reepay-balance__currency'>
&nbsp;
</span>
<?php echo $order_data['authorized_amount'] ? rp_make_initial_amount( $order_data['authorized_amount'] - $order_data['settled_amount'], $order_data['currency'] ) . ' ' . get_woocommerce_currency_symbol($order->get_currency()) : $order_data['authorized_amount'] . ' ' . get_woocommerce_currency_symbol($order->get_currency()); ?>
<?php echo $order_data['authorized_amount'] ? rp_make_initial_amount( $order_data['authorized_amount'] - $order_data['settled_amount'], $order_data['currency'] ) . ' ' . get_woocommerce_currency_symbol( $order->get_currency() ) : $order_data['authorized_amount'] . ' ' . get_woocommerce_currency_symbol( $order->get_currency() ); ?>
</span>
</li>
<li class="reepay-admin-section-li">
Expand All @@ -85,7 +85,7 @@ class="reepay-admin-card-logo"/>
<span class='reepay-balance__currency'>
&nbsp;
</span>
<?php echo rp_make_initial_amount( $order_data['authorized_amount'], $order_data['currency'] ) . ' ' . get_woocommerce_currency_symbol($order->get_currency()); ?>
<?php echo rp_make_initial_amount( $order_data['authorized_amount'], $order_data['currency'] ) . ' ' . get_woocommerce_currency_symbol( $order->get_currency() ); ?>
</span>
</li>

Expand All @@ -97,7 +97,7 @@ class="reepay-admin-card-logo"/>
<span class='reepay-balance__currency'>
&nbsp;
</span>
<?php echo rp_make_initial_amount( $order_data['settled_amount'], $order_data['currency'] ) . ' ' . get_woocommerce_currency_symbol($order->get_currency()); ?>
<?php echo rp_make_initial_amount( $order_data['settled_amount'], $order_data['currency'] ) . ' ' . get_woocommerce_currency_symbol( $order->get_currency() ); ?>
</span>
</li>
<li class="reepay-admin-section-li">
Expand All @@ -108,7 +108,7 @@ class="reepay-admin-card-logo"/>
<span class='reepay-balance__currency'>
&nbsp;
</span>
<?php echo rp_make_initial_amount( $order_data['refunded_amount'], $order_data['currency'] ) . ' ' . get_woocommerce_currency_symbol($order->get_currency()); ?>
<?php echo rp_make_initial_amount( $order_data['refunded_amount'], $order_data['currency'] ) . ' ' . get_woocommerce_currency_symbol( $order->get_currency() ); ?>
</span>
</li>

Expand Down

0 comments on commit 4425989

Please sign in to comment.