Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preparing release of v3.5.1 #459

Merged
merged 6 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
# Lines starting with '#' are comments.
# Each line is a file pattern followed by one or more owners.

# Order is important. The last matching pattern has the most precedence.
# So if a pull request only touches javascript files, only these owners
# will be requested to review.
# example: *.js @octocat @github/js

# These owners will be the default owners for everything in the repo.
* @aashishgurung @ajzkk
* @omise/maintainers
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## [v3.5.1 _(Nov, 24, 2023)_](https://github.com/omise/omise-magento/releases/tag/v3.5.1)
- Updated OCBC digital logo. (PR: [#457](https://github.com/omise/omise-magento/pull/457))
- Remove zero_interest_installments option from installment banks other than Maybank. (PR: [#458](https://github.com/omise/omise-magento/pull/458))

## [v3.5.0 _(Oct, 24, 2023)_](https://github.com/omise/omise-magento/releases/tag/v3.5.0)
- Added QR expires count down for promptpay. (PR: [#453](https://github.com/omise/omise-magento/pull/453))

Expand Down
3 changes: 1 addition & 2 deletions Gateway/Request/APMBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ public function build(array $buildSubject)
self::SOURCE_TYPE => $installmentId,
self::SOURCE_INSTALLMENT_TERMS => $method->getAdditionalInformation(
InstallmentDataAssignObserver::TERMS
),
self::ZERO_INTEREST_INSTALLMENTS => ('installment_mbb' === $installmentId)
)
];
break;
case Truemoney::CODE:
Expand Down
24 changes: 18 additions & 6 deletions Gateway/Request/PaymentDataBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Omise\Payment\Model\Config\Cc;
use Omise\Payment\Model\Config\Config;
use Omise\Payment\Block\Adminhtml\System\Config\Form\Field\Webhook;
use Omise\Payment\Model\Capabilities;

class PaymentDataBuilder implements BuilderInterface
{
Expand Down Expand Up @@ -53,14 +54,20 @@ class PaymentDataBuilder implements BuilderInterface
*/
private $money;

private $capabilities;

/**
* @param \Omise\Payment\Helper\OmiseHelper $omiseHelper
* @param Omise\Payment\Model\Config\Cc $ccConfig
*/
public function __construct(Cc $ccConfig, OmiseMoney $money)
{
public function __construct(
Cc $ccConfig,
OmiseMoney $money,
Capabilities $capabilities
) {
$this->money = $money;
$this->ccConfig = $ccConfig;
$this->capabilities = $capabilities;
}

/**
Expand Down Expand Up @@ -99,8 +106,9 @@ public function build(array $buildSubject)
$requestBody[self::WEBHOOKS_ENDPOINT] = [$webhookUrl];
}

if (Installment::CODE === $method->getMethod()) {
$requestBody[self::ZERO_INTEREST_INSTALLMENTS] = $this->isZeroInterestInstallment($method);
// Set zero_interest_installment to true for installment Maybank only
if ($this->enableZeroInterestInstallments($method)) {
$requestBody[self::ZERO_INTEREST_INSTALLMENTS] = true;
}

if (Cc::CODE === $method->getMethod()) {
Expand All @@ -110,9 +118,13 @@ public function build(array $buildSubject)
return $requestBody;
}

public function isZeroInterestInstallment($method)
/**
* Set zero_interest_installment to true for installment Maybank
*/
public function enableZeroInterestInstallments($method)
{
$isInstallment = Installment::CODE === $method->getMethod();
$installmentId = $method->getAdditionalInformation(InstallmentDataAssignObserver::OFFSITE);
return ('installment_mbb' === $installmentId);
return $isInstallment && (Installment::MBB_ID === $installmentId);
}
}
9 changes: 8 additions & 1 deletion Test/Unit/PaymentDataBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Magento\Store\Api\Data\StoreInterface;
use Omise\Payment\Model\Config\Installment;
use Omise\Payment\Model\Config\Promptpay;
use Omise\Payment\Model\Capabilities;

class PaymentDataBuilderTest extends TestCase
{
Expand All @@ -30,6 +31,7 @@ class PaymentDataBuilderTest extends TestCase
private $configMock;
private $storeManagerMock;
private $storeMock;
private $capabilities;

protected function setUp(): void
{
Expand All @@ -42,6 +44,7 @@ protected function setUp(): void
$this->orderMock = m::mock(OrderInterface::class);
$this->storeManagerMock = m::mock(StoreManagerInterface::class);
$this->storeMock = m::mock(StoreInterface::class);
$this->capabilities = m::mock(Capabilities::class);
}

/**
Expand Down Expand Up @@ -97,7 +100,11 @@ public function testBuild($paymentMethod, $expectedMetadata)
$this->paymentDataMock->shouldReceive('getOrder')->andReturn($this->orderMock);
$this->paymentDataMock->shouldReceive('getPayment')->andReturn($this->paymentMock);

$model = new PaymentDataBuilder($this->ccConfigMock, $this->omiseMoneyMock);
$model = new PaymentDataBuilder(
$this->ccConfigMock,
$this->omiseMoneyMock,
$this->capabilities
);
$result = $model->build(['payment' => $this->paymentDataMock]);

$this->assertEquals(100000, $result['amount']);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"email": "[email protected]"
}
],
"version": "3.5.0",
"version": "3.5.1",
"minimum-stability": "stable",
"type": "magento2-module",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Omise_Payment" setup_version="3.5.0">
<module name="Omise_Payment" setup_version="3.5.1">
<sequence>
<module name="Magento_Sales"/>
<module name="Magento_Payment"/>
Expand Down
7 changes: 1 addition & 6 deletions view/frontend/web/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,6 @@
background-size: contain;
}

/** MayBank **/
/* #omise_offsite_installmentForm .mbb {
background: #007bc4;
} */

#omise_offsite_installmentForm img.mbb {
background: url('../images/fpx-maybank.svg');
}
Expand All @@ -171,7 +166,7 @@ div.ocbc_pao {
}

div.ocbc_digital {
background-image: url('../images/ocbc_digital.png');
background-image: url('../images/ocbc_digital.svg');
width: 30px;
height: 30px;
float: right;
Expand Down
Binary file removed view/frontend/web/images/ocbc_digital.png
Binary file not shown.
1 change: 1 addition & 0 deletions view/frontend/web/images/ocbc_digital.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ define(
code: 'omise_offsite_ocbc_digital',
restrictedToCurrencies: ['sgd'],
logo: {
file: "images/ocbc_digital.png",
width: "80",
file: "images/ocbc_digital.svg",
width: "30",
height: "30",
name: "ocbc_digital"
}
Expand Down
Loading