Skip to content

Commit

Permalink
Merge pull request #128 from Worldpay/release-v2.4.7-rc0124-beta2
Browse files Browse the repository at this point in the history
2.4.7-beta2 CS fixes
  • Loading branch information
chandan-PS authored Feb 6, 2024
2 parents 95ed750 + 788b4c2 commit 2dbe832
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 42 deletions.
1 change: 0 additions & 1 deletion Block/Adminhtml/System/Config/CsePopup.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ protected function _getElementHtml(AbstractElement $element)
return $this->_toHtml();
}
}
?>
4 changes: 2 additions & 2 deletions Block/Recurring/Customer/Subscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,6 @@ public function getMyAccountSpecificException($exceptioncode)
public function getNextRecurringOrder($subscriptionId)
{
$customerId = $this->customerSession->getCustomerId();
return $this->recurringHelper->getNextRecurringOrder($subscriptionId,$customerId);
return $this->recurringHelper->getNextRecurringOrder($subscriptionId, $customerId);
}
}
}
6 changes: 3 additions & 3 deletions Block/Recurring/Customer/Subscriptions/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ public function getNextRecurringOrder()
{
$subscriptionId = $this->getSubscription()->getId();
$customerId = $this->customerSession->getCustomerId();
return $this->recurringHelper->getNextRecurringOrder($subscriptionId,$customerId);
return $this->recurringHelper->getNextRecurringOrder($subscriptionId, $customerId);
}

/**
Expand All @@ -398,7 +398,7 @@ public function getNextOrderDate()
}

/**
* Get recurring count
* Get recurring count
*
* @return int
*/
Expand All @@ -410,5 +410,5 @@ public function getRecurringOrderCollection()
->addFieldToFilter('status', ['eq' =>'completed']);

return $subscriptionCount->getSize();
}
}
}
2 changes: 1 addition & 1 deletion Controller/Recurring/Order/Skiporders.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ public function execute()
}
return $this->resultPageFactory->create();
}
}
}
26 changes: 13 additions & 13 deletions Cron/RecurringOrdersEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,17 +164,17 @@ public function getTotalDetails($recurringOrderData)
* @param Int $customerId
*/

