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

Display Installment terms #196

Merged
merged 27 commits into from
Jun 7, 2019
Merged

Display Installment terms #196

merged 27 commits into from
Jun 7, 2019

Conversation

jacstn
Copy link
Contributor

@jacstn jacstn commented May 15, 2019

1. Objective

This PR added functionality to display installment terms.

2. Description of change

Hardcoded interest rates and monthly minimum payments have been added on a per-provider basis. The installment options presented to the customer at the checkout page have been modified to include monthly payment amounts and information/disclaimers about the interest rates. Payment options resulting in monthly payments below the defined minimums are automatically removed from those available for selection

image

3. Quality assurance

🔧 Environments:

  • Platform version: Magento CE 2.2.3.
  • Omise plugin version: Omise-Magento 2.7.
  • PHP version: 7.0.16.

✏️ Details:

To test this PR make payment with installment, observe if there are amounts properly displayed.
Check if minimum amounts are respected.

ie. If you choose order value for 3k THB than 12 months option should not be displayed, due to the minimum installment amount is not met in any provider.
More info about minimum installment amounts here

Check both options for absorbing rates by Merchant and Customer.

Check if TH translated texts regarding this functionality are displayed.

4. Impact of the change

N/A

5. Priority of change

High

6. Additional Notes

N/A

@jacstn jacstn force-pushed the 2-installment-amounts branch from c1cea3c to 7e3dedd Compare May 16, 2019 05:59
@jacstn jacstn requested review from jonrandy and guzzilar and removed request for jonrandy May 16, 2019 06:02
case 'bay': return 300;
case 'first_choice': return 300;
case 'ktc': return 300;
default: return NaN;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why defaulting to NaN? Won't this break stuff if a new instalment provider appears? Or are they hardcoded?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no new installment provider until we hardcode one.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And if they are hardcoded, this default is redundant?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default is good practice.. that is how they taught me during studies..
it is that you have covered everything.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but might delete that.. if omise has different rules.. @guzzilar

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getInstallmentMinimum(id) {
   return {kbank:500, bbl:500}[id] || 300;
}

Would be another way to go

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mater of taste.. IMHO code is more readable if I show all installment terms of all brands.
they also might be changed and must come from capabilities API.

case 'bay': return 0.008;
case 'first_choice': return 0.013;
case 'ktc': return 0.008;
default: return NaN;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is fixed, this default is to check when testing if everything works as expected, and data is displayed, otherwise would be NaN.
But actually that default will never affect anything as we hardcode stuff in .html
so if new provider will show up it will return NaN, but it will not be displayed anywhere in UI

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the default can be removed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are looking at outdated code @jonrandy

@jonrandy jonrandy self-requested a review May 28, 2019 09:34
@jonrandy
Copy link
Contributor

In the screenshot, the monthly amounts appear to be rounded to the nearest baht? This isn't right, surely?

@jonrandy jonrandy self-requested a review May 28, 2019 10:08
Copy link
Contributor

@jonrandy jonrandy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite a few magic numbers around that really belong in config files

Copy link
Contributor

@jonrandy jonrandy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See notes

@jacstn jacstn requested a review from jonrandy May 28, 2019 11:10
@jonrandy
Copy link
Contributor

jonrandy commented May 28, 2019 via email

@jonrandy
Copy link
Contributor

jonrandy commented May 28, 2019 via email

@jonrandy
Copy link
Contributor

jonrandy commented May 28, 2019 via email

@jacstn
Copy link
Contributor Author

jacstn commented May 28, 2019

so you say that hardcoding in php is better practice than hardcoding in js. why?

@jacstn jacstn requested a review from guzzilar May 29, 2019 06:53
Copy link
Contributor

@jonrandy jonrandy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is one currency formatting issue remaining

@jonrandy jonrandy self-requested a review June 7, 2019 04:40
Copy link
Contributor

@jonrandy jonrandy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's good to go now

Copy link
Contributor

@guzzilar guzzilar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 go go go

@jacstn jacstn merged commit fe3496d into master Jun 7, 2019
jacstn added a commit that referenced this pull request Jun 7, 2019
Better format of installment minimum amount message (Merge after #196)
@jacstn jacstn deleted the 2-installment-amounts branch June 7, 2019 12:13
@jacstn jacstn restored the 2-installment-amounts branch June 7, 2019 13:19
@jacstn jacstn deleted the 2-installment-amounts branch June 7, 2019 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants