import { GraphQLClient, gql } from 'graphql-request';
import crypto from 'crypto';
const API_URL = 'https://transactional-graph.staging.fluzapp.com/api/v1/graphql';
const MIN_DEPOSIT_AMOUNT = 100;
async function deposit(userToken) {
const client = new GraphQLClient(API_URL, {
headers: {
Authorization: `Bearer ${userToken}`,
'Content-Type': 'application/json',
},
});
const DEPOSIT = gql`
mutation depositCashBalance($input: DepositCashBalanceInput!) {
depositCashBalance(input: $input) {
cashBalanceDeposits {
cashBalanceDepositId
status
}
}
}
`;
const input = {
idempotencyKey: crypto.randomUUID(),
amount: 100,
depositType: 'CASH_BALANCE',
bankAccountId: '<<BANK_ACCOUNT_ID>>',
};
const res = await client.request(DEPOSIT, { input });
return res.depositCashBalance;
}
MAKE_DEPOSIT.
Relacionado: Ingresos.