-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add ocbc digital payment * fix typo * add test for ocbc digital * update coverage info * resize ocbc pao image
- Loading branch information
Showing
14 changed files
with
244 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
namespace Omise\Payment\Model\Config; | ||
|
||
use Omise\Payment\Model\Config\Config; | ||
|
||
class OcbcDigital extends Config | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
const CODE = 'omise_offsite_ocbc_digital'; | ||
|
||
/** | ||
* Backends identifier | ||
* @var string | ||
*/ | ||
const ID = "mobile_banking_ocbc"; | ||
} |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
|
||
namespace Omise\Payment\Test\Unit; | ||
|
||
use Magento\Payment\Gateway\Data\OrderAdapterInterface; | ||
use Magento\Payment\Gateway\Data\PaymentDataObject; | ||
use Omise\Payment\Gateway\Request\APMBuilder; | ||
use Omise\Payment\Helper\OmiseHelper; | ||
use Omise\Payment\Helper\OmiseMoney; | ||
use Omise\Payment\Helper\ReturnUrlHelper; | ||
use Omise\Payment\Model\Capabilities; | ||
use Omise\Payment\Model\Config\Config; | ||
use Omise\Payment\Model\Config\OcbcDigital; | ||
use PHPUnit\Framework\TestCase; | ||
use Omise\Payment\Test\Mock\InfoMock; | ||
|
||
class OcbcDigitalAPMBuilderTest extends TestCase | ||
{ | ||
private $builder; | ||
private $helper; | ||
private $returnUrlHelper; | ||
private $config; | ||
private $capabilities; | ||
private $orderMock; | ||
private $infoMock; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->helper = $this->getMockBuilder(OmiseHelper::class)->disableOriginalConstructor()->getMock(); | ||
$this->returnUrlHelper = $this->getMockBuilder(ReturnUrlHelper::class)->disableOriginalConstructor()->getMock(); | ||
$this->config = $this->getMockBuilder(Config::class)->disableOriginalConstructor()->getMock(); | ||
$this->capabilities = $this->getMockBuilder(Capabilities::class)->disableOriginalConstructor()->getMock(); | ||
$this->orderMock = $this->getMockBuilder(OrderAdapterInterface::class)->getMock(); | ||
$this->infoMock = $this->getMockBuilder(InfoMock::class)->getMock(); | ||
} | ||
|
||
/** | ||
* @covers Omise\Payment\Gateway\Request\APMBuilder | ||
* @covers Omise\Payment\Model\Config\OcbcDigital | ||
*/ | ||
public function testApmBuilder() | ||
{ | ||
$this->infoMock->method('getMethod')->willReturn(OcbcDigital::CODE); | ||
$this->returnUrlHelper->method('create')->willReturn([ | ||
'url' => 'https://omise.co/complete', | ||
'token' => '1234' | ||
]); | ||
|
||
$this->builder = new APMBuilder( | ||
$this->helper, | ||
$this->returnUrlHelper, | ||
$this->config, | ||
$this->capabilities, | ||
new OmiseMoney(), | ||
); | ||
|
||
$result = $this->builder->build(['payment' => new PaymentDataObject( | ||
$this->orderMock, | ||
$this->infoMock | ||
)]); | ||
|
||
$this->assertEquals('mobile_banking_ocbc', $result['source']['type']); | ||
$this->assertEquals('https://omise.co/complete', $result['return_uri']); | ||
} | ||
|
||
/** | ||
* @covers Omise\Payment\Model\Config\OcbcDigital | ||
*/ | ||
public function testConstants() | ||
{ | ||
$this->assertEquals('omise_offsite_ocbc_digital', OcbcDigital::CODE); | ||
$this->assertEquals('mobile_banking_ocbc', OcbcDigital::ID); | ||
} | ||
} |
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions
33
view/frontend/web/js/view/payment/method-renderer/omise-offsite-ocbc-digital-method.js
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
define( | ||
[ | ||
'ko', | ||
'Omise_Payment/js/view/payment/omise-offsite-method-renderer', | ||
'Magento_Checkout/js/view/payment/default', | ||
'Magento_Checkout/js/model/quote', | ||
], | ||
function ( | ||
ko, | ||
Base, | ||
Component, | ||
quote | ||
) { | ||
'use strict'; | ||
|
||
return Component.extend(Base).extend({ | ||
defaults: { | ||
template: 'Omise_Payment/payment/offsite-common-form' | ||
}, | ||
|
||
isPlaceOrderActionAllowed: ko.observable(quote.billingAddress() != null), | ||
|
||
code: 'omise_offsite_ocbc_digital', | ||
restrictedToCurrencies: ['sgd'], | ||
logo: { | ||
file: "images/ocbc_digital.png", | ||
width: "80", | ||
height: "30", | ||
name: "ocbc_digital" | ||
} | ||
}); | ||
} | ||
); |
This file contains 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 characters