Skip to content

Commit

Permalink
small refactoring, renamed function name, added missing comments, fix…
Browse files Browse the repository at this point in the history
…ed html labels

added comment to function

fixed labels
  • Loading branch information
jacstn committed Jan 10, 2019
1 parent 941259a commit 4e114c9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
7 changes: 6 additions & 1 deletion Model/Api/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ public function __construct() {
$this->capabilities = OmiseCapabilities::retrieve();
}

public function read() {
/**
* Get Installment capabilities array from Omise-PHP
*
* @return array
*/
public function getFromInstallments() {
return $this->capabilities->getBackends(
$this->capabilities->backendTypeIs('installment')
);
Expand Down
7 changes: 5 additions & 2 deletions Model/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ public function __construct(
$this->omise->defineApiKeys();
}

public function get() {
return $this->capabilitiesAPI->read();
/**
* @return array
*/
public function getFromInstallments() {
return $this->capabilitiesAPI->getFromInstallments();
}
}
2 changes: 1 addition & 1 deletion Model/Ui/CapabilitiesConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function getConfig()
foreach ($listOfActivePaymentMethods as $method) {
if ($method->getCode() === OmiseInstallmentConfig::CODE) {
return [
'capabilities' => $this->capabilities->get()
'capabilities' => $this->capabilities->getFromInstallments()
];
}
}
Expand Down
16 changes: 8 additions & 8 deletions view/frontend/web/template/payment/offsite-installment-form.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<span class="title" data-bind="i18n: 'Krungthai Card'"></span>
</div>
</label>
<select style="margin-top:10px" data-bind="options: getInstallmentTerms('ktc'),
<select id="omise_offsite_installment_ktc" style="margin-top:10px" data-bind="options: getInstallmentTerms('ktc'),
optionsText: item,
valueAllowUnset: true,
value: installmentTerms,
Expand All @@ -82,15 +82,15 @@
installmentTerms(null);
return true;
};" />
<label for="omise_offsite_installment_fc">
<label for="omise_offsite_installment_first_choice">
<div class="omise-logo-wrapper fc">
<img class="fc" />
</div>
<div class="omise-banking-text-wrapper">
<span class="title" data-bind="i18n: 'First Choice'"></span>
</div>
</label>
<select style="margin-top:10px" data-bind="options: getInstallmentTerms('first_choice'),
<select id="omise_offsite_installment_first_choice" style="margin-top:10px" data-bind="options: getInstallmentTerms('first_choice'),
optionsText: item;
valueAllowUnset: true,
value: installmentTerms,
Expand All @@ -117,7 +117,7 @@
<span class="title" data-bind="i18n: 'Kasikorn Bank'"></span>
</div>
</label>
<select style="margin-top:10px" data-bind="options: getInstallmentTerms('kbank'),
<select id="omise_offsite_installment_kbank" style="margin-top:10px" data-bind="options: getInstallmentTerms('kbank'),
optionsText: item,
valueAllowUnset: true,
value: installmentTerms,
Expand All @@ -137,15 +137,15 @@
installmentTerms(null);
return true;
};" />
<label for="omise_offsite_intstallment_bbl">
<label for="omise_offsite_installment_bbl">
<div class="omise-logo-wrapper bbl">
<img class="bbl" />
</div>
<div class="omise-banking-text-wrapper">
<span class="title" data-bind="i18n: 'Bangkok Bank'"></span>
</div>
</label>
<select style="margin-top:10px" data-bind="options: getInstallmentTerms('bbl'),
<select id="omise_offsite_installment_bbl" style="margin-top:10px" data-bind="options: getInstallmentTerms('bbl'),
optionsText: item,
valueAllowUnset:true,
value: installmentTerms,
Expand All @@ -163,15 +163,15 @@
installmentTerms(null);
return true;
};" />
<label for="omise_offsite_intstallment_bay">
<label for="omise_offsite_installment_bay">
<div class="omise-logo-wrapper bay">
<img class="bay" />
</div>
<div class="omise-banking-text-wrapper">
<span class="title" data-bind="i18n: 'Krungsri'"></span>
</div>
</label>
<select style="margin-top:10px" data-bind="options: getInstallmentTerms('bay'),
<select id="omise_offsite_installment_bay" style="margin-top:10px" data-bind="options: getInstallmentTerms('bay'),
optionsText: item,
valueAllowUnset:true,
value: installmentTerms,
Expand Down

0 comments on commit 4e114c9

Please sign in to comment.