-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Ci(Cypress): Enhance Cybersource Testcases #6285
base: main
Are you sure you want to change the base?
Conversation
marking this pr as draft until ready. |
// expect( | ||
// response.body.connector_transaction_id, | ||
// "connector_transaction_id" | ||
// ).to.not.be.null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove if not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a required check but for cybersource the connector_transaction_id is null for 3ds payments so as of now i have commented this code
// expect( | ||
// response.body.connector_transaction_id, | ||
// "connector_transaction_id" | ||
// ).to.not.be.null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove if not needed
// expect( | ||
// response.body.connector_transaction_id, | ||
// "connector_transaction_id" | ||
// ).to.not.be.null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove if not needed
// expect( | ||
// response.body.connector_transaction_id, | ||
// "connector_transaction_id" | ||
// ).to.not.be.null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove if not needed
@@ -883,6 +968,16 @@ Cypress.Commands.add( | |||
).to.be.null; | |||
expect(response.body.connector_mandate_id, "connector_mandate_id").to.be | |||
.null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Along with the above checks,
- add payment_id not null check
- merchant_id not null
- status = 'requires_payment_method'
- Check deep equals (nested object should be covered, eg: JSON.stringify(obj1) === JSON.stringify(obj2)) for the shipping address
- Check deep equals for billing address
- check if the profile id is the expected one instead of doing null check
- external_3ds_authentication_attempted is same as the request body
If the above items are not generic and will change from case to case, add a callback function and pass the required check from the calling place
order_tax_amount, external_3ds_authentication_attempted etc cannot be generic, so for those, we can have a callback function to verify them based on the calling place
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3.status = 'requires_payment_method'
We are already checking this in each connector.js file
expect(res_data.body[key]).to.equal(
response.body[key],
Expected ${res_data.body[key]} but got ${response.body[key]}
);
6.check if the profile id is the expected one instead of doing null check
Its a random created profile_id and even we are getting profile id from the global state so it will fail if the profile id is not present or its not stored in globalstate.
4.Check deep equals (nested object should be covered, eg: JSON.stringify(obj1) === JSON.stringify(obj2)) for the shipping address
5.Check deep equals for billing address
- Billling and shipping address we are not passing in the intent create. We are passing only the mandatory field in payment intent create. So we are verifying these checks in confirm and other calls
7.external_3ds_authentication_attempted is same as the request body
As we have not added these scenario's yet so havent added these checks in the response once we have implemented that feature we will include these cases.
}).then((response) => { | ||
logRequestId(response.headers["x-request-id"]); | ||
|
||
expect(response.headers["content-type"]).to.include("application/json"); | ||
if (response.status === 200) { | ||
expect(response.body).to.have.property("payment_method_id"); | ||
expect(response.body).to.have.property("client_secret"); | ||
expect(response.body.client_secret, "client_secret").to.equal( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add check for merchant_id, customer_id, payment_method, payment_method_type, last_used etc
if appliable check for all the details related to the card also
const recurringEnabledFromConfirm = | ||
globalState.get("recurring_enabled"); | ||
if ( | ||
req_data.customer_acceptance === "object" && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this a valid check? usually typeof will be added to check object type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we have to check recurringEnabled is true or false for mandate payments. And these checks are based on multiple factors(In confirm customer acceptance passed/not and in create its a off_session payment or not then it will be true). So to handle that i made these changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it is not a valid check. It should be if (typeof(req_data.customer_acceptance) === "object")
instead.
}); | ||
|
||
it("List Payment Method for Customer using Client Secret", () => { | ||
cy.listCustomerPMByClientSecret(globalState); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should check the count of payment methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
once creds issue is resolved we can add
Type of Change
Description
Added field level verifications for payment retrieve , payment intent , payment attempt , List payment methods
Added Business Profile cases
Added Payment methods Test cases
Added Connector agnostic Test cases
Additional Changes
Motivation and Context
How did you test it?
Checklist
cargo +nightly fmt --all
cargo clippy