Skip to content

Commit

Permalink
MOL-451: CA - Surcharge transaction cost
Browse files Browse the repository at this point in the history
MOL-451: CA - Surcharge transaction cost
  • Loading branch information
NghiaDTr authored Nov 19, 2024
2 parents d7e6900 + 839a1bf commit 250471a
Show file tree
Hide file tree
Showing 30 changed files with 5,100 additions and 3,710 deletions.
26 changes: 25 additions & 1 deletion application/cypress/e2e/method-details-availability.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,19 @@ beforeEach(() => {

describe('Test method details - availability tab', () => {
it('should be fully functional', () => {
const LOCALE = Cypress.env('LOCALE');
const paymentMethods = 'Apple Pay';

cy.findByText(paymentMethods).click();
cy.url().should('contain', 'general');

cy.findByText('Availability').should('exist').click();

cy.findByText('Currency');
cy.findByText('Min amount');
cy.findByText('Max amount');
cy.findByText('Country');
cy.findByText('Surcharge transaction cost');

cy.findByText('EUR');
cy.findByText('DE');
cy.findByText(333);
Expand All @@ -81,6 +86,10 @@ describe('Test method details - availability tab', () => {
currencyCode: 'GBP',
minAmount: 100,
maxAmount: 444,
surchargeCost: {
percentageAmount: 2,
fixedAmount: 10,
},
};

cy.findByTestId('money-field-maxAmount').type(
Expand All @@ -93,6 +102,19 @@ describe('Test method details - availability tab', () => {
'Maximum amount has to be higher then minimum amount.'
).should('not.exist');

cy.findByTestId('money-field-surchargeCost--percentageAmount').type(
newAvailability.surchargeCost.percentageAmount.toString()
);
cy.findByTestId('money-field-surchargeCost--fixedAmount').type(
newAvailability.surchargeCost.fixedAmount.toString()
);

const totalSurchargeCost =
newAvailability.surchargeCost.percentageAmount +
'% + ' +
newAvailability.surchargeCost.fixedAmount +
newAvailability.currencyCode;

const updatedPricingConstraints =
customObjects.results[0].value.pricingConstraints ?? [];
updatedPricingConstraints.push(newAvailability);
Expand Down Expand Up @@ -125,5 +147,7 @@ describe('Test method details - availability tab', () => {
cy.findByText(item.minAmount.toString()).should('exist');
cy.findByText(item.maxAmount.toString()).should('exist');
});

cy.findByText(totalSurchargeCost).should('exist');
});
});
20 changes: 20 additions & 0 deletions application/cypress/fixtures/objects-paginated.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"value": {
"id": "applepay",
"displayOrder": 2,
"technicalName": "Apple Pay",
"name": {
"en-GB": "Apple Pay"
},
Expand All @@ -32,6 +33,7 @@
"key": "bancomatpay",
"value": {
"id": "bancomatpay",
"technicalName": "Bancomat Pay",
"name": {
"en-GB": "Bancomat Pay"
},
Expand All @@ -49,6 +51,7 @@
"key": "bancontact",
"value": {
"id": "bancontact",
"technicalName": "Bancontact",
"name": {
"en-GB": "Bancontact"
},
Expand All @@ -66,6 +69,7 @@
"key": "banktransfer",
"value": {
"id": "banktransfer",
"technicalName" : "Bank transfer",
"name": {
"en-GB": "Bank transfer"
},
Expand All @@ -83,6 +87,7 @@
"key": "belfius",
"value": {
"id": "belfius",
"technicalName": "Belfius Pay Button",
"name": {
"en-GB": "Belfius Pay Button"
},
Expand All @@ -100,6 +105,7 @@
"key": "billie",
"value": {
"id": "billie",
"technicalName": "Pay by Invoice for Businesses - Billie",
"name": {
"en-GB": "Pay by Invoice for Businesses - Billie"
},
Expand All @@ -117,6 +123,7 @@
"key": "blik",
"value": {
"id": "blik",
"technicalName": "Blik",
"name": {
"en-GB": "Blik"
},
Expand All @@ -134,6 +141,7 @@
"key": "creditcard",
"value": {
"id": "creditcard",
"technicalName": "Card",
"name": {
"en-GB": "Card"
},
Expand All @@ -152,6 +160,7 @@
"key": "directdebit",
"value": {
"id": "directdebit",
"technicalName": "SEPA Direct Debit",
"name": {
"en-GB": "SEPA Direct Debit"
},
Expand All @@ -169,6 +178,7 @@
"key": "eps",
"value": {
"id": "eps",
"technicalName": "eps",
"name": {
"en-GB": "eps"
},
Expand All @@ -186,6 +196,7 @@
"key": "giftcard",
"value": {
"id": "giftcard",
"technicalName": "Gift cards",
"name": {
"en-GB": "Gift cards"
},
Expand All @@ -203,6 +214,7 @@
"key": "ideal",
"value": {
"id": "ideal",
"technicalName": "iDEAL",
"name": {
"en-GB": "iDEAL"
},
Expand All @@ -220,6 +232,7 @@
"key": "in3",
"value": {
"id": "in3",
"technicalName": "iDEAL Pay in 3 instalments, 0% interest",
"name": {
"en-GB": "iDEAL Pay in 3 instalments, 0% interest"
},
Expand All @@ -237,6 +250,7 @@
"key": "kbc",
"value": {
"id": "kbc",
"technicalName": "KBC/CBC Payment Button",
"name": {
"en-GB": "KBC/CBC Payment Button"
},
Expand All @@ -254,6 +268,7 @@
"key": "klarna",
"value": {
"id": "klarna",
"technicalName": "Pay with Klarna",
"name": {
"en-GB": "Pay with Klarna"
},
Expand All @@ -271,6 +286,7 @@
"key": "paypal",
"value": {
"id": "paypal",
"technicalName": "PayPal",
"name": {
"en-GB": "PayPal"
},
Expand All @@ -288,6 +304,7 @@
"key": "przelewy24",
"value": {
"id": "przelewy24",
"technicalName": "Przelewy24",
"name": {
"en-GB": "Przelewy24"
},
Expand All @@ -305,6 +322,7 @@
"key": "trustly",
"value": {
"id": "trustly",
"technicalName": "Trustly",
"name": {
"en-GB": "Trustly"
},
Expand All @@ -322,6 +340,7 @@
"key": "twint",
"value": {
"id": "twint",
"technicalName": "TWINT",
"name": {
"en-GB": "TWINT"
},
Expand All @@ -339,6 +358,7 @@
"key": "voucher",
"value": {
"id": "voucher",
"technicalName": "Vouchers",
"name": {
"en-GB": "Vouchers"
},
Expand Down
1 change: 1 addition & 0 deletions application/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"@commercetools-uikit/checkbox-input": "^19.11.0",
"@commercetools-uikit/constraints": "^19.9.0",
"@commercetools-uikit/data-table": "^19.9.0",
"@commercetools-uikit/field-label": "^19.13.0",
"@commercetools-uikit/flat-button": "^19.9.0",
"@commercetools-uikit/grid": "^19.9.0",
"@commercetools-uikit/hooks": "^19.9.0",
Expand Down
Loading

0 comments on commit 250471a

Please sign in to comment.