fix: request-client should support conversion and network checks#975
fix: request-client should support conversion and network checks#975
Conversation
| paymentNetworkVersion?: string, | ||
| ): PaymentTypes.IPaymentNetwork { | ||
| const network = currencyNetwork || 'mainnet'; | ||
| const network = paymentChain ?? 'mainnet'; |
There was a problem hiding this comment.
Here, I think we could challenge this default choice. For another PR.
| const copiedRequestParameters = Utils.deepCopy(requestParameters); | ||
| copiedRequestParameters.extensionsData = []; | ||
|
|
||
| const detectionChain = |
There was a problem hiding this comment.
FYI I have prepared some refactoring of the payment network creation parameters, upcoming PR.
| @@ -0,0 +1,505 @@ | |||
| import axios from 'axios'; | |||
There was a problem hiding this comment.
Unchanged tests, just moved outside of index.test.ts because it is a huge section.
| // Integration tests | ||
| /* eslint-disable @typescript-eslint/no-unused-expressions */ | ||
| describe('index', () => { | ||
| describe('request-client.js', () => { |
There was a problem hiding this comment.
Light change (the rest is indentation)
| signer: TestData.payee.identity, | ||
| }); | ||
| expect(spy).toHaveBeenCalledTimes(1); | ||
| describe('API', () => { |
There was a problem hiding this comment.
Light change (the rest is indentation)
| }); | ||
|
|
||
| describe('tests with encryption', () => { | ||
| describe('Request Logic with encryption', () => { |
There was a problem hiding this comment.
Light change (the rest is indentation)
| paymentAddress: 'mgPKDuVmuS9oeE2D9VPiCQriyU14wxWS1v', | ||
| }, | ||
| }; | ||
| describe('Request Logic without encryption', () => { |
There was a problem hiding this comment.
Light change (the rest is indentation)
| }); | ||
| }); | ||
|
|
||
| describe('Conversion requests: payment chain should be deduced from the payment network parameters', () => { |
There was a problem hiding this comment.
Main change! These tests were breaking before the fix.
Description of the changes
This previous change broke the support for conversion payment networks with payment chain checks. The root cause of the issue actually belongs to the
request-client.jslibrary: the conversion requests were handled poorly from day 1.Includes:
request-clients.jstest file, which is huge (deserves deeper restructuring)