@internetarchive/donation-form 1.0.1-webdev-4700.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ import { DonationPaymentInfo, DonationType } from '@internetarchive/donation-for
4
4
  // this is a separate calculation from the one in DonationPaymentInfo
5
5
  // to have a second verification independent of it
6
6
  function calculateFee(amount) {
7
- return Math.round((amount * 0.02 + 0.49) * 100) / 100;
7
+ return Math.round((amount * 0.0219 + 0.29) * 100) / 100;
8
8
  }
9
9
  describe('Donation Payment Info', () => {
10
10
  it('calculates the proper total for no fees covered', () => __awaiter(void 0, void 0, void 0, function* () {
@@ -32,11 +32,11 @@ describe('Donation Payment Info', () => {
32
32
  amount: 5,
33
33
  coverFees: true,
34
34
  });
35
- expect(donationInfo.fee).to.equal(0.59);
36
- expect(donationInfo.total).to.equal(5.59);
35
+ expect(donationInfo.fee).to.equal(0.4);
36
+ expect(donationInfo.total).to.equal(5.4);
37
37
  donationInfo.amount = 3.5;
38
- expect(donationInfo.fee).to.equal(0.56);
39
- expect(donationInfo.total).to.equal(4.06);
38
+ expect(donationInfo.fee).to.equal(0.37);
39
+ expect(donationInfo.total).to.equal(3.87);
40
40
  }));
41
41
  it('calculates the proper expected fees', () => __awaiter(void 0, void 0, void 0, function* () {
42
42
  const baseAmount = 3.23;
@@ -1 +1 @@
1
- {"version":3,"file":"donation-payment-info.test.js","sourceRoot":"","sources":["../../../../test/tests/models/donation-payment-info.test.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAE/F,qEAAqE;AACrE,kDAAkD;AAClD,SAAS,YAAY,CAAC,MAAc;IAClC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC,GAA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,SAAS,EAAE,KAAK;SACjB,CAAC,CAAC;QAEH,MAAM,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,sCAAsC,EAAE,GAAS,EAAE;QACpD,MAAM,UAAU,GAAG,IAAI,CAAC;QACxB,MAAM,WAAW,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;QAC7C,MAAM,aAAa,GAAG,UAAU,GAAG,WAAW,CAAC;QAC/C,MAAM,eAAe,GAAG,mBAAmB,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAC7E,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAClD,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { DonationPaymentInfo, DonationType } from '@internetarchive/donation-form-data-models';\n\n// this is a separate calculation from the one in DonationPaymentInfo\n// to have a second verification independent of it\nfunction calculateFee(amount: number): number {\n return Math.round((amount * 0.02 + 0.49) * 100) / 100;\n}\n\ndescribe('Donation Payment Info', () => {\n it('calculates the proper total for no fees covered', async () => {\n const donationInfo = new DonationPaymentInfo({\n donationType: DonationType.OneTime,\n amount: 3.5,\n coverFees: false,\n });\n\n expect(donationInfo.total).to.equal(3.5);\n });\n\n it('calculates the proper total for fees coverage', async () => {\n const baseAmount = 3.5;\n const expectedFee = calculateFee(baseAmount);\n const expectedTotal = Math.round((baseAmount + expectedFee) * 100) / 100;\n\n const donationInfo = new DonationPaymentInfo({\n donationType: DonationType.OneTime,\n amount: baseAmount,\n coverFees: true,\n });\n\n expect(donationInfo.total).to.equal(expectedTotal);\n });\n\n it('calculates the proper expected fees from manual calculations', async () => {\n const donationInfo = new DonationPaymentInfo({\n donationType: DonationType.OneTime,\n amount: 5,\n coverFees: true,\n });\n expect(donationInfo.fee).to.equal(0.59);\n expect(donationInfo.total).to.equal(5.59);\n\n donationInfo.amount = 3.5;\n expect(donationInfo.fee).to.equal(0.56);\n expect(donationInfo.total).to.equal(4.06);\n });\n\n it('calculates the proper expected fees', async () => {\n const baseAmount = 3.23;\n const expectedFee = calculateFee(baseAmount);\n const calculatedFee = DonationPaymentInfo.calculateFeeAmount(baseAmount);\n expect(expectedFee).to.equal(calculatedFee);\n });\n\n it('get the proper fee amount covered when covering fees', async () => {\n const baseAmount = 4.12;\n const expectedFee = calculateFee(baseAmount);\n const donationInfo = new DonationPaymentInfo({\n donationType: DonationType.OneTime,\n amount: baseAmount,\n coverFees: true,\n });\n\n expect(donationInfo.feeAmountCovered).to.equal(expectedFee);\n });\n\n it('get the proper fee amount covered when not covering fees', async () => {\n const baseAmount = 4.12;\n // const expectedFee = calculateFee(baseAmount);\n const donationInfo = new DonationPaymentInfo({\n donationType: DonationType.OneTime,\n amount: baseAmount,\n coverFees: false,\n });\n\n expect(donationInfo.feeAmountCovered).to.equal(0);\n });\n\n it('calculates the proper expected total', async () => {\n const baseAmount = 3.29;\n const expectedFee = calculateFee(baseAmount);\n const expectedTotal = baseAmount + expectedFee;\n const calculatedTotal = DonationPaymentInfo.calculateTotal(baseAmount, true);\n expect(expectedTotal).to.equal(calculatedTotal);\n });\n});\n"]}
1
+ {"version":3,"file":"donation-payment-info.test.js","sourceRoot":"","sources":["../../../../test/tests/models/donation-payment-info.test.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAE/F,qEAAqE;AACrE,kDAAkD;AAClD,SAAS,YAAY,CAAC,MAAc;IAClC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AAC1D,CAAC;AAED,QAAQ,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AEH,MAAM,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,sCAAsC,EAAE,GAAS,EAAE;QACpD,MAAM,UAAU,GAAG,IAAI,CAAC;QACxB,MAAM,WAAW,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;QAC7C,MAAM,aAAa,GAAG,UAAU,GAAG,WAAW,CAAC;QAC/C,MAAM,eAAe,GAAG,mBAAmB,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAC7E,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAClD,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from '@open-wc/testing';\nimport { DonationPaymentInfo, DonationType } from '@internetarchive/donation-form-data-models';\n\n// this is a separate calculation from the one in DonationPaymentInfo\n// to have a second verification independent of it\nfunction calculateFee(amount: number): number {\n return Math.round((amount * 0.0219 + 0.29) * 100) / 100;\n}\n\ndescribe('Donation Payment Info', () => {\n it('calculates the proper total for no fees covered', async () => {\n const donationInfo = new DonationPaymentInfo({\n donationType: DonationType.OneTime,\n amount: 3.5,\n coverFees: false,\n });\n\n expect(donationInfo.total).to.equal(3.5);\n });\n\n it('calculates the proper total for fees coverage', async () => {\n const baseAmount = 3.5;\n const expectedFee = calculateFee(baseAmount);\n const expectedTotal = Math.round((baseAmount + expectedFee) * 100) / 100;\n\n const donationInfo = new DonationPaymentInfo({\n donationType: DonationType.OneTime,\n amount: baseAmount,\n coverFees: true,\n });\n\n expect(donationInfo.total).to.equal(expectedTotal);\n });\n\n it('calculates the proper expected fees from manual calculations', async () => {\n const donationInfo = new DonationPaymentInfo({\n donationType: DonationType.OneTime,\n amount: 5,\n coverFees: true,\n });\n expect(donationInfo.fee).to.equal(0.4);\n expect(donationInfo.total).to.equal(5.4);\n\n donationInfo.amount = 3.5;\n expect(donationInfo.fee).to.equal(0.37);\n expect(donationInfo.total).to.equal(3.87);\n });\n\n it('calculates the proper expected fees', async () => {\n const baseAmount = 3.23;\n const expectedFee = calculateFee(baseAmount);\n const calculatedFee = DonationPaymentInfo.calculateFeeAmount(baseAmount);\n expect(expectedFee).to.equal(calculatedFee);\n });\n\n it('get the proper fee amount covered when covering fees', async () => {\n const baseAmount = 4.12;\n const expectedFee = calculateFee(baseAmount);\n const donationInfo = new DonationPaymentInfo({\n donationType: DonationType.OneTime,\n amount: baseAmount,\n coverFees: true,\n });\n\n expect(donationInfo.feeAmountCovered).to.equal(expectedFee);\n });\n\n it('get the proper fee amount covered when not covering fees', async () => {\n const baseAmount = 4.12;\n // const expectedFee = calculateFee(baseAmount);\n const donationInfo = new DonationPaymentInfo({\n donationType: DonationType.OneTime,\n amount: baseAmount,\n coverFees: false,\n });\n\n expect(donationInfo.feeAmountCovered).to.equal(0);\n });\n\n it('calculates the proper expected total', async () => {\n const baseAmount = 3.29;\n const expectedFee = calculateFee(baseAmount);\n const expectedTotal = baseAmount + expectedFee;\n const calculatedTotal = DonationPaymentInfo.calculateTotal(baseAmount, true);\n expect(expectedTotal).to.equal(calculatedTotal);\n });\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/donation-form",
3
- "version": "1.0.1-webdev-4700.1",
3
+ "version": "1.0.2",
4
4
  "description": "The Internet Archive Donation Form",
5
5
  "license": "AGPL-3.0-only",
6
6
  "main": "dist/index.js",
@@ -30,8 +30,8 @@
30
30
  "dependencies": {
31
31
  "@internetarchive/analytics-manager": "^0.1.4",
32
32
  "@internetarchive/donation-form-currency-validator": "^0.3.1",
33
- "@internetarchive/donation-form-data-models": "^0.3.5",
34
- "@internetarchive/donation-form-edit-donation": "1.1.4-webdev-4700.1",
33
+ "@internetarchive/donation-form-data-models": "^0.3.6",
34
+ "@internetarchive/donation-form-edit-donation": "^1.1.5",
35
35
  "@internetarchive/donation-form-section": "^0.3.6",
36
36
  "@internetarchive/icon-applepay": "^1.3.2",
37
37
  "@internetarchive/icon-calendar": "^1.3.2",