-
Notifications
You must be signed in to change notification settings - Fork 1
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
Cybersource logs #148
base: master
Are you sure you want to change the base?
Cybersource logs #148
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,11 @@ const CYBERSOURCE_AFFILIATION_ID = '21d78653-50d6-4b06-b553-2645e67a6f5e' | |
export function setWorkspaceInAffiliation(workspace = null, payerAuth = true) { | ||
it(`Configuring workspace as '${workspace}' in payment affiliation`, () => { | ||
cy.getVtexItems().then(vtex => { | ||
cy.qe(` | ||
curl --location --request GET '${vtex.baseUrl}/api/payments/pvt/affiliations/21d78653-50d6-4b06-b553-2645e67a6f5e' \ | ||
--header 'X-VTEX-API-AppKey: AppKey' \ | ||
--header 'X-VTEX-API-AppToken: AppToken' \ | ||
`) | ||
cy.request({ | ||
method: 'GET', | ||
url: `${vtex.baseUrl}/api/payments/pvt/affiliations/${CYBERSOURCE_AFFILIATION_ID}`, | ||
|
@@ -39,7 +44,12 @@ export function setWorkspaceInAffiliation(workspace = null, payerAuth = true) { | |
response.body.configuration[payerAuthIndex].value = payerAuth | ||
? 'active' | ||
: 'disabled' | ||
|
||
cy.qe(` | ||
curl --location --request PUT '${vtex.baseUrl}/api/payments/pvt/affiliations/21d78653-50d6-4b06-b553-2645e67a6f5e' \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace curl with cy.request |
||
--header 'X-VTEX-API-AppKey: AppKey' \ | ||
--header 'X-VTEX-API-AppToken: AppToken' \ | ||
--data-raw 'data' | ||
`) | ||
cy.request({ | ||
method: 'PUT', | ||
url: `${vtex.baseUrl}/api/payments/pvt/affiliations/${CYBERSOURCE_AFFILIATION_ID}`, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,11 +25,27 @@ export function saveAppSettings(settings) { | |
|
||
export function updateCybersourceConfiguration(orderSuffix = '') { | ||
it('Update cybersource app settings', () => { | ||
cy.qe(` | ||
GetApp settings query - | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For this use cy.addGraphqlLogs command |
||
query: 'query' + '{appSettings(app:"vtex.cybersource-ui"){message}}', | ||
queryVariables: {}, | ||
`) | ||
graphql(APP, getAppSettings(), ({ body }) => { | ||
const { message } = body.data.appSettings | ||
const jsonMessage = JSON.parse(message) | ||
|
||
jsonMessage.OrderSuffix = orderSuffix | ||
|
||
cy.qe(` | ||
saveAppSettings - mutation | ||
query: | ||
'mutation($app:String,$settings:String)' + | ||
{saveAppSettings(app:$app,settings:$settings){message}}, | ||
queryVariables: { | ||
app: 'vtex.cybersource-ui', | ||
settings: JSON.stringify(settings), | ||
}, | ||
`) | ||
graphql(APP, saveAppSettings(jsonMessage), response => { | ||
const { OrderSuffix } = JSON.parse( | ||
response.body.data.saveAppSettings.message | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,12 @@ import { FAIL_ON_STATUS_CODE, VTEX_AUTH_HEADER } from './common/constants.js' | |
// Order Tax API Test Case | ||
Cypress.Commands.add('orderTaxApi', (requestPayload, tax) => { | ||
cy.getVtexItems().then(vtex => { | ||
cy.qe(` | ||
curl --location --request POST '${vtex.baseUrl}/cybersource/checkout/order-tax' \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. replace curl with cy.request |
||
--header 'X-VTEX-API-AppKey: AppKey' \ | ||
--header 'X-VTEX-API-AppToken: AppToken' \ | ||
--data-raw 'tData":{req.body}' | ||
`) | ||
cy.request({ | ||
method: 'POST', | ||
url: `${vtex.baseUrl}/${ | ||
|
@@ -28,6 +34,7 @@ Cypress.Commands.add('orderTaxApi', (requestPayload, tax) => { | |
}) | ||
|
||
Cypress.Commands.add('checkForTaxErrors', () => { | ||
cy.qe(`communication error with Tax System has occurred should not exist`) | ||
cy.contains('communication error with Tax System has occurred', { | ||
timeout: 2000, | ||
}).should('not.exist') | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ export function completePayment({ | |
cy.intercept('**/gatewayCallback/**').as('callback') | ||
|
||
// Select Credit Card Option | ||
cy.qe(`Completing payment using credit card option`) | ||
cy.get('a[id*=creditCard]').should('be.visible').click() | ||
|
||
cy.get('body').then($body => { | ||
|
@@ -41,15 +42,19 @@ export function completePayment({ | |
cy.getIframeBody(selectors.PaymentMethodIFrame).then($body => { | ||
if (!$body.find(selectors.CardExist).length) { | ||
// Credit cart not exist | ||
cy.qe(`Enteriing credit card number 5555 5555 5555 4444`) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of entering use Type |
||
cy.getIframeBody(selectors.PaymentMethodIFrame) | ||
.find(selectors.CreditCardNumber) | ||
.type('5555 5555 5555 4444') | ||
cy.qe(`Entering firstName - syed`) | ||
cy.getIframeBody(selectors.PaymentMethodIFrame) | ||
.find(selectors.CreditCardHolderName) | ||
.type('Syed') | ||
cy.qe(`Selecting expiring month from dropdown - 01`) | ||
cy.getIframeBody(selectors.PaymentMethodIFrame) | ||
.find(selectors.CreditCardExpirationMonth) | ||
.select('01') | ||
cy.qe(`Selecting Expiry year from dropdown - 30`) | ||
cy.getIframeBody(selectors.PaymentMethodIFrame) | ||
.find(selectors.CreditCardExpirationYear) | ||
.select('30') | ||
|
@@ -157,6 +162,11 @@ export function verifyStatusInInteractionAPI({ | |
|
||
cy.getVtexItems().then(vtex => { | ||
cy.getOrderItems().then(item => { | ||
cy.qe(` | ||
curl --location --request GET '${vtex.baseUrl}/api/oms/pvt/orders/${item[orderIdEnv]}' \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. replace curl with cy.request |
||
--header 'X-VTEX-API-AppKey: AppKey' \ | ||
--header 'X-VTEX-API-AppToken: AppToken' \ | ||
`) | ||
cy.getAPI( | ||
`${invoiceAPI(vtex.baseUrl)}/${item[orderIdEnv]}`, | ||
VTEX_AUTH_HEADER(vtex.apiKey, vtex.apiToken) | ||
|
@@ -165,6 +175,11 @@ export function verifyStatusInInteractionAPI({ | |
const [{ transactionId }] = response.body.paymentData.transactions | ||
|
||
cy.setOrderItem(transactionIdEnv, transactionId) | ||
cy.qe(` | ||
curl --location --request GET '${vtex.baseUrl}/${transactionId}/interactions' \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. replace curl with cy.request |
||
--header 'X-VTEX-API-AppKey: AppKey' \ | ||
--header 'X-VTEX-API-AppToken: AppToken' \ | ||
`) | ||
cy.getAPI( | ||
`${transactionAPI(vtex.baseUrl)}/${transactionId}/interactions`, | ||
VTEX_AUTH_HEADER(vtex.apiKey, vtex.apiToken) | ||
|
@@ -339,6 +354,11 @@ export function verifyCyberSourceAPI({ | |
cy.addDelayBetweenRetries(5000) | ||
cy.getVtexItems().then(vtex => { | ||
cy.getOrderItems().then(item => { | ||
cy.qe(` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. replace curl with cy.request |
||
curl --location --request GET '${vtex.baseUrl}/api/payments/pvt/transactions/${item[transactionIdEnv]}/payments' \ | ||
--header 'X-VTEX-API-AppKey: AppKey' \ | ||
--header 'X-VTEX-API-AppToken: AppToken' \ | ||
`) | ||
cy.getAPI( | ||
`${transactionAPI(vtex.baseUrl)}/${item[transactionIdEnv]}/payments`, | ||
VTEX_AUTH_HEADER(vtex.apiKey, vtex.apiToken) | ||
|
@@ -425,6 +445,11 @@ export function invoiceAPITestCase( | |
|
||
cy.getVtexItems().then(vtex => { | ||
cy.getOrderItems().then(item => { | ||
cy.qe(` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. replace curl with cy.request |
||
curl --location --request GET '${vtex.baseUrl}/api/oms/pvt/orders/${item[orderIdEnv]}' \ | ||
--header 'X-VTEX-API-AppKey: AppKey' \ | ||
--header 'X-VTEX-API-AppToken: AppToken' \ | ||
`) | ||
cy.getAPI( | ||
`${ | ||
orderIdEnv === externalSeller.externalSaleEnv | ||
|
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.
Replace curl with cy.request