From a7992014a4c0186a0c12b8259965f3c3790224c9 Mon Sep 17 00:00:00 2001 From: Marcos Rivereto Date: Wed, 29 Nov 2023 14:41:07 -0300 Subject: [PATCH 01/10] Fix request signature --- .../request-signature.controller.ts | 16 +--- .../request-signature.utils.ts | 73 +++++++++++++++++++ 2 files changed, 76 insertions(+), 13 deletions(-) diff --git a/src/RequestSignature/request-signature.controller.ts b/src/RequestSignature/request-signature.controller.ts index 36b0d49..7cc5747 100644 --- a/src/RequestSignature/request-signature.controller.ts +++ b/src/RequestSignature/request-signature.controller.ts @@ -3,8 +3,8 @@ import { ConfigService } from '@nestjs/config'; import { ApiParam, ApiCreatedResponse} from '@nestjs/swagger' import { RequestSignatureService } from './request-signature.service'; import { EstablishDto } from '../Dtos/establish.dto'; -import { CustomerDto } from 'src/Dtos/customer.dto'; -import { AddressDto } from 'src/Dtos/address.dto'; +import { normalizeEstablishData } from './request-signature.utils'; + @Controller() export class RequestSignatureController { @@ -21,18 +21,8 @@ export class RequestSignatureController { let rawBody = req.rawBody; if (rawBody){ - let json = JSON.parse(rawBody.toString()); - if(json['customer.name']){ - let address = new AddressDto(); - address.country = json['customer.address.country']; - - let customer = new CustomerDto(); - customer.name = json['customer.name']; - customer.address = address; - - establish.customer = customer; - } + establish = normalizeEstablishData(establish, rawBody.toString()); } diff --git a/src/RequestSignature/request-signature.utils.ts b/src/RequestSignature/request-signature.utils.ts index 2c49dd7..a49cae2 100644 --- a/src/RequestSignature/request-signature.utils.ts +++ b/src/RequestSignature/request-signature.utils.ts @@ -1,4 +1,9 @@ +import { VerificationDto } from 'src/Dtos/verification.dto'; import { EstablishDto } from '../Dtos/establish.dto'; +import { CustomerDto } from 'src/Dtos/customer.dto'; +import { DriverLicenseDto } from 'src/Dtos/driveLicense.dto'; +import { AddressDto } from 'src/Dtos/address.dto'; +import { AccountDto } from 'src/Dtos/account.dto'; const CryptoSignature = require('crypto'); @@ -72,4 +77,72 @@ export const generateSignature = (establishData: EstablishDto, accessKey: string const requestSignature = CryptoSignature.createHmac('sha1', accessKey).update(query).digest('base64'); return requestSignature; +} + +export const normalizeEstablishData = (establish: EstablishDto, rawBody: string) => { + + if (rawBody) { + let json = JSON.parse(rawBody); + + if (json['verification']) { + let verification = new VerificationDto(); + verification.status = json['verification.status']; + verification.verifyCustomer = json['verification.verifyCustomer']; + + establish.verification = verification; + + } + + if(json['customer.name']) { + let customer = new CustomerDto(); + + customer.customerId = json['customer.customerId']; + customer.externalId = json['customer.externalId']; + customer.name = json['customer.name']; + customer.vip = json['customer.vip']; + customer.taxId = json['customer.taxId']; + + + let driverLicense = new DriverLicenseDto(); + driverLicense.number = json['customer.driverLicense.number']; + driverLicense.state = json['customer.driverLicense.state']; + + customer.driverLicense = driverLicense; + + let address = new AddressDto(); + + address.address1 = json['customer.address.address1']; + address.address2 = json['customer.address.address2']; + address.city = json['customer.address.city']; + address.state = json['customer.address.state']; + address.zip = json['customer.address.zip']; + address.country = json['customer.address.country']; + + customer.address = address; + + customer.phone = json['customer.phone']; + customer.email = json['customer.email']; + customer.balance = json['customer.balance']; + customer.currency = json['customer.currency']; + customer.enrollDate = json['customer.enrollDate']; + customer.dateOfBirth = json['customer.dateOfBirth']; + + establish.customer = customer; + } + + if (json['account.name']) { + let account = new AccountDto(); + + account.nameOnAccount = json['account.nameOnAccount']; + account.name = json['account.name']; + account.type = json['account.type']; + account.profile = json['account.profile']; + account.accountNumber = json['account.accountNumber']; + account.routingNumber = json['account.routingNumber']; + + establish.account = account; + } + } + + return establish; } \ No newline at end of file From 31d6ddad01dfcf76cce4fa3b82f3bc82a36f1f51 Mon Sep 17 00:00:00 2001 From: Renato DelPupo <16341269+renatodelpupo@users.noreply.github.com> Date: Fri, 1 Dec 2023 11:12:48 -0300 Subject: [PATCH 02/10] Format document --- README.md | 8 ++++++-- src/app.module.ts | 4 ++-- src/transaction/transaction.module.ts | 16 +++++++--------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 52f9e3d..e5044a2 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ Alpha Merchant App - Simple Backend

- ## Description Simple backend to demonstrate how to implement the endpoints to integrate with Trustly. @@ -19,24 +18,29 @@ $ git clone https://github.com/TrustlyInc/trustly-nestjs-example.git ``` ## Configuring Trustly API credentials + In the `.development.env` file replace environment variables values: + - ACCESS_ID - ACCESS_KEY - BASE_URL ## Install dependencies + ```bash # install dependencies $ npm install ``` ## Running the app + ```bash # development $ npm run start:dev ``` ## Swagger + ``` http://localhost:8080/api -``` \ No newline at end of file +``` diff --git a/src/app.module.ts b/src/app.module.ts index 11e2aed..934f2d9 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -9,12 +9,12 @@ import { TransactionModule } from './transaction/transaction.module'; @Module({ imports: [ ConfigModule.forRoot({ - envFilePath: '.development.env' + envFilePath: '.development.env', }), ServeStaticModule.forRoot({ rootPath: join(__dirname, '..', 'client'), }), - TransactionModule + TransactionModule, ], controllers: [RequestSignatureController], providers: [RequestSignatureService], diff --git a/src/transaction/transaction.module.ts b/src/transaction/transaction.module.ts index d4aba0b..21bda98 100644 --- a/src/transaction/transaction.module.ts +++ b/src/transaction/transaction.module.ts @@ -1,19 +1,17 @@ import { Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; -import { HttpModule } from "@nestjs/axios"; +import { HttpModule } from '@nestjs/axios'; import { TransactionService } from './transaction.service'; import { TransactionController } from './transaction.controller'; @Module({ - imports: [ - ConfigModule.forRoot({ - envFilePath: '.development.env' - }), - HttpModule, - ], + imports: [ + ConfigModule.forRoot({ + envFilePath: '.development.env', + }), + HttpModule, + ], controllers: [TransactionController], providers: [TransactionService], }) - export class TransactionModule {} - From a8119179f565051589e86f4af9298f6b0c3b74d9 Mon Sep 17 00:00:00 2001 From: Renato DelPupo <16341269+renatodelpupo@users.noreply.github.com> Date: Fri, 1 Dec 2023 11:14:54 -0300 Subject: [PATCH 03/10] Update .env file --- .development.env => .env.example | 0 .gitignore | 3 +++ README.md | 6 +----- src/app.module.ts | 2 +- src/transaction/transaction.module.ts | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) rename .development.env => .env.example (100%) diff --git a/.development.env b/.env.example similarity index 100% rename from .development.env rename to .env.example diff --git a/.gitignore b/.gitignore index 472010b..4b4c603 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,9 @@ /dist /node_modules +# environment variables file +.env + # Logs logs *.log diff --git a/README.md b/README.md index e5044a2..c46e6e4 100644 --- a/README.md +++ b/README.md @@ -19,11 +19,7 @@ $ git clone https://github.com/TrustlyInc/trustly-nestjs-example.git ## Configuring Trustly API credentials -In the `.development.env` file replace environment variables values: - -- ACCESS_ID -- ACCESS_KEY -- BASE_URL +Copy the `.env.example` file to a new `.env` file and fill out your environment variables. ## Install dependencies diff --git a/src/app.module.ts b/src/app.module.ts index 934f2d9..ba17952 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -9,7 +9,7 @@ import { TransactionModule } from './transaction/transaction.module'; @Module({ imports: [ ConfigModule.forRoot({ - envFilePath: '.development.env', + envFilePath: '.env', }), ServeStaticModule.forRoot({ rootPath: join(__dirname, '..', 'client'), diff --git a/src/transaction/transaction.module.ts b/src/transaction/transaction.module.ts index 21bda98..c3e6474 100644 --- a/src/transaction/transaction.module.ts +++ b/src/transaction/transaction.module.ts @@ -7,7 +7,7 @@ import { TransactionController } from './transaction.controller'; @Module({ imports: [ ConfigModule.forRoot({ - envFilePath: '.development.env', + envFilePath: '.env', }), HttpModule, ], From 82d099132798fefb0ba1185d88ed3c6478a0056e Mon Sep 17 00:00:00 2001 From: Renato DelPupo <16341269+renatodelpupo@users.noreply.github.com> Date: Wed, 29 Nov 2023 13:47:11 -0300 Subject: [PATCH 04/10] Format document --- .../request-signature.controller.ts | 62 ++++++++++++------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/src/RequestSignature/request-signature.controller.ts b/src/RequestSignature/request-signature.controller.ts index 36b0d49..efbea9d 100644 --- a/src/RequestSignature/request-signature.controller.ts +++ b/src/RequestSignature/request-signature.controller.ts @@ -1,6 +1,12 @@ -import { Body, Controller, Get, Post, RawBodyRequest, Req } from '@nestjs/common'; +import { + Body, + Controller, + Post, + RawBodyRequest, + Req, +} from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; -import { ApiParam, ApiCreatedResponse} from '@nestjs/swagger' +import { ApiParam, ApiCreatedResponse } from '@nestjs/swagger'; import { RequestSignatureService } from './request-signature.service'; import { EstablishDto } from '../Dtos/establish.dto'; import { CustomerDto } from 'src/Dtos/customer.dto'; @@ -8,34 +14,42 @@ import { AddressDto } from 'src/Dtos/address.dto'; @Controller() export class RequestSignatureController { - constructor(private readonly requestSignatureService: RequestSignatureService, private readonly configService: ConfigService) {} + constructor( + private readonly requestSignatureService: RequestSignatureService, + private readonly configService: ConfigService + ) {} - ACCESS_KEY = this.configService.get('ACCESS_KEY') + ACCESS_KEY = this.configService.get('ACCESS_KEY'); @Post('/signature') - @ApiParam({name: 'establish', required: true, schema: new EstablishDto() }) + @ApiParam({ name: 'establish', required: true, schema: new EstablishDto() }) @ApiCreatedResponse({ type: String, }) - createRequestSignature(@Body() establish: EstablishDto, @Req() req: RawBodyRequest): string { - let rawBody = req.rawBody; - - if (rawBody){ - let json = JSON.parse(rawBody.toString()); - - if(json['customer.name']){ - let address = new AddressDto(); - address.country = json['customer.address.country']; - - let customer = new CustomerDto(); - customer.name = json['customer.name']; - customer.address = address; - - establish.customer = customer; - } - + createRequestSignature( + @Body() establish: EstablishDto, + @Req() req: RawBodyRequest + ): string { + let rawBody = req.rawBody; + + if (rawBody) { + let json = JSON.parse(rawBody.toString()); + + if (json['customer.name']) { + let address = new AddressDto(); + address.country = json['customer.address.country']; + + let customer = new CustomerDto(); + customer.name = json['customer.name']; + customer.address = address; + + establish.customer = customer; } + } - return this.requestSignatureService.getRequestSignature(establish, this.ACCESS_KEY as string); + return this.requestSignatureService.getRequestSignature( + establish, + this.ACCESS_KEY as string + ); } -} \ No newline at end of file +} From 32b79c4a6ff53cc520ee7b2f79d697da699b758b Mon Sep 17 00:00:00 2001 From: Renato DelPupo <16341269+renatodelpupo@users.noreply.github.com> Date: Wed, 29 Nov 2023 13:50:49 -0300 Subject: [PATCH 05/10] Send response as JSON --- .../request-signature.controller.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/RequestSignature/request-signature.controller.ts b/src/RequestSignature/request-signature.controller.ts index efbea9d..e71df29 100644 --- a/src/RequestSignature/request-signature.controller.ts +++ b/src/RequestSignature/request-signature.controller.ts @@ -4,6 +4,7 @@ import { Post, RawBodyRequest, Req, + Res, } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; import { ApiParam, ApiCreatedResponse } from '@nestjs/swagger'; @@ -11,6 +12,7 @@ import { RequestSignatureService } from './request-signature.service'; import { EstablishDto } from '../Dtos/establish.dto'; import { CustomerDto } from 'src/Dtos/customer.dto'; import { AddressDto } from 'src/Dtos/address.dto'; +import { Response } from 'express'; @Controller() export class RequestSignatureController { @@ -28,8 +30,9 @@ export class RequestSignatureController { }) createRequestSignature( @Body() establish: EstablishDto, - @Req() req: RawBodyRequest - ): string { + @Req() req: RawBodyRequest, + @Res() res: Response + ): object { let rawBody = req.rawBody; if (rawBody) { @@ -47,9 +50,11 @@ export class RequestSignatureController { } } - return this.requestSignatureService.getRequestSignature( - establish, - this.ACCESS_KEY as string + return res.json( + this.requestSignatureService.getRequestSignature( + establish, + this.ACCESS_KEY as string + ) ); } } From 07268071dad3933df341606253ee38b5c7ec28de Mon Sep 17 00:00:00 2001 From: Renato DelPupo <16341269+renatodelpupo@users.noreply.github.com> Date: Wed, 29 Nov 2023 13:51:02 -0300 Subject: [PATCH 06/10] Fix CORS --- src/main.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main.ts b/src/main.ts index adcd31d..07e95da 100644 --- a/src/main.ts +++ b/src/main.ts @@ -5,6 +5,7 @@ import { AppModule } from './app.module'; async function bootstrap() { const app = await NestFactory.create(AppModule, { + cors: true, rawBody: true, }); From 4cece9d6e278ac984fdef198a819979ddc76ebfc Mon Sep 17 00:00:00 2001 From: Renato DelPupo <16341269+renatodelpupo@users.noreply.github.com> Date: Thu, 30 Nov 2023 16:27:51 -0300 Subject: [PATCH 07/10] Normalize object notation --- src/Dtos/establish.dto.ts | 6 ++- .../request-signature.controller.ts | 18 ++------ .../request-signature.utils.spec.ts | 21 ++++++++++ .../request-signature.utils.ts | 22 +++++++++- src/utils/normalize.spec.ts | 41 +++++++++++++++++++ src/utils/normalize.ts | 22 ++++++++++ 6 files changed, 113 insertions(+), 17 deletions(-) create mode 100644 src/RequestSignature/request-signature.utils.spec.ts create mode 100644 src/utils/normalize.spec.ts create mode 100644 src/utils/normalize.ts diff --git a/src/Dtos/establish.dto.ts b/src/Dtos/establish.dto.ts index f8a379b..c46df36 100644 --- a/src/Dtos/establish.dto.ts +++ b/src/Dtos/establish.dto.ts @@ -46,4 +46,8 @@ export class EstablishDto { account: AccountDto; @ApiProperty() transactionId: any; -} \ No newline at end of file +} + +export interface EstablishDto { + [key: string]: string | object; +} diff --git a/src/RequestSignature/request-signature.controller.ts b/src/RequestSignature/request-signature.controller.ts index e71df29..d3a601f 100644 --- a/src/RequestSignature/request-signature.controller.ts +++ b/src/RequestSignature/request-signature.controller.ts @@ -9,9 +9,8 @@ import { import { ConfigService } from '@nestjs/config'; import { ApiParam, ApiCreatedResponse } from '@nestjs/swagger'; import { RequestSignatureService } from './request-signature.service'; +import { normalizeEstablishData } from './request-signature.utils'; import { EstablishDto } from '../Dtos/establish.dto'; -import { CustomerDto } from 'src/Dtos/customer.dto'; -import { AddressDto } from 'src/Dtos/address.dto'; import { Response } from 'express'; @Controller() @@ -33,21 +32,10 @@ export class RequestSignatureController { @Req() req: RawBodyRequest, @Res() res: Response ): object { - let rawBody = req.rawBody; + const rawBody = req.rawBody; if (rawBody) { - let json = JSON.parse(rawBody.toString()); - - if (json['customer.name']) { - let address = new AddressDto(); - address.country = json['customer.address.country']; - - let customer = new CustomerDto(); - customer.name = json['customer.name']; - customer.address = address; - - establish.customer = customer; - } + establish = normalizeEstablishData(establish, rawBody); } return res.json( diff --git a/src/RequestSignature/request-signature.utils.spec.ts b/src/RequestSignature/request-signature.utils.spec.ts new file mode 100644 index 0000000..49eefb5 --- /dev/null +++ b/src/RequestSignature/request-signature.utils.spec.ts @@ -0,0 +1,21 @@ +import { EstablishDto } from '../Dtos/establish.dto'; +import { normalizeEstablishData } from './request-signature.utils'; + +describe('normalizeEstablishData', () => { + test('converts dot notation into nested object', () => { + const dotNotationExample = { 'customer.address.country': 'US' }; + const nestedObjectExpectation = { + customer: { address: { country: 'US' } }, + }; + + const establish = { + ...new EstablishDto(), + ...dotNotationExample, + }; + const rawBody = Buffer.from(JSON.stringify(dotNotationExample), 'utf-8'); + + const result = normalizeEstablishData(establish, rawBody); + + expect(result).toEqual(nestedObjectExpectation); + }); +}); diff --git a/src/RequestSignature/request-signature.utils.ts b/src/RequestSignature/request-signature.utils.ts index 2c49dd7..7dbe78f 100644 --- a/src/RequestSignature/request-signature.utils.ts +++ b/src/RequestSignature/request-signature.utils.ts @@ -1,4 +1,5 @@ import { EstablishDto } from '../Dtos/establish.dto'; +import { convertDotNotationIntoNestedObject } from '../utils/normalize'; const CryptoSignature = require('crypto'); @@ -72,4 +73,23 @@ export const generateSignature = (establishData: EstablishDto, accessKey: string const requestSignature = CryptoSignature.createHmac('sha1', accessKey).update(query).digest('base64'); return requestSignature; -} \ No newline at end of file +}; + +export const normalizeEstablishData = ( + establish: EstablishDto, + rawBody: Buffer +) => { + // Remove dot notations + for (const key in establish) { + if (key.includes('.')) delete establish[key]; + } + + // Add as nested objects + const jsonBody = JSON.parse(rawBody.toString()); + const objectLiteralBody = convertDotNotationIntoNestedObject(jsonBody); + for (const key in objectLiteralBody) { + establish[key] = objectLiteralBody[key]; + } + + return establish; +}; diff --git a/src/utils/normalize.spec.ts b/src/utils/normalize.spec.ts new file mode 100644 index 0000000..2c8828e --- /dev/null +++ b/src/utils/normalize.spec.ts @@ -0,0 +1,41 @@ +import { convertDotNotationIntoNestedObject } from './normalize'; + +describe('convertDotNotationIntoNestedObject', () => { + test('converts dot notation into nested object', () => { + const input = { + 'customer.address.country': 'US', + 'customer.email': 'john@us.com', + 'customer.name': 'John', + }; + + const expectedOutput = { + customer: { + address: { + country: 'US', + }, + email: 'john@us.com', + name: 'John', + }, + }; + + const result = convertDotNotationIntoNestedObject(input); + + expect(result).toEqual(expectedOutput); + }); + + test('returns the same object reference for object literal input', () => { + const input = { + customer: { + address: { + country: 'US', + }, + email: 'john@us.com', + name: 'John', + }, + }; + + const result = convertDotNotationIntoNestedObject(input); + + expect(result).toEqual(input); + }); +}); diff --git a/src/utils/normalize.ts b/src/utils/normalize.ts new file mode 100644 index 0000000..bb9236a --- /dev/null +++ b/src/utils/normalize.ts @@ -0,0 +1,22 @@ +type NestedObject = { [key: string]: NestedObject | string }; + +export function convertDotNotationIntoNestedObject( + obj: NestedObject +): NestedObject { + const result: NestedObject = {}; + + for (const key in obj) { + const parts = key.split('.'); + let current: NestedObject = result; + + for (let i = 0; i < parts.length - 1; i++) { + const part = parts[i]; + current[part] = current[part] || {}; + current = current[part] as NestedObject; + } + + current[parts[parts.length - 1]] = obj[key]; + } + + return result; +} From 02fdeda9427378662d482cfcb178ad42a188a907 Mon Sep 17 00:00:00 2001 From: Renato DelPupo <16341269+renatodelpupo@users.noreply.github.com> Date: Wed, 6 Dec 2023 11:41:16 -0300 Subject: [PATCH 08/10] Revert "Fix request signature" --- .../request-signature.controller.ts | 16 +++- .../request-signature.utils.ts | 73 ------------------- 2 files changed, 13 insertions(+), 76 deletions(-) diff --git a/src/RequestSignature/request-signature.controller.ts b/src/RequestSignature/request-signature.controller.ts index 7cc5747..36b0d49 100644 --- a/src/RequestSignature/request-signature.controller.ts +++ b/src/RequestSignature/request-signature.controller.ts @@ -3,8 +3,8 @@ import { ConfigService } from '@nestjs/config'; import { ApiParam, ApiCreatedResponse} from '@nestjs/swagger' import { RequestSignatureService } from './request-signature.service'; import { EstablishDto } from '../Dtos/establish.dto'; -import { normalizeEstablishData } from './request-signature.utils'; - +import { CustomerDto } from 'src/Dtos/customer.dto'; +import { AddressDto } from 'src/Dtos/address.dto'; @Controller() export class RequestSignatureController { @@ -21,8 +21,18 @@ export class RequestSignatureController { let rawBody = req.rawBody; if (rawBody){ + let json = JSON.parse(rawBody.toString()); - establish = normalizeEstablishData(establish, rawBody.toString()); + if(json['customer.name']){ + let address = new AddressDto(); + address.country = json['customer.address.country']; + + let customer = new CustomerDto(); + customer.name = json['customer.name']; + customer.address = address; + + establish.customer = customer; + } } diff --git a/src/RequestSignature/request-signature.utils.ts b/src/RequestSignature/request-signature.utils.ts index a49cae2..2c49dd7 100644 --- a/src/RequestSignature/request-signature.utils.ts +++ b/src/RequestSignature/request-signature.utils.ts @@ -1,9 +1,4 @@ -import { VerificationDto } from 'src/Dtos/verification.dto'; import { EstablishDto } from '../Dtos/establish.dto'; -import { CustomerDto } from 'src/Dtos/customer.dto'; -import { DriverLicenseDto } from 'src/Dtos/driveLicense.dto'; -import { AddressDto } from 'src/Dtos/address.dto'; -import { AccountDto } from 'src/Dtos/account.dto'; const CryptoSignature = require('crypto'); @@ -77,72 +72,4 @@ export const generateSignature = (establishData: EstablishDto, accessKey: string const requestSignature = CryptoSignature.createHmac('sha1', accessKey).update(query).digest('base64'); return requestSignature; -} - -export const normalizeEstablishData = (establish: EstablishDto, rawBody: string) => { - - if (rawBody) { - let json = JSON.parse(rawBody); - - if (json['verification']) { - let verification = new VerificationDto(); - verification.status = json['verification.status']; - verification.verifyCustomer = json['verification.verifyCustomer']; - - establish.verification = verification; - - } - - if(json['customer.name']) { - let customer = new CustomerDto(); - - customer.customerId = json['customer.customerId']; - customer.externalId = json['customer.externalId']; - customer.name = json['customer.name']; - customer.vip = json['customer.vip']; - customer.taxId = json['customer.taxId']; - - - let driverLicense = new DriverLicenseDto(); - driverLicense.number = json['customer.driverLicense.number']; - driverLicense.state = json['customer.driverLicense.state']; - - customer.driverLicense = driverLicense; - - let address = new AddressDto(); - - address.address1 = json['customer.address.address1']; - address.address2 = json['customer.address.address2']; - address.city = json['customer.address.city']; - address.state = json['customer.address.state']; - address.zip = json['customer.address.zip']; - address.country = json['customer.address.country']; - - customer.address = address; - - customer.phone = json['customer.phone']; - customer.email = json['customer.email']; - customer.balance = json['customer.balance']; - customer.currency = json['customer.currency']; - customer.enrollDate = json['customer.enrollDate']; - customer.dateOfBirth = json['customer.dateOfBirth']; - - establish.customer = customer; - } - - if (json['account.name']) { - let account = new AccountDto(); - - account.nameOnAccount = json['account.nameOnAccount']; - account.name = json['account.name']; - account.type = json['account.type']; - account.profile = json['account.profile']; - account.accountNumber = json['account.accountNumber']; - account.routingNumber = json['account.routingNumber']; - - establish.account = account; - } - } - - return establish; } \ No newline at end of file From fb6c307574f32f2773c5f6e54f75b4bb0051a623 Mon Sep 17 00:00:00 2001 From: Renato DelPupo <16341269+renatodelpupo@users.noreply.github.com> Date: Tue, 5 Mar 2024 17:12:35 -0300 Subject: [PATCH 09/10] Create Pull Request Template --- .github/pull_request_template.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..8106395 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,30 @@ +### Description + +_(Insert pull request description)_ + +--- + +### Relevant Commits + +_(List of main updates)_ + +--- + +### Requirements + +_(Please check if your pull request fulfills the following requirements)_ + +- [ ] Changes were properly tested (attach evidence if applicable) +- [ ] Repository's code-style/linting compliant + +--- + +### Evidence + +_(Insert any evidence related to this pull request. Leave it as **"None"** or **"Not applicable"** if you have nothing to add)_ + +--- + +### Additional Information + +_(Insert any additional information related to this pull request, as more context or Jira ticket. Leave it as **"None"** or **"Not applicable"** if you have nothing to add)_ From 987f43e70274dbff43d96854da425cc85f951c8d Mon Sep 17 00:00:00 2001 From: Renato DelPupo <16341269+renatodelpupo@users.noreply.github.com> Date: Tue, 5 Mar 2024 17:13:53 -0300 Subject: [PATCH 10/10] Add Contributing instructions to README --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index c46e6e4..1d2ea7f 100644 --- a/README.md +++ b/README.md @@ -40,3 +40,9 @@ $ npm run start:dev ``` http://localhost:8080/api ``` + +# Contributing + +You can participate in this project by submitting bugs and feature requests in the [Issues](https://github.com/TrustlyInc/trustly-nestjs-example/issues) tab. Please, add [@lukevance](https://github.com/lukevance) as an assignee. + +If you are interested in fixing issues and contributing directly to the code base, feel free to open a Pull Request with your changes. Please, make sure to fulfill our [Pull Request Template](https://github.com/TrustlyInc/trustly-nestjs-example/blob/main/.github/pull_request_template.md) and add [@lukevance](https://github.com/lukevance) as code reviewer.