- Bonus for new users
- Bonus for existing accounts
- Accounts in first term
- Existing accounts in final term
- Usage
- Release process
- License
Calculator.run(regularPayment = 50.0) // Must be between 1 and 50)
Calculator().run(regularPayment: 50.0) // Must be between 1 and 50)
Calculator.run(
regularPayment = 50.0, // Must be between 1 and 50
currentBalance = 100.0,
currentPeriod1Bonus = 50.0,
currentPeriod2Bonus = 0.0,
accountStartDate = DateTime()
)
Calculator().run(
regularPayment: 50.0, // Must be between 1 and 50
currentBalance: 100.0,
currentPeriod1Bonus: 50.0,
currentPeriod2Bonus: 0.0,
accountStartDate: Date()
)
This will return an object of type CalculatorResponse
. This provides headline figures that are the results at the end of the scheme. However, if a monthly breakdown is needed a cumulative breakdown is provided in monthlyBreakdown
monthlyPayments: Double
monthlyBreakdown: List<MonthlyBreakdown>
monthNumber: Int
savingsToDate: Double
period1Bonus: Double
period2Bonus: Double
bonusToDate: Double
endOfSchemeBonus: Double
endOfSchemeSavings: Double
endOfSchemeTotal: Double
endOfPeriod1Bonus: Double
endOfPeriod1Savings: Double
endOfPeriod1Total: Double
endOfPeriod2Bonus: Double
endOfPeriod2Savings: Double
endOfPeriod2Total: Double
FirstBonusTermCalculator.runFirstBonusCalculator(input)
FirstBonusTermCalculator().runFirstBonusCalculator(input)
Where input
is of the type FirstBonusInput
with the following parameters:
regularPayment: Double, // 25.0
currentBalance: Double, // 25.0
paidInThisMonth: Double, // 50.0
thisMonthEndDate: YearMonthDayInput, // YearMonthDayInput(2020, 3, 31)
firstTermEndDate: YearMonthDayInput, // YearMonthDayInput(2022, 2, 28)
secondTermEndDate: YearMonthDayInput, // YearMonthDayInput(2024, 2, 28)
balanceMustBeMoreThanForBonus: Double // 50.0
This will returns an object of type FirstBonusCalculatorResponse
.
totalProjectedSavingsIncludingBonuses: Double
totalProjectedSavings: Double
totalProjectedBonuses: Double
projectedSavingsFirstBonusPeriod: Double
projectedFirstBonus: Double
projectedAdditionalSavingsFinalBonusPeriod: Double
projectedFinalBonus: Double
FinalBonusTermCalculator.runFinalBonusCalculator(input)
Where input
is of the type FinalBonusInput
with the following parameters:
regularPayment: Double, // 25.0
currentBalance: Double, // 25.0
paidInThisMonth: Double, // 50.0
canPayInThisMonth: Double, // 0.0
thisMonthEndDate: YearMonthDayInput, // YearMonthDayInput(2022, 3, 31)
secondTermEndDate: YearMonthDayInput, // YearMonthDayInput(2024, 2, 28)
balanceMustBeMoreThanForBonus: Double, // 50.0
secondTermBonusEstimate: Double // 25.0
This will returns an object of type FinalBonusCalculatorResponse
.
totalProjectedSavingsIncludingBonuses: Double
totalProjectedSavings: Double
totalProjectedBonuses: Double
finalBonusStatus: FinalBonusStatus
To validate the monthly contributions:
val isValidRegularPayments = RegularPaymentValidators.isValidRegularPayments(1000.0) // true
val isAboveMinimumRegularPayments = RegularPaymentValidators.isAboveMinimumRegularPayments(0.0) // false
val isBelowMaximumRegularPayments = RegularPaymentValidators.isBelowMaximumRegularPayments(50.0) // true
Because this operates as a closed source, binary dependency, Swift PM will only work with tagged releases and not branches.
https://github.com/hmrc/help-to-save-kalculator
- If the framework is downloaded and linked in the project, it'll be necessary to strip unwanted architectures in a build step.
- For example, you may want to implement something like this.
Add the Github Package repository to your top-level build.gradle
, along with a Github username and access token (no permissions required).
repositories {
maven {
url = "https://maven.pkg.github.com/hmrc/help-to-save-kalculator"
credentials {
username = System.getenv("GITHUB_USER_NAME")
password = System.getenv("GITHUB_TOKEN")
}
}
}
Add the dependency in the build.gradle
of the module:
dependencies {
implementation "uk.gov.hmrc:help-to-save-kalculator-jvm:x.y.z"
}
bundle exec fastlane tag_release
- A valid Bitrise access token saved in your path under the variable name
BITRISE_TOKEN
. See Bitrise docs. - Two environment variables,
HTS_KALC_APP_SLUG
&HTS_KALC_RELEASE_WORKFLOW_ID
will also need to be included in your bash/ZSH profile. These can be found in Bitwarden.
- Ensure git status is clean
- Ensure
main
branch - Through the interactive shell, select the tag version using semantic versioning.
- Locally executes
build_xcframework.sh
:- Creates an XCFramework
- Computes and updates the checksum in the Swift Package declaration.
- Stamps the changelog
- Commit and push the updated
Package.swift
andCHANGELOG.md
- Upload release artifacts to tagged Github release
- Executes
release.sh
to start the CI pipeline on CI.
This code is open source software licensed under the Apache 2.0 License.