-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/feat/fx-impl' into feat/fx-impl
- Loading branch information
Showing
13 changed files
with
272 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Notes: these changes are required for the quoting-service and are not used by central-ledger | ||
'use strict' | ||
|
||
exports.up = (knex) => { | ||
return knex.schema.hasTable('fxQuote').then((exists) => { | ||
if (!exists) { | ||
return knex.schema.createTable('fxQuote', (t) => { | ||
t.string('conversionRequestId', 36).primary().notNullable() | ||
|
||
// time keeping | ||
t.dateTime('expirationDate').defaultTo(null).nullable().comment('Optional expiration for the requested transaction') | ||
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable().comment('System dateTime stamp pertaining to the inserted record') | ||
}) | ||
} | ||
}) | ||
} | ||
|
||
exports.down = (knex) => { | ||
return knex.schema.dropTableIfExists('fxQuote') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict' | ||
|
||
exports.up = (knex) => { | ||
return knex.schema.hasTable('fxQuoteResponse').then((exists) => { | ||
if (!exists) { | ||
return knex.schema.createTable('fxQuoteResponse', (t) => { | ||
t.bigIncrements('fxQuoteResponseId').primary().notNullable() | ||
|
||
// reference to the original fxQuote | ||
t.string('conversionRequestId', 36).notNullable() | ||
t.foreign('conversionRequestId').references('conversionRequestId').inTable('fxQuote') | ||
|
||
// ilpCondition sent in FXP response | ||
t.string('ilpCondition', 256).notNullable() | ||
|
||
// time keeping | ||
t.dateTime('expirationDate').defaultTo(null).nullable().comment('Optional expiration for the requested transaction') | ||
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable().comment('System dateTime stamp pertaining to the inserted record') | ||
}) | ||
} | ||
}) | ||
} | ||
|
||
exports.down = (knex) => { | ||
return knex.schema.dropTableIfExists('fxQuoteResponse') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Notes: these changes are required for the quoting-service and are not used by central-ledger | ||
'use strict' | ||
|
||
exports.up = (knex) => { | ||
return knex.schema.hasTable('fxQuoteError').then((exists) => { | ||
if (!exists) { | ||
return knex.schema.createTable('fxQuoteError', (t) => { | ||
t.bigIncrements('fxQuoteErrorId').primary().notNullable() | ||
t.string('conversionRequestId', 36).notNullable() | ||
t.foreign('conversionRequestId').references('conversionRequestId').inTable('fxQuote') | ||
t.bigInteger('fxQuoteResponseId').unsigned().defaultTo(null).nullable().comment('The response to the initial fxQuote') | ||
t.foreign('fxQuoteResponseId').references('fxQuoteResponseId').inTable('fxQuoteResponse') | ||
t.integer('errorCode').unsigned().notNullable() | ||
t.string('errorDescription', 128).notNullable() | ||
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable() | ||
}) | ||
} | ||
}) | ||
} | ||
|
||
exports.down = (knex) => { | ||
return knex.schema.dropTableIfExists('quoteError') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Notes: these changes are required for the quoting-service and are not used by central-ledger | ||
'use strict' | ||
|
||
exports.up = (knex) => { | ||
return knex.schema.hasTable('fxQuoteDuplicateCheck').then((exists) => { | ||
if (!exists) { | ||
return knex.schema.createTable('fxQuoteDuplicateCheck', (t) => { | ||
t.string('conversionRequestId', 36).primary().notNullable() | ||
t.string('hash', 1024).defaultTo(null).nullable().comment('hash value received for the quote request') | ||
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable().comment('System dateTime stamp pertaining to the inserted record') | ||
}) | ||
} | ||
}) | ||
} | ||
|
||
exports.down = (knex) => { | ||
return knex.schema.dropTableIfExists('fxQuoteDuplicateCheck') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Notes: these changes are required for the quoting-service and are not used by central-ledger | ||
'use strict' | ||
|
||
exports.up = (knex) => { | ||
return knex.schema.hasTable('fxQuoteResponseDuplicateCheck').then((exists) => { | ||
if (!exists) { | ||
return knex.schema.createTable('fxQuoteResponseDuplicateCheck', (t) => { | ||
t.bigIncrements('fxQuoteResponseId').primary().unsigned().comment('The response to the initial quote') | ||
t.foreign('fxQuoteResponseId').references('fxQuoteResponseId').inTable('fxQuoteResponse') | ||
t.string('conversionRequestId', 36).notNullable() | ||
t.foreign('conversionRequestId').references('conversionRequestId').inTable('fxQuote') | ||
t.string('hash', 255).defaultTo(null).nullable().comment('hash value received for the quote response') | ||
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable().comment('System dateTime stamp pertaining to the inserted record') | ||
}) | ||
} | ||
}) | ||
} | ||
|
||
exports.down = (knex) => { | ||
return knex.schema.dropTableIfExists('fxQuoteResponseDuplicateCheck') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'use strict' | ||
|
||
exports.up = (knex) => { | ||
return knex.schema.hasTable('fxQuoteConversionTerms').then((exists) => { | ||
if (!exists) { | ||
return knex.schema.createTable('fxQuoteConversionTerms', (t) => { | ||
t.string('conversionId').primary().notNullable() | ||
|
||
// reference to the original fxQuote | ||
t.string('conversionRequestId', 36).notNullable() | ||
t.foreign('conversionRequestId').references('conversionRequestId').inTable('fxQuote') | ||
|
||
t.integer('amountTypeId').unsigned().notNullable().comment('This is part of the transaction type that contains valid elements for - Amount Type') | ||
t.foreign('amountTypeId').references('amountTypeId').inTable('amountType') | ||
t.string('initiatingFsp', 255) | ||
t.string('counterPartyFsp', 255) | ||
t.decimal('sourceAmount', 18, 4).notNullable() | ||
t.string('sourceCurrency', 3).notNullable() | ||
t.foreign('sourceCurrency').references('currencyId').inTable('currency') | ||
t.decimal('targetAmount', 18, 4).notNullable() | ||
t.string('targetCurrency', 3).notNullable() | ||
t.foreign('targetCurrency').references('currencyId').inTable('currency') | ||
|
||
// time keeping | ||
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable().comment('System dateTime stamp pertaining to the inserted record') | ||
}) | ||
} | ||
}) | ||
} | ||
|
||
exports.down = (knex) => { | ||
return knex.schema.dropTableIfExists('fxQuoteConversionTerms') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Notes: these changes are required for the quoting-service and are not used by central-ledger | ||
'use strict' | ||
|
||
exports.up = (knex) => { | ||
return knex.schema.hasTable('fxQuoteConversionTermExtension').then((exists) => { | ||
if (!exists) { | ||
return knex.schema.createTable('fxQuoteConversionTermExtension', (t) => { | ||
t.bigIncrements('fxQuoteConversionTermExtension').primary().notNullable() | ||
t.string('conversionId', 36).notNullable() | ||
t.foreign('conversionId').references('conversionId').inTable('fxQuoteConversionTerms') | ||
t.string('key', 128).notNullable() | ||
t.text('value').notNullable() | ||
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable().comment('System dateTime stamp pertaining to the inserted record') | ||
}) | ||
} | ||
}) | ||
} | ||
|
||
exports.down = (knex) => { | ||
return knex.schema.dropTableIfExists('fxQuoteConversionTermExtension') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
'use strict' | ||
|
||
exports.up = (knex) => { | ||
return knex.schema.hasTable('fxQuoteResponseConversionTerms').then((exists) => { | ||
if (!exists) { | ||
return knex.schema.createTable('fxQuoteResponseConversionTerms', (t) => { | ||
t.string('conversionId').primary().notNullable() | ||
|
||
// reference to the original fxQuote | ||
t.string('conversionRequestId', 36).notNullable() | ||
t.foreign('conversionRequestId').references('conversionRequestId').inTable('fxQuote') | ||
|
||
// reference to the original fxQuoteResponse | ||
t.bigIncrements('fxQuoteResponseId', 36).notNullable() | ||
t.foreign('fxQuoteResponseId').references('fxQuoteResponseId').inTable('fxQuoteResponse') | ||
|
||
t.integer('amountTypeId').unsigned().notNullable().comment('This is part of the transaction type that contains valid elements for - Amount Type') | ||
t.foreign('amountTypeId').references('amountTypeId').inTable('amountType') | ||
t.string('initiatingFsp', 255) | ||
t.string('counterPartyFsp', 255) | ||
t.decimal('sourceAmount', 18, 4).notNullable() | ||
t.string('sourceCurrency', 3).notNullable() | ||
t.foreign('sourceCurrency').references('currencyId').inTable('currency') | ||
t.decimal('targetAmount', 18, 4).notNullable() | ||
t.string('targetCurrency', 3).notNullable() | ||
t.foreign('targetCurrency').references('currencyId').inTable('currency') | ||
|
||
// time keeping | ||
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable().comment('System dateTime stamp pertaining to the inserted record') | ||
}) | ||
} | ||
}) | ||
} | ||
|
||
exports.down = (knex) => { | ||
return knex.schema.dropTableIfExists('fxQuoteResponseConversionTerms') | ||
} |
21 changes: 21 additions & 0 deletions
21
migrations/950118_fxQuoteResponseConversionTermExtension.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Notes: these changes are required for the quoting-service and are not used by central-ledger | ||
'use strict' | ||
|
||
exports.up = (knex) => { | ||
return knex.schema.hasTable('fxQuoteResponseConversionTermExtension').then((exists) => { | ||
if (!exists) { | ||
return knex.schema.createTable('fxQuoteResponseConversionTermExtension', (t) => { | ||
t.bigIncrements('fxQuoteResponseConversionTermExtension').primary().notNullable() | ||
t.string('conversionId', 36).notNullable() | ||
t.foreign('conversionId').references('conversionId').inTable('fxQuoteResponseConversionTerms') | ||
t.string('key', 128).notNullable() | ||
t.text('value').notNullable() | ||
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable().comment('System dateTime stamp pertaining to the inserted record') | ||
}) | ||
} | ||
}) | ||
} | ||
|
||
exports.down = (knex) => { | ||
return knex.schema.dropTableIfExists('fxQuoteResponseConversionTermExtension') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict' | ||
|
||
exports.up = (knex) => { | ||
return knex.schema.hasTable('fxCharge').then((exists) => { | ||
if (!exists) { | ||
return knex.schema.createTable('fxCharge', (t) => { | ||
t.bigIncrements('fxChargeId').primary().notNullable() | ||
t.string('chargeType', 32).notNullable().comment('A description of the charge which is being levied.') | ||
|
||
// fxCharge should only be sent back in the response to an fxQuote | ||
// so reference the terms in fxQuoteResponse `conversionTerms` | ||
t.string('conversionId', 36).notNullable() | ||
t.foreign('conversionId').references('conversionId').inTable('fxQuoteResponseConversionTerms') | ||
|
||
t.decimal('sourceAmount', 18, 4).nullable().comment('The amount of the charge which is being levied, expressed in the source currency.') | ||
t.string('sourceCurrency', 3).nullable().comment('The currency in which the source amount charge is being levied.') | ||
|
||
t.decimal('targetAmount', 18, 4).nullable().comment('The amount of the charge which is being levied, expressed in the target currency.') | ||
t.string('targetCurrency', 3).nullable().comment('The currency in which the target amount charge is being levied.') | ||
}) | ||
} | ||
}) | ||
} | ||
|
||
exports.down = (knex) => { | ||
return knex.schema.dropTableIfExists('fxCharge') | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters