Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement xpCreateContract procedure #509

Open
KallynGowdy opened this issue Jul 11, 2024 · 0 comments
Open

Implement xpCreateContract procedure #509

KallynGowdy opened this issue Jul 11, 2024 · 0 comments
Assignees
Labels
area:backend Is related to the backend server. (Everything in aux-records and aux-server/aux-backend) area:xp-api Everything related to the xpAPI enhancement New feature or request

Comments

@KallynGowdy
Copy link
Member

Name: xpCreateContract
HTTP: POST /api/v2/xp/contract
Authentication: REQUIRED - sessionKey
Input:

{
    holdingUserId: z.string(),
    rate: z.number().int().nonnegative(),
    amount: z.numer().int().nonnegative(),
    description: z.string(),
}

Operation: Create a contract with the given holdingUserId, rate, amount, and description with issuerUserId = sessionKey.userId. The returned information should be limited to the information specified below.
Success Output:

{
    success: true,

    // Same contract output as xpGetUserIssuedContracts
    contract: {
        id: 'contract-id',
        issuerUserId: 'issuer-user-id',
        holdingUserId: 'holding-user-id',
        accountBalance: 123,
        accountCurrency: 'usd',
        accountEntries: [
            {
                id: 'entry-id',
                amount: 123,
                balance: 456,
                timeMs: 123,
                transactionId: 'transaction-id',
                note: 'string'
            }
        ],
        rate: 123,
        description: 'desc',
        status: 'open',
        accountId: 'account-id',
        createdAtMs: 123,
        updatedAtMs: 123
    }
}
@KallynGowdy KallynGowdy converted this from a draft issue Jul 11, 2024
@KallynGowdy KallynGowdy moved this from To triage to In progress in CasualOS Jul 11, 2024
@KallynGowdy KallynGowdy added enhancement New feature or request area:backend Is related to the backend server. (Everything in aux-records and aux-server/aux-backend) area:xp-api Everything related to the xpAPI labels Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:backend Is related to the backend server. (Everything in aux-records and aux-server/aux-backend) area:xp-api Everything related to the xpAPI enhancement New feature or request
Projects
Status: In progress
Development

No branches or pull requests

2 participants