Skip to content

Commit 4edbc0d

Browse files
authored
Merge pull request #11 from blecorre/fix/improve-simard-pay
fix: update simard pay quote schemas
2 parents 5843677 + 7ccdfca commit 4edbc0d

File tree

2 files changed

+66
-24
lines changed

2 files changed

+66
-24
lines changed

src/shared-definitions.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -963,6 +963,15 @@ components:
963963

964964
Quote:
965965
description: A quote for exchange between currencies
966+
required:
967+
[
968+
'quoteId',
969+
'sourceCurrency',
970+
'sourceAmount',
971+
'targetCurrency',
972+
'targetAmount',
973+
'rate',
974+
]
966975
type: object
967976
properties:
968977
quoteId:
@@ -980,6 +989,38 @@ components:
980989
rate:
981990
$ref: '#/components/schemas/Rate'
982991

992+
QuoteRequest:
993+
description: A quote request for exchange between currencies
994+
required: ['sourceCurrency', 'targetCurrency']
995+
type: object
996+
oneOf:
997+
- $ref: '#/components/schemas/ConvertFromSource'
998+
- $ref: '#/components/schemas/ConvertToTarget'
999+
1000+
ConvertFromSource:
1001+
description: Convert sourceAmount to targetAmount
1002+
required: ['sourceCurrency', 'sourceAmount', 'targetCurrency']
1003+
type: object
1004+
properties:
1005+
sourceCurrency:
1006+
$ref: '#/components/schemas/Currency'
1007+
sourceAmount:
1008+
$ref: '#/components/schemas/Amount'
1009+
targetCurrency:
1010+
$ref: '#/components/schemas/Currency'
1011+
1012+
ConvertToTarget:
1013+
description: Compute the sourceAmount such as the conversion of sourceAmount matches targetAmount
1014+
required: ['sourceCurrency', 'targetCurrency', 'targetAmount']
1015+
type: object
1016+
properties:
1017+
sourceCurrency:
1018+
$ref: '#/components/schemas/Currency'
1019+
targetCurrency:
1020+
$ref: '#/components/schemas/Currency'
1021+
targetAmount:
1022+
$ref: '#/components/schemas/Amount'
1023+
9831024
Card:
9841025
description: A payment card
9851026
type: object

src/simard-pay.yaml

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@ info:
1111
version: 1.0.1
1212

1313
servers:
14-
- url: https://staging.payment.simard.io/api/v1
15-
description: The Simard Pay Staging server
14+
- url: https://staging.payment.simard.io/api/v1
15+
description: The Simard Pay Staging server
1616

1717
tags:
18-
- name: balances
19-
description: Operations with Balances
20-
- name: quotes
21-
description: Operations with currency conversions
22-
- name: accounts
23-
description: Operation with recipient accounts
24-
- name: cards
25-
description: Operation with virtual cards
26-
- name: tokens
27-
description: Operations with card tokens
28-
- name: test
29-
description: Operations available only in test environments
18+
- name: balances
19+
description: Operations with Balances
20+
- name: quotes
21+
description: Operations with currency conversions
22+
- name: accounts
23+
description: Operation with recipient accounts
24+
- name: cards
25+
description: Operation with virtual cards
26+
- name: tokens
27+
description: Operations with card tokens
28+
- name: test
29+
description: Operations available only in test environments
3030

3131
paths:
3232
/balances:
@@ -193,10 +193,10 @@ paths:
193193
$ref: '#/components/schemas/Guarantee'
194194
example:
195195
{
196-
"currency": "USD",
197-
"amount": "300.00",
198-
"creditorOrgId": "0x71cd1781a3082f33d2521ac8290c9d4b3b3b116e4e8548a4914b71a1f7201da0",
199-
"expiration": "2020-03-30T13:37:38.835Z",
196+
'currency': 'USD',
197+
'amount': '300.00',
198+
'creditorOrgId': '0x71cd1781a3082f33d2521ac8290c9d4b3b3b116e4e8548a4914b71a1f7201da0',
199+
'expiration': '2020-03-30T13:37:38.835Z',
200200
}
201201
responses:
202202
200:
@@ -444,7 +444,7 @@ paths:
444444
/accounts:
445445
post:
446446
tags:
447-
- accounts
447+
- accounts
448448
summary: Provides a recipient account
449449
operationId: registerAccount
450450
requestBody:
@@ -714,7 +714,7 @@ paths:
714714
content:
715715
application/json:
716716
schema:
717-
$ref: '#/components/schemas/Quote'
717+
$ref: '#/components/schemas/QuoteRequest'
718718
responses:
719719
200:
720720
description: Quote has been created
@@ -753,7 +753,7 @@ paths:
753753
$ref: '#/components/schemas/UUID'
754754
get:
755755
tags:
756-
- quotes
756+
- quotes
757757
summary: Retrieve a quote
758758
operationId: retrieveQuote
759759
responses:
@@ -816,6 +816,7 @@ paths:
816816
application/json:
817817
schema:
818818
type: object
819+
required: ['rate']
819820
properties:
820821
rate:
821822
$ref: '#/components/schemas/Rate'
@@ -975,7 +976,7 @@ paths:
975976
schema:
976977
$ref: '#/components/schemas/Error'
977978
security:
978-
- bearerAuth: []
979+
- bearerAuth: []
979980

980981
/tokens/travel-account:
981982
post:
@@ -1072,7 +1073,7 @@ paths:
10721073
schema:
10731074
$ref: '#/components/schemas/Error'
10741075
security:
1075-
- bearerAuth: []
1076+
- bearerAuth: []
10761077

10771078
/intents:
10781079
post:
@@ -1114,4 +1115,4 @@ paths:
11141115
schema:
11151116
$ref: '#/components/schemas/Error'
11161117
security:
1117-
- bearerAuth: []
1118+
- bearerAuth: []

0 commit comments

Comments
 (0)