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

WEBDEV-7195: Update donation fee amount #163

Merged
merged 12 commits into from
Dec 23, 2024
2 changes: 1 addition & 1 deletion packages/data-models/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@internetarchive/donation-form-data-models",
"version": "0.3.3",
"version": "0.3.4",
"description": "Internet Archive Donation Form Data Models",
"license": "AGPL-3.0-only",
"main": "dist/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class DonationPaymentInfo {
* @memberof DonationPaymentInfo
*/
static calculateFeeAmount(amount: number): number {
const fee = amount * 0.022 + 0.3;
const fee = amount * 0.02 + 0.49;
if (isNaN(fee)) {
return 0;
}
Expand Down
14 changes: 7 additions & 7 deletions packages/data-models/test/donation-payment-info.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { DonationType } from '../src/donation-info/donation-type';
// this is a separate calculation from the one in DonationPaymentInfo
// to have a second verification independent of it
function calculateFee(amount: number): number {
return Math.round((amount * 0.022 + 0.3) * 100) / 100;
return Math.round((amount * 0.02 + 0.49) * 100) / 100;
}

describe('Donation Payment Info', () => {
Expand All @@ -22,15 +22,15 @@ describe('Donation Payment Info', () => {
it('calculates the proper total for fees coverage', async () => {
const baseAmount = 3.5;
const expectedFee = calculateFee(baseAmount);
const exptectedTotal = baseAmount + expectedFee;
const expectedTotal = Math.round((baseAmount + expectedFee) * 100) / 100;

const donationInfo = new DonationPaymentInfo({
donationType: DonationType.OneTime,
amount: baseAmount,
coverFees: true,
});

expect(donationInfo.total).to.equal(exptectedTotal);
expect(donationInfo.total).to.equal(expectedTotal);
});

it('calculates the proper expected fees from manual calculations', async () => {
Expand All @@ -39,12 +39,12 @@ describe('Donation Payment Info', () => {
amount: 5,
coverFees: true,
});
expect(donationInfo.fee).to.equal(0.41);
expect(donationInfo.total).to.equal(5.41);
expect(donationInfo.fee).to.equal(0.59);
expect(donationInfo.total).to.equal(5.59);

donationInfo.amount = 3.5;
expect(donationInfo.fee).to.equal(0.38);
expect(donationInfo.total).to.equal(3.88);
expect(donationInfo.fee).to.equal(0.56);
expect(donationInfo.total).to.equal(4.06);
});

it('calculates the proper expected fees', async () => {
Expand Down
6 changes: 3 additions & 3 deletions packages/donation-form/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@internetarchive/donation-form",
"version": "0.6.1",
"version": "0.6.2",
"description": "The Internet Archive Donation Form",
"license": "AGPL-3.0-only",
"main": "dist/index.js",
Expand Down Expand Up @@ -30,8 +30,8 @@
"dependencies": {
"@internetarchive/analytics-manager": "^0.1.2",
"@internetarchive/donation-form-currency-validator": "^0.3.0",
"@internetarchive/donation-form-data-models": "^0.3.3",
"@internetarchive/donation-form-edit-donation": "^1.0.2",
"@internetarchive/donation-form-data-models": "^0.3.4",
"@internetarchive/donation-form-edit-donation": "^1.1.2",
"@internetarchive/donation-form-section": "^0.3.5",
"@internetarchive/icon-applepay": "^1.3.2",
"@internetarchive/icon-calendar": "^1.3.2",
Expand Down
18 changes: 9 additions & 9 deletions packages/donation-form/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -311,18 +311,18 @@
resolved "https://registry.npmjs.org/@internetarchive/donation-form-currency-validator/-/donation-form-currency-validator-0.3.0.tgz"
integrity sha512-IsIuy9dXpZmDEeQpgpdxqUTQ6URCWkx0W2qMoaFtOFqKJSnE5/+19NCoP7Il4xGqA2wm/Px9RLwMCGwTpuXPRA==

"@internetarchive/donation-form-data-models@^0.3.2", "@internetarchive/donation-form-data-models@^0.3.3":
version "0.3.3"
resolved "https://registry.npmjs.org/@internetarchive/donation-form-data-models/-/donation-form-data-models-0.3.3.tgz"
integrity sha512-EZVCJNQxmZRxSu7vFtLhr/wktUaVTIlSmsUI6Pc0Zccio5lYWMxSXJVEZ6UEn0q7Y/UJavwpne5G56f2jfAWsw==
"@internetarchive/donation-form-data-models@^0.3.4":
version "0.3.4"
resolved "https://registry.yarnpkg.com/@internetarchive/donation-form-data-models/-/donation-form-data-models-0.3.4.tgz#678b66127c4e0868cdfd1fd01ea24990373648fa"
integrity sha512-21uD2OLSo3QssKuWYIT1TXpwHpCBHgRivgJbKWzfsP+hLux/5C3vOH0q/wQxyct5xJb6ehZg8hFDTlKDl5H6Vw==

"@internetarchive/donation-form-edit-donation@^1.0.2":
version "1.1.1"
resolved "https://registry.npmjs.org/@internetarchive/donation-form-edit-donation/-/donation-form-edit-donation-1.1.1.tgz"
integrity sha512-ESWjF2cYWnL2qzYfSnNNZNj6/ZWVA5AEPo0NGcbETM2VclF2XnFM2RzAOpWqzrbehAZx0CaU0ySg0W2hnEF81Q==
"@internetarchive/donation-form-edit-donation@^1.1.2":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@internetarchive/donation-form-edit-donation/-/donation-form-edit-donation-1.1.2.tgz#7d380db6e800fe0d4c6eb61f32738d983c878594"
integrity sha512-9B7Q2uxfISPA7tqPMUYfwoLlVEXIHCShiAUMyR93Fx+bQ70GY5xsp6JxqCZW9w+/2nPJ1JEpKQkedL2w4eIapg==
dependencies:
"@internetarchive/donation-form-currency-validator" "^0.3.0"
"@internetarchive/donation-form-data-models" "^0.3.2"
"@internetarchive/donation-form-data-models" "^0.3.4"
"@internetarchive/donation-form-section" "0.3.5"
currency.js "^2.0.3"
lit "^2.0.2"
Expand Down
4 changes: 2 additions & 2 deletions packages/edit-donation/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@internetarchive/donation-form-edit-donation",
"version": "1.1.1",
"version": "1.1.2",
"description": "The Internet Archive Donation Form Edit Donation component",
"license": "AGPL-3.0-only",
"main": "dist/index.js",
Expand All @@ -25,7 +25,7 @@
},
"dependencies": {
"@internetarchive/donation-form-currency-validator": "^0.3.0",
"@internetarchive/donation-form-data-models": "^0.3.2",
"@internetarchive/donation-form-data-models": "^0.3.4",
"@internetarchive/donation-form-section": "0.3.5",
"currency.js": "^2.0.3",
"lit": "^2.0.2"
Expand Down
8 changes: 4 additions & 4 deletions packages/edit-donation/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -826,10 +826,10 @@
resolved "https://registry.npmjs.org/@internetarchive/donation-form-currency-validator/-/donation-form-currency-validator-0.3.0.tgz"
integrity sha512-IsIuy9dXpZmDEeQpgpdxqUTQ6URCWkx0W2qMoaFtOFqKJSnE5/+19NCoP7Il4xGqA2wm/Px9RLwMCGwTpuXPRA==

"@internetarchive/donation-form-data-models@^0.3.2":
version "0.3.2"
resolved "https://registry.npmjs.org/@internetarchive/donation-form-data-models/-/donation-form-data-models-0.3.2.tgz"
integrity sha512-yxjwwr/2YMIx56IN9ZVETqByc7jlsX6s57zk1K+bWgA0u+D0OKScWKX+dLxaz2viRNSQOEOR1MsQWwaKshh0Tg==
"@internetarchive/donation-form-data-models@^0.3.4":
version "0.3.4"
resolved "https://registry.yarnpkg.com/@internetarchive/donation-form-data-models/-/donation-form-data-models-0.3.4.tgz#678b66127c4e0868cdfd1fd01ea24990373648fa"
integrity sha512-21uD2OLSo3QssKuWYIT1TXpwHpCBHgRivgJbKWzfsP+hLux/5C3vOH0q/wQxyct5xJb6ehZg8hFDTlKDl5H6Vw==

"@internetarchive/[email protected]":
version "0.3.5"
Expand Down
Loading