Skip to content

Commit

Permalink
promotion: preprod to prod
Browse files Browse the repository at this point in the history
promotion: preprod to prod
  • Loading branch information
NyAndoMayah authored Nov 24, 2023
2 parents 323d178 + 349d263 commit 101b400
Show file tree
Hide file tree
Showing 13 changed files with 432 additions and 115 deletions.
5 changes: 3 additions & 2 deletions src/__tests__/Manager.Multiple.Student.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import {
const importFile = (file, message) => {
const _path = 'cypress/fixtures'
const _mockFile = `${_path}/${file}`
cy.get('[data-testid="inputFile"]').selectFile(_mockFile, { force: true })
cy.get('#import-button').trigger('mousemove')
cy.get("[data-testid='inputFile']").selectFile(_mockFile, { force: true })

cy.contains('Confirmer').click()

Expand All @@ -40,7 +41,7 @@ describe(specTitle('Manager create multiple students'), () => {
cy.intercept('GET', `/students?page=1&page_size=10&last_name=${studentNameToBeCheckedMock}`, [student1Mock]).as('getStudentsByName')
cy.intercept('GET', `/students/${student1Mock.id}`, student1Mock)

cy.wait('@getWhoami')
//cy.wait('@getWhoami')
cy.get('[data-testid="students-menu"]').click()
cy.get('[href="#/students"]').click()
})
Expand Down
50 changes: 26 additions & 24 deletions src/__tests__/Manager.Payment.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,7 @@ import {
} from './mocks/responses'

const amount = 1 + Math.floor(Math.random() * 100_000)
const creatPaymentMock = createPaymentWithAmountMock(amount)
const paymentVerificationMock = creatPaymentMock => {
return requestIntersection => {
let pendingPaymentMock = {
comment: creatPaymentMock.comment,
type: creatPaymentMock.type,
amount: '' + creatPaymentMock.amount
}
expect(requestIntersection.request.body[0]).to.deep.equal(pendingPaymentMock)
expect(requestIntersection.request.body.length).to.equal(1)
}
}
const createPayment = createPaymentWithAmountMock(amount)

describe(specTitle('Manager.Payment'), () => {
beforeEach(() => {
Expand Down Expand Up @@ -64,36 +53,49 @@ describe(specTitle('Manager.Payment'), () => {
cy.contains(unpaidFeeMock.comment).click()
cy.contains('En attente')
cy.get('.MuiFab-root').click()
cy.intercept('GET', `/students/${student1Mock.id}/fees/${unpaidFeeMock.id}/payments?page=1&page_size=10`, [creatPaymentMock]).as('getPayment')
cy.intercept('GET', `/students/${student1Mock.id}/fees/${unpaidFeeMock.id}`, UpdateFeeWithPaymentMock(unpaidFeeMock, creatPaymentMock)).as('getFee')
cy.intercept('GET', `/students/${student1Mock.id}/fees/${unpaidFeeMock.id}/payments?page=1&page_size=10`, [createPayment]).as('getPayment')
cy.intercept('GET', `/students/${student1Mock.id}/fees/${unpaidFeeMock.id}`, UpdateFeeWithPaymentMock(unpaidFeeMock, createPayment)).as('getFee')
})

it('can add cash payment to a fee', () => {
cy.get('#type_cash').click()
cy.get('#amount').click().type(creatPaymentMock.amount)
cy.get('#comment').click().type(creatPaymentMock.comment)
cy.get('#type_CASH').click()
cy.get('#amount').click().type(createPayment.amount)
cy.get('#comment').click().type(createPayment.comment)
cy.contains('Enregistrer').click()
//cy.wait('@addPayments').then(paymentVerificationMock(creatPaymentMock))
//cy.wait('@addPayments').then(paymentVerificationMock(createPayment))
cy.contains('Élément créé')
cy.get(`.MuiTableCell-alignRight:contains(${prettyPrintMoney(amount)})`).should('have.length', 1)
cy.get('td input[type="checkbox"]', { timeout: 50 }).should('not.exist')
unmount()
})
it('can add mobile money payment to a fee', () => {
cy.get('#type_mobileMoney').click()
cy.get('#amount').click().type(creatPaymentMock.amount)
cy.get('#comment').click().type(creatPaymentMock.comment)
cy.get('#type_MOBILE_MONEY').click()
cy.get('#amount').click().type(createPayment.amount)
cy.get('#comment').click().type(createPayment.comment)
cy.contains('Enregistrer').click()
//cy.wait('@addPayments').then(paymentVerificationMock(creatPaymentMock))
//cy.wait('@addPayments').then(paymentVerificationMock(createPayment))
cy.contains('Élément créé')
cy.get(`.MuiTableCell-alignRight:contains(${prettyPrintMoney(amount)})`).should('have.length', 1)
unmount()
})
it("can't add mobile money payment to a fee without comment", () => {
cy.get('#type_mobileMoney').click()
cy.get('#amount').click().type(creatPaymentMock.amount)
cy.get('#type_MOBILE_MONEY').click()
cy.get('#amount').click().type(createPayment.amount)
cy.contains('Enregistrer').click()
cy.contains("Le formulaire n'est pas valide.")
unmount()
})
it('can add bank payment to a fee', () => {
cy.get('#type_BANK_PAYMENT').click()
cy.get('#amount').click().type(createPayment.amount)
cy.get('#comment').click().type(createPayment.comment)
cy.get('#ref').click().type(amount)
cy.get('#specify-date').click()
cy.get('#creation_datetime').click().type('2023-11-24')
cy.contains('Enregistrer').click()
//cy.wait('@addPayments').then(paymentVerificationMock(createPayment))
cy.contains('Élément créé')
cy.get(`.MuiTableCell-alignRight:contains(${prettyPrintMoney(amount)})`).should('have.length', 1)
unmount()
})
})
13 changes: 10 additions & 3 deletions src/conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@ export const predefinedFirstDueDates = {
date2: { name: `15 janvier ${currentYear + 1}`, value: new Date(currentYear + 1, 0, 15) }
}

export const paymentTypes = {
cash: { name: 'Cash', type: 'CASH' },
mobileMoney: { name: 'Mobile money', type: 'MOBILE_MONEY' }
export const PaymentTypeValue = {
BankPayement: 'BANK_PAYMENT',
MobileMoney: 'MOBILE_MONEY',
Cash: 'CASH'
}

export const paymentTypes = [
{ name: 'Virement Bancaire', id: PaymentTypeValue.BankPayement },
{ name: 'Mobile money', id: PaymentTypeValue.MobileMoney },
{ name: 'Cash', id: PaymentTypeValue.Cash }
]
124 changes: 120 additions & 4 deletions src/gen/haClient/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* HEI Admin API
* _Programmatically connect to a computer programming [school](https://hei.school)._ After [joining us](mailto:[email protected]), you can get an identification token from our [dev](https://dev-hei-admin.auth.eu-west-3.amazoncognito.com/oauth2/authorize?client_id=5s8cg50doahmu855rlc8fr6qmp&response_type=token&scope=email+openid&redirect_uri=https%3A%2F%2Fapi-dev.hei.school%2Fwhoami) or [prod](https://prod-hei-admin.auth.eu-west-3.amazoncognito.com/oauth2/authorize?client_id=i8bg538jpfu6mqmqb61m26trd&response_type=token&scope=email+openid&redirect_uri=https%3A%2F%2Fapi-prod.hei.school%2Fwhoami) authentication service. Then, start playing with our system! The implementation of our API is [publicly disclosed](https://github.com/hei-school/hei-admin-api). You are welcome to try and compromise it. Happy hacking!
*
* The version of the OpenAPI document: 1.0
* The version of the OpenAPI document: latest
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down Expand Up @@ -454,7 +454,7 @@ export interface CreateGroup {
* @type {Array<string>}
* @memberof CreateGroup
*/
students?: Array<string>
studentsToAdd?: Array<string>
/**
*
* @type {string}
Expand Down Expand Up @@ -537,9 +537,16 @@ export interface CreatePayment {
* @memberof CreatePayment
*/
comment?: string
/**
*
* @type {string}
* @memberof CreatePayment
*/
creation_datetime?: string
}

export const CreatePaymentTypeEnum = {
BankTransfer: 'BANK_TRANSFER',
Cash: 'CASH',
MobileMoney: 'MOBILE_MONEY',
Scholarship: 'SCHOLARSHIP',
Expand Down Expand Up @@ -1057,6 +1064,7 @@ export interface Payment {
}

export const PaymentTypeEnum = {
BankTransfer: 'BANK_TRANSFER',
Cash: 'CASH',
MobileMoney: 'MOBILE_MONEY',
Scholarship: 'SCHOLARSHIP',
Expand Down Expand Up @@ -3053,6 +3061,64 @@ export const TeachingApiAxiosParamCreator = function (configuration?: Configurat
options: localVarRequestOptions
}
},
/**
*
* @summary Get all awarded_courses
* @param {string} [teacherId]
* @param {string} [courseId]
* @param {number} [page] Set value to 1 by default if null is provided
* @param {number} [pageSize] Set value to 15 by default if null is provided
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getAllAwardedCourseByCriteria: async (
teacherId?: string,
courseId?: string,
page?: number,
pageSize?: number,
options: AxiosRequestConfig = {}
): Promise<RequestArgs> => {
const localVarPath = `/awarded_courses`
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL)
let baseOptions
if (configuration) {
baseOptions = configuration.baseOptions
}

const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }
const localVarHeaderParameter = {} as any
const localVarQueryParameter = {} as any

// authentication BearerAuth required
// http bearer authentication required
await setBearerAuthToObject(localVarHeaderParameter, configuration)

if (teacherId !== undefined) {
localVarQueryParameter['teacher_id'] = teacherId
}

if (courseId !== undefined) {
localVarQueryParameter['course_id'] = courseId
}

if (page !== undefined) {
localVarQueryParameter['page'] = page
}

if (pageSize !== undefined) {
localVarQueryParameter['page_size'] = pageSize
}

setSearchParams(localVarUrlObj, localVarQueryParameter)
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }

return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions
}
},
/**
*
* @summary Get all group awarded_courses
Expand Down Expand Up @@ -3775,6 +3841,26 @@ export const TeachingApiFp = function (configuration?: Configuration) {
const localVarAxiosArgs = await localVarAxiosParamCreator.createStudentExamGrade(groupId, awardedCourseId, examId, createGrade, options)
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)
},
/**
*
* @summary Get all awarded_courses
* @param {string} [teacherId]
* @param {string} [courseId]
* @param {number} [page] Set value to 1 by default if null is provided
* @param {number} [pageSize] Set value to 15 by default if null is provided
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getAllAwardedCourseByCriteria(
teacherId?: string,
courseId?: string,
page?: number,
pageSize?: number,
options?: AxiosRequestConfig
): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<AwardedCourse>>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getAllAwardedCourseByCriteria(teacherId, courseId, page, pageSize, options)
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)
},
/**
*
* @summary Get all group awarded_courses
Expand Down Expand Up @@ -3823,7 +3909,7 @@ export const TeachingApiFp = function (configuration?: Configuration) {
groupId: string,
awardedCourseId: string,
options?: AxiosRequestConfig
): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<ExamInfo>>> {
): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AwardedCourse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getAwardedCoursesByIdAndGroupId(groupId, awardedCourseId, options)
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)
},
Expand Down Expand Up @@ -4092,6 +4178,19 @@ export const TeachingApiFactory = function (configuration?: Configuration, baseP
): AxiosPromise<Array<ExamDetail>> {
return localVarFp.createStudentExamGrade(groupId, awardedCourseId, examId, createGrade, options).then(request => request(axios, basePath))
},
/**
*
* @summary Get all awarded_courses
* @param {string} [teacherId]
* @param {string} [courseId]
* @param {number} [page] Set value to 1 by default if null is provided
* @param {number} [pageSize] Set value to 15 by default if null is provided
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getAllAwardedCourseByCriteria(teacherId?: string, courseId?: string, page?: number, pageSize?: number, options?: any): AxiosPromise<Array<AwardedCourse>> {
return localVarFp.getAllAwardedCourseByCriteria(teacherId, courseId, page, pageSize, options).then(request => request(axios, basePath))
},
/**
*
* @summary Get all group awarded_courses
Expand Down Expand Up @@ -4124,7 +4223,7 @@ export const TeachingApiFactory = function (configuration?: Configuration, baseP
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getAwardedCoursesByIdAndGroupId(groupId: string, awardedCourseId: string, options?: any): AxiosPromise<Array<ExamInfo>> {
getAwardedCoursesByIdAndGroupId(groupId: string, awardedCourseId: string, options?: any): AxiosPromise<AwardedCourse> {
return localVarFp.getAwardedCoursesByIdAndGroupId(groupId, awardedCourseId, options).then(request => request(axios, basePath))
},
/**
Expand Down Expand Up @@ -4356,6 +4455,23 @@ export class TeachingApi extends BaseAPI {
.then(request => request(this.axios, this.basePath))
}

/**
*
* @summary Get all awarded_courses
* @param {string} [teacherId]
* @param {string} [courseId]
* @param {number} [page] Set value to 1 by default if null is provided
* @param {number} [pageSize] Set value to 15 by default if null is provided
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof TeachingApi
*/
public getAllAwardedCourseByCriteria(teacherId?: string, courseId?: string, page?: number, pageSize?: number, options?: AxiosRequestConfig) {
return TeachingApiFp(this.configuration)
.getAllAwardedCourseByCriteria(teacherId, courseId, page, pageSize, options)
.then(request => request(this.axios, this.basePath))
}

/**
*
* @summary Get all group awarded_courses
Expand Down
2 changes: 1 addition & 1 deletion src/gen/haClient/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* HEI Admin API
* _Programmatically connect to a computer programming [school](https://hei.school)._ After [joining us](mailto:[email protected]), you can get an identification token from our [dev](https://dev-hei-admin.auth.eu-west-3.amazoncognito.com/oauth2/authorize?client_id=5s8cg50doahmu855rlc8fr6qmp&response_type=token&scope=email+openid&redirect_uri=https%3A%2F%2Fapi-dev.hei.school%2Fwhoami) or [prod](https://prod-hei-admin.auth.eu-west-3.amazoncognito.com/oauth2/authorize?client_id=i8bg538jpfu6mqmqb61m26trd&response_type=token&scope=email+openid&redirect_uri=https%3A%2F%2Fapi-prod.hei.school%2Fwhoami) authentication service. Then, start playing with our system! The implementation of our API is [publicly disclosed](https://github.com/hei-school/hei-admin-api). You are welcome to try and compromise it. Happy hacking!
*
* The version of the OpenAPI document: 1.0
* The version of the OpenAPI document: latest
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion src/gen/haClient/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* HEI Admin API
* _Programmatically connect to a computer programming [school](https://hei.school)._ After [joining us](mailto:[email protected]), you can get an identification token from our [dev](https://dev-hei-admin.auth.eu-west-3.amazoncognito.com/oauth2/authorize?client_id=5s8cg50doahmu855rlc8fr6qmp&response_type=token&scope=email+openid&redirect_uri=https%3A%2F%2Fapi-dev.hei.school%2Fwhoami) or [prod](https://prod-hei-admin.auth.eu-west-3.amazoncognito.com/oauth2/authorize?client_id=i8bg538jpfu6mqmqb61m26trd&response_type=token&scope=email+openid&redirect_uri=https%3A%2F%2Fapi-prod.hei.school%2Fwhoami) authentication service. Then, start playing with our system! The implementation of our API is [publicly disclosed](https://github.com/hei-school/hei-admin-api). You are welcome to try and compromise it. Happy hacking!
*
* The version of the OpenAPI document: 1.0
* The version of the OpenAPI document: latest
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion src/gen/haClient/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* HEI Admin API
* _Programmatically connect to a computer programming [school](https://hei.school)._ After [joining us](mailto:[email protected]), you can get an identification token from our [dev](https://dev-hei-admin.auth.eu-west-3.amazoncognito.com/oauth2/authorize?client_id=5s8cg50doahmu855rlc8fr6qmp&response_type=token&scope=email+openid&redirect_uri=https%3A%2F%2Fapi-dev.hei.school%2Fwhoami) or [prod](https://prod-hei-admin.auth.eu-west-3.amazoncognito.com/oauth2/authorize?client_id=i8bg538jpfu6mqmqb61m26trd&response_type=token&scope=email+openid&redirect_uri=https%3A%2F%2Fapi-prod.hei.school%2Fwhoami) authentication service. Then, start playing with our system! The implementation of our API is [publicly disclosed](https://github.com/hei-school/hei-admin-api). You are welcome to try and compromise it. Happy hacking!
*
* The version of the OpenAPI document: 1.0
* The version of the OpenAPI document: latest
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion src/gen/haClient/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* HEI Admin API
* _Programmatically connect to a computer programming [school](https://hei.school)._ After [joining us](mailto:[email protected]), you can get an identification token from our [dev](https://dev-hei-admin.auth.eu-west-3.amazoncognito.com/oauth2/authorize?client_id=5s8cg50doahmu855rlc8fr6qmp&response_type=token&scope=email+openid&redirect_uri=https%3A%2F%2Fapi-dev.hei.school%2Fwhoami) or [prod](https://prod-hei-admin.auth.eu-west-3.amazoncognito.com/oauth2/authorize?client_id=i8bg538jpfu6mqmqb61m26trd&response_type=token&scope=email+openid&redirect_uri=https%3A%2F%2Fapi-prod.hei.school%2Fwhoami) authentication service. Then, start playing with our system! The implementation of our API is [publicly disclosed](https://github.com/hei-school/hei-admin-api). You are welcome to try and compromise it. Happy hacking!
*
* The version of the OpenAPI document: 1.0
* The version of the OpenAPI document: latest
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
Loading

0 comments on commit 101b400

Please sign in to comment.