public function getTokenInfo($tokenId, $customerId)
{
$curdate = date("Y-m-d");
if ($tokenId) {
$result = $this->worldpaytoken->getCollection()
->addFieldToFilter('id', ['eq' => trim($tokenId)])
->addFieldToFilter('customer_id', ['eq' => trim($customerId)])
->addFieldToFilter('token_expiry_date', ['gteq' => $curdate])->getData();
return $result;
}
}
public function getTokenInfo($tokenId, $customerId)
{
$curdate = date("Y-m-d");
if ($tokenId) {
$result = $this->worldpaytoken->getCollection()
->addFieldToFilter('id', ['eq' => trim($tokenId)])
->addFieldToFilter('customer_id', ['eq' => trim($customerId)])
->addFieldToFilter('token_expiry_date', ['gteq' => $curdate])->getData();
return $result;
}
}
/**
* Get SubscriptionsInfo
*
Expand Down Expand Up @@ -219,13 +219,13 @@ public function getCartExpiryMessage($totalInfo)
$currentMonth = date("m") + 1;
$currentYear = date("Y");

$expiryMonth = sprintf("%02d",$totalInfo['tokenData'][0]['card_expiry_month']);
$expiryMonth = sprintf("%02d", $totalInfo['tokenData'][0]['card_expiry_month']);
$expiryYear = $totalInfo['tokenData'][0]['card_expiry_year'];
$expiry = date($expiryYear.'-'.$expiryMonth.'-01');

if ($expiry < $currentDate) {
$expiredMsg = 'Your card is expired. Plese add/update card details.';
} else if ($expiryYear === $currentYear && $expiryMonth == $currentMonth) {
} elseif ($expiryYear === $currentYear && $expiryMonth == $currentMonth) {
$expiredMsg = 'Your card is going to expire, please check the card or update the card details';
}
}
Expand Down
8 changes: 4 additions & 4 deletions Helper/Recurring.php
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,7 @@ public function getRecurringOrderReminderEmail()
* @param int $orderId
*/
public function getOrderDetails($orderId)
{
{
$order = $this->orderRepository->get($orderId);
$billingAddress = $order->getBillingAddress()->getData();
$formattedShippingAddress = '';
Expand Down Expand Up @@ -1195,9 +1195,9 @@ public function getFormatAddressByCode($address)
* @param int $customerId
* @return array
*/
public function getNextRecurringOrder($subscriptionId,$customerId)
public function getNextRecurringOrder($subscriptionId, $customerId)
{
$nextOrder = $this->getNextRecurringOrderCollection($subscriptionId,$customerId);
$nextOrder = $this->getNextRecurringOrderCollection($subscriptionId, $customerId);
if (!empty($nextOrder)) {
$curdate = date("Y-m-d");
$skipDays = self::RECURRING_ORDER_SKIP_DAYS_UPTO;
Expand All @@ -1219,7 +1219,7 @@ public function getNextRecurringOrder($subscriptionId,$customerId)
* @param int $customerId
* @return array
*/
public function getNextRecurringOrderCollection($subscriptionId,$customerId)
public function getNextRecurringOrderCollection($subscriptionId, $customerId)
{
$curdate = date("Y-m-d");
$collection = $this->transactionCollectionFactory->getCollection()
Expand Down
6 changes: 4 additions & 2 deletions Model/ResourceModel/SkipSubscriptionOrder/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ public function joinPlans($cols = \Magento\Framework\DB\Select::SQL_WILDCARD)
$this->getSelect()->joinLeft(
['plans' => 'worldpay_recurring_plans'],
'plans.plan_id = subscriptions.plan_id',
$cols );
$cols
);
$this->plansJoined = true;

return $this;
Expand All @@ -86,7 +87,8 @@ public function joinSubscriptions($cols = \Magento\Framework\DB\Select::SQL_WILD
$this->getSelect()->joinLeft(
['subscriptions' => 'worldpay_subscriptions'],
'subscriptions.subscription_id = main_table.subscription_id',
$cols );
$cols
);
$this->subscriptionsJoined = true;

return $this;
Expand Down
17 changes: 9 additions & 8 deletions Model/ResourceModel/SubscriptionOrder/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ protected function _construct()
}

/**
* Filter collection by customer id
*
* @param int $customerId
* @return $this
*/
* Filter collection by customer id
*
* @param int $customerId
* @return $this
*/
public function addCustomerIdFilter($customerId)
{
if ($customerId) {
Expand All @@ -68,7 +68,8 @@ public function joinPlans($cols = \Magento\Framework\DB\Select::SQL_WILDCARD)
$this->getSelect()->joinLeft(
['plans' => 'worldpay_recurring_plans'],
'plans.plan_id = main_table.plan_id',
$cols );
$cols
);
$this->plansJoined = true;

return $this;
Expand All @@ -88,10 +89,10 @@ public function joinSubscriptions($cols = \Magento\Framework\DB\Select::SQL_WILD
$this->getSelect()->joinLeft(
['subscriptions' => 'worldpay_subscriptions'],
'subscriptions.subscription_id = main_table.subscription_id',
$cols );
$cols
);
$this->subscriptionsJoined = true;

return $this;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<?= /* @noEscape */ __('Upcoming Delivery') ?>
</span>
<?php endif; ?>
<?php if($block->getRecurringOrderCollection() > 0 ): ?>
<?php if ($block->getRecurringOrderCollection() > 0): ?>
<a href="<?= /* @noEscape */ $block->getViewAllRecurringOrder() ?>"
class="action" rel="noopener">
<span><?= /* @noEscape */ __('View All Recurring Order') ?></span>
Expand All @@ -48,7 +48,7 @@
<div class="">
<legend class="legend">
<span><?= /* @noEscape */ $block->getMyAccountLabels('AC25') ?></span>
<?php if($block->getRecurringOrderCollection() > 0 ): ?>
<?php if ($block->getRecurringOrderCollection() > 0): ?>
<a href="<?= /* @noEscape */ $block->getViewAllRecurringOrder() ?>"
class="action all-recurring-order-desktop"
rel="noopener">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@
class="action delete"><span><?= /* @noEscape */ $block->getMyAccountLabels('AC23') ?>
</span></a>
<?php endif; ?>
<?php
<?php
$subscriptionId = $subscription->getSubscriptionId();
$nextOrder = $block->getNextRecurringOrder($subscriptionId);
if (!empty($nextOrder)) { ?>
if (!empty($nextOrder)) { ?>
<div class="upcoming-delivery">
<?= /* @noEscape */ __('Upcoming Delivery') ?>
<?= /* @noEscape */ $nextOrder->getRecurringDate() ?>
Expand Down
4 changes: 2 additions & 2 deletions view/frontend/templates/recurring/order/skiporders.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@
<div>
<select name="status" title="Order Status" onchange="location= this.value;" >
<option value="<?= $block->escapeUrl($block->getOrderFilterURL('m-6')) ?>"
<?php if($block->checkSelectedFilter('m-6')): ?>
<?php if ($block->checkSelectedFilter('m-6')): ?>
<?= /* @noEscape */ $escaper->escapeHtml('selected') ?>
<?php endif ?> >
<?= /* @noEscape */ $escaper->escapeHtml('6 Month') ?>
</option>
<option value="<?= $block->escapeUrl($block->getOrderFilterURL('y-'.date("Y"))) ?>"
<?php if($block->checkSelectedFilter('y-'.date("Y"))): ?>
<?php if ($block->checkSelectedFilter('y-'.date("Y"))): ?>
<?= /* @noEscape */ $escaper->escapeHtml('selected') ?>
<?php endif ?> >
<?= /* @noEscape */ $escaper->escapeHtml(date("Y")) ?>
Expand Down
4 changes: 2 additions & 2 deletions view/frontend/templates/recurring/order/view.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
<div>
<select name="status" title="Order Status" onchange="location= this.value;" >
<option value="<?= $block->escapeUrl($block->getOrderFilterURL('m-6')) ?>"
<?php if($block->checkSelectedFilter('m-6')): ?>
<?php if ($block->checkSelectedFilter('m-6')): ?>
<?= /* @noEscape */ $escaper->escapeHtml('selected') ?>
<?php endif ?> >
<?= /* @noEscape */ $escaper->escapeHtml('6 Month') ?>
</option>
<option value="<?= $block->escapeUrl($block->getOrderFilterURL('y-'.date("Y"))) ?>"
<?php if($block->checkSelectedFilter('y-'.date("Y"))): ?>
<?php if ($block->checkSelectedFilter('y-'.date("Y"))): ?>
<?= /* @noEscape */ $escaper->escapeHtml('selected') ?>
<?php endif ?> >
<?= /* @noEscape */ $escaper->escapeHtml(date("Y")) ?>
Expand Down

0 comments on commit 2dbe832

Please sign in to comment.