npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@swp/swipe-sdk

v0.12.71

Published

Integration with our api.

Downloads

156

Readme

SWIPE SDK

Integration with our api.

Table of Contents

Install

Using npm:

$ npm install @swp/swipe-sdk

Examples

The sdk have type system in typescript

Initialize

import { Swipe } from '@swp/swipe-sdk'
const sdk = new Swipe({
    apiKey: string, // Ex: key
    secret: string, // Ex: secret
    sandbox?: boolean, // default false to acess prod
    customHost?: string, // default null
    debug?: boolean // default false
})

Ledger

  • hello
const data = sdk.Ledger.hello()
  • getMyAccount
const data = sdk.Ledger.getMyAccount()
  • createChildrenAccounts
const newAccounts = [
    {
        fields?: {
            '...': '...', // string:string Ex: 'clientType': 'common'
            ...
        }
    },
    ...
]
const data = sdk.Ledger.createChildrenAccounts(newAccounts)
const searchOption = {
    queryParams?: {
        '...': '...',
        ...
    },
    pagination?: {
        limit?: number, // number bigger than 0
        starting_after: number //number bigger than 0
    },
    fields?: {
        '...': '...', // string:string Ex: 'clientType': 'common'
        ...
    }
}
const data = sdk.Ledger.getChildrenAccounts(searchOption?)
  • getChildAccount
const accountId: string = '...'
const data = sdk.Ledger.getChildAccount(accountId)
  • destroyAccount
const accountId: string = '...'
const data = sdk.Ledger.destroyAccount(accountId)
  • createAsset
const asset = {
    code: string, // Ex: 'BRL' or 'USD' or 'Banana'
    decimalPlaces?: number, // for have a asset like '5.00000' set 5
    fields?: {
        '...': '...', // string:string Ex: 'clientType': 'common'
        ...
    }
}
const data = sdk.Ledger.createAsset(asset)
  • getAssets
const searchOptions = {
    queryParams?: {
        '...': '...',
        ...
    },
    pagination?: {
        limit?: number, // number bigger than 0
        starting_after: number //number bigger than 0
    },
    fields?: {
        '...': '...', // string:string Ex: 'clientType': 'common'
        ...
    }
}
const data = sdk.Ledger.getAssets(searchOptions)
  • getAsset
const assetId:string = '...'
const data = sdk.Ledger.getAsset(assetId)
  • getActionBatches
const searchOptions = {
    queryParams?: {
        'fromDate': string, // Ex: '2020-12-18T16:19:09.000Z'
    	'toDate': string, // Ex: '2020-12-18T16:19:09.000Z'
    	'type': ActionType.TRANSFER | ActionType.ISSUE_ASSET | ActionType.BURN_ASSET
        ...
    },
    pagination?: {
        limit?: number, // number bigger than 0
        starting_after: number //number bigger than 0
    },
    fields?: {
        '...': '...', // string:string Ex: 'clientType': 'common'
        ...
    }
}
const data = sdk.Ledger.getActionBatches(searchOptions)
  • getActionBatch
const batchId:string = '...'
const data = sdk.Ledger.getActionBatch(batchId)
  • newActionBatch
const newActionsBatchs = {
    actions: [
        {
            type: ActionType.TRANSFER,
            amount: string, // Ex: '2.7'
            from: string, // senderId
            to: string, // receiverId
            assetId: string // assetId
        },
        {
            type: ActionType.ISSUE_ASSET,
            amount: string, // Ex: '4.20'
            to: string, // receiverId
            assetId: string // assetId
        },
        {
            type: ActionType.BURN_ASSET,
            amount: string, // Ex: '3.141549'
            from: string, // senderId
            assetId: string // assetId
        },
        ...
    ],
    fields?: {
        '...': '...', // string:string Ex: 'clientType': 'common'
        ...
    }
}
const data = sdk.Ledger.newActionBatch(newActionsBatchs)
  • revokeCredentialGetToken
const data = sdk.Ledger.revokeCredentialGetToken()
  • revokeCredential
const token:string = '...'
const data = sdk.Ledger.revokeCredential(token)
  • resetAll
const data = sdk.Ledger.resetAll()

Profile

  • addProfileToAccount
const accountId:string = '...'

const profile = {
    name: string, // Ex: 'Frederico Ferreira Franco'
    email: string, // Ex: '[email protected]'
    phone: string, // Ex: ''+5511900000000'
    cpf: string, // Ex: '000.000.000-00'
    birthDate: string, // Ex: '1990-12-17'
    motherName: string, // Ex: 'Francisca Ferreica Franco'
    fields?: {
        '...': '...', // string:string Ex: 'clientType': 'common'
        ...
    }
}

const data = sdk.Profile.addProfileToAccount(accountId, profile)
  • addProfileToAccountCompany
const profileCompany = {
    name: string, //: Ex: 'Swipe"
    corporateName: string, // Ex: 'Swipe'
    cnpj: string, // Ex: '00.000.000/0000-00' or '00000000000000'
    email: string, // Ex: '[email protected]'
    phone: string, // Ex: '11900000000'
    cnae?: string, // Ex: 'Agricultor'
    openingDate: string, // Ex: '1990-12-17'
    fields?: {
        '...': '...', // string:string Ex: 'clientType': 'common'
        ...
    },
    companyPartner: {
        name: string, // Ex: 'Francisco Ferreiro'
        cpf: string, // Ex: '000.000.000-00' or '00000000000'
        birthDate: string, // Ex: '1990-12-17'
        motherName: string, // Ex: 'Maria Ferreiro'
        cellphone?: string, // Ex: '11900000000'
        fields?: {
            '...': '...', // string:string Ex: 'clientType': 'common'
            ...
        }
    }
}

const data = sdk.Profile.addProfileToAccountCompany(accountId, profileCompany)
  • addAddressToProfile
const accountId:string = '...'

const address = {
    zipCode: string, // Ex: '000000-000'
    city: string, // Ex: 'São João do Rio do Peixe'
    complement?: string, // Ex: 'Logo ali depois da praça do peixe'
    country: string, // Ex: 'BR'
    neighborhood: string, // Ex: 'centro'
    number: string, // Ex: '42'
    state: string, // Ex: 'SP'
    street: string, // Ex: 'Av. Brasil'
}

const data = sdk.Profile.addAddressToProfile(accountId, address)
  • addDocumentsToProfile
const accountId:string = '...'

const documents = {
    frontSide: string, // Ex: 'C:/Images/image.png'
    backSide?: string, // Ex: 'C:/Images/image.png'
    proofOfResidence: string, // Ex: 'C:/Images/image.png'
    selfie: string // Ex: 'C:/Images/image.png'
}

const data = sdk.Profile.addDocumentsToProfile(accountId, documents)
  • addDocumentsToProfileCompany
const accountId:string = '...'

const documents = {
    frontSide: string, // Ex: 'C:/Images/image.png'
    backSide?: string, // Ex: 'C:/Images/image.png'
    proofOfResidence: string, // Ex: 'C:/Images/image.png'
    selfie: string, // Ex: 'C:/Images/image.png'
    socialContract: string, // Ex: 'C:/Images/image.png'
    cnpjCard: string // Ex: 'C:/Images/image.png'
}

const data = sdk.Profile.addDocumentsToProfileCompany(accountId, documents)
  • getProfile
const accountId:string = '...'
const data = sdk.Profile.getProfile(accountId)
  • resetRejectedProfile
const accountId:string = '...'
const data = sdk.Profile.resetRejectedProfile(accountId)
  • aproveProfile
const accountId:string = '...'
const data = sdk.Profile.aproveProfile(accountId)
  • rejectProfile
const accountId:string = '...'
const data = sdk.Profile.rejectProfile(accountId)
  • getUsers
 const searchOptions = {
     queryParams?: {
        'with_balance': boolean,
        'name': string,
        'document': string,
        'status': boolean,
         ...
     },
     pagination?: {
         limit?: number, // number bigger than 0
         starting_after: number //number bigger than 0
     }
 }
 const data = sdk.profile.getUsers(searchOptions)

Cash-In

  • newBoleto
const boleto = {
    amount: string, // Ex: '42.0'
    depositAccount: string, // Ex: 'id'
    dueDate: string, // Ex: '2020-08-01T13:38:24.600Z'
    split?: [
        {
            accountId: string, // Ex: accountId
            percentage: number // Ex: 0.55
        }
    ]
    fields?: {
        '...': '...', // string:string Ex: 'clientType': 'common'
        ...
    }
}

const data = sdk.CashIn.newBoleto(id)
  • getBoleto
const boletoId:string = '...'
const data = sdk.CashIn.getBoleto(boletoId)
  • boletoPaymentSimulation
const boletoId:string = '...'
const data = sdk.CashIn.boletoPaymentSimulation(boletoId)
  • getBoletoByBarCode
const barCode: string = '...'
const data = sdk.CashIn.getBoletoByBarCode(barCode)
  • getAllBoletos
const searchOptions = {
    queryParams?: {
        'fromDate': string, // Ex: '2020-12-18T16:19:09.000Z'
    	'toDate': string, // Ex: '2020-12-18T16:19:09.000Z'
        ...
    },
    pagination?: {
        limit?: number, // number bigger than 0
        starting_after: number //number bigger than 0
    },
    fields?: {
        '...': '...', // string:string Ex: 'clientType': 'common'
        ...
    }
}
const data = sdk.CashIn.getAllBoletos(searchOptions)
  • newTokenCreditCard
const creditCardCustomer = {
    buyer?: {
        document?: string // Ex: '00000000000'
    },
    creditCard: {
        cardNumber: string, // Ex: '0000000000000000'
        holderName: string, // Ex: 'João S Silveira'
        expirationMonth: string, // Ex: '07'
        expirationYear: string, // Ex: '2042'
        securityCode: string, // Ex: '097'
    }
}

const data = sdk.CashIn.newTokenCreditCard(creditCardCustomer)
  • newCreditCard
const creditCard = {
    installments?: number,
    creditCard: string, // Ex: id
    customer: string, // Ex: id
    amount: string, // Ex: '0.42'
    depositAccount: string, // Ex: id
    split?: [
        {
            accountId: string, // Ex: accountId
            percentage: number
        }
    ]
    fields?: {
        '...': '...', // string:string Ex: 'clientType': 'common'
        ...
    }
}
const data = sdk.CashIn.newCreditCard(creditCard)
  • getCreditCardTransactionById
const id:string = '...'
const data = sdk.CashIn.getCreditCardTransactionById(id)
  • getAllCreditCardCashIn
const searchOptions = {
    queryParams?: {
        'fromDate': string, // Ex: '2020-12-18T16:19:09.000Z'
    	'toDate': string, // Ex: '2020-12-18T16:19:09.000Z'
        ...
    },
    pagination?: {
        limit?: number, // number bigger than 0
        starting_after: number //number bigger than 0
    },
    fields?: {
        '...': '...', // string:string Ex: 'clientType': 'common'
        ...
    }
}
const data = sdk.CashIn.getAllCreditCardCashIn(searchOptions)
  • getAllCreditCardCustomerByIdCashIn
const data = sdk.CashIn.getAllCreditCardCustomerByIdCashIn()
  • newLotteryCashIn
const lottery = {
    amount: string, // Ex: '3.1415'
    depositAccountId: string // id
}

const data = sdk.CashIn.newLotteryCashIn(lottery)
  • getAllLotteryCashIn
const searchOptions = {
    queryParams?: {
        'fromDate': string, // Ex: '2020-12-18T16:19:09.000Z'
    	'toDate': string, // Ex: '2020-12-18T16:19:09.000Z'
        ...
    },
    pagination?: {
        limit?: number, // number bigger than 0
        starting_after: number //number bigger than 0
    },
    fields?: {
        '...': '...', // string:string Ex: 'clientType': 'common'
        ...
    }
}
const data = sdk.CashIn.getAllLotteryCashIn(searchOptions)
  • getLotteryCashInById
const id:string = '...'
const data = sdk.CashIn.getLotteryCashInById(id)
  • cancelLotteryCashInById
const id:string = '...'
const data = sdk.CashIn.cancelLotteryCashInById(id)
  • confirmLottery
const id:string = '...'
const data = sdk.CashIn.confirmLottery(id)

CashOut

  • payBoleto
const boleto = {
    amount: string, // Ex: '13.0'
    barCode?: string, // Ex: code
    type?: BoletoType.Utility | BoletoType.General
    withdrawAccountId: string // Ex: id
}

const data = sdk.CashOut.payBoleto(boleto)
  • getBoleto
const id:string = '...'
const data = sdk.CashOut.getBoleto(id)
  • getBoletoInfo
const barCode:string = '...'
const data = sdk.CashOut.getBoletoInfo(barCode)
  • getAllBoletos
const searchOptions = {
    queryParams?: {
        'fromDate': string, // Ex: '2020-12-18T16:19:09.000Z'
    	'toDate': string, // Ex: '2020-12-18T16:19:09.000Z'
        ...
    },
    pagination?: {
        limit?: number, // number bigger than 0
        starting_after: number //number bigger than 0
    },
    fields?: {
        '...': '...', // string:string Ex: 'clientType': 'common'
        ...
    }
}
const data = sdk.CashOut.getAllBoletos(searchOptions)
  • newBankTransfer
const bankTransfer = {
    amount: string, // Ex: '12.0'
    withdrawAccountId: string, // Ex: id
    receiver: {
        bankCode: string, // Ex: '340'
        bankAgency: string, // Ex: '2000'
        bankAgencyDigit?: string, // Ex: '0'
        bankAccount: string, // Ex: '12345'
        bankAccountDigit?: string, // Ex: '1'
        name: string, // Ex: 'João Silva Silveira'
        document: string, // Ex: '12345678910'
    }
    fields?: {
        '...': '...', // string:string Ex: 'clientType': 'common'
        ...
    }

}
const data = sdk.CashOut.newBankTransfer(bankTransfer)
  • getBankTransfer
const id:string = '...'
const data = sdk.CashOut.getBankTransfer(id)
  • getBanks
const data = sdk.CashOut.getBanks()
  • getAllBankTransfers
const searchOptions = {
    queryParams?: {
        'fromDate': string, // Ex: '2020-12-18T16:19:09.000Z'
    	'toDate': string, // Ex: '2020-12-18T16:19:09.000Z'
        ...
    },
    pagination?: {
        limit?: number, // number bigger than 0
        starting_after: number //number bigger than 0
    },
    fields?: {
        '...': '...', // string:string Ex: 'clientType': 'common'
        ...
    }
}

const data = sdk.CashOut.getAllBankTransfers(searchOptions)
  • newTopUp
const topUp = {
    providerId: number, //  Ex: providerId
    amount: string, // Ex: '12.0'
    withdrawAccountId: string, // Ex: accountId
    phone?: string, // Ex: '00900000000'
    tvSignerCode?: string, // Ex: id
    fields?: {
        '...': '...', // string:string Ex: 'clientType': 'common'
        ...
    }
}

const data = sdk.CashOut.newTopUp(topUp)
  • confirmTopUp
const id:string = '...'
const data = sdk.CashOut.confirmTopUp(id)
  • cancelTopUp
const id:string = '...'
const data = sdk.CashOut.cancelTopUp(id)
  • findPhoneProvider
const phoneStateCode:number = number
const phoneNumber:string = '...'

const data = sdk.CashOut.findPhoneProvider(phoneStateCode, phoneNumber)
  • getTopUpCashOutById
const id:string = '...'
const data = sdk.CashOut.getTopUpCashOutById(id)
  • getAllTopUpProviders
const id:string = {
    phoneStateCode?: number,
    category?: number,
    type?: number
}
const data = sdk.CashOut.getAllTopUpProviders(id)
  • getAvailableAmountsForProvider
const id:number = number
const phoneStateCode:string = '...'

const data = sdk.CashOut.getAvailableAmountsForProvider(id, phoneStateCode?)
  • newLotteryCashOut
const lotteryWithdrawal = {
    amount: string, // Ex: '2.0'
    withdrawAccountId: string, // id
}
const data = sdk.CashOut.newLotteryCashOut(lotteryWithdrawal)
  • getAllLotteryCashOut
const searchOptions = {
    queryParams?: {
        'fromDate': string, // Ex: '2020-12-18T16:19:09.000Z'
    	'toDate': string, // Ex: '2020-12-18T16:19:09.000Z'
        ...
    },
    pagination?: {
        limit?: number, // number bigger than 0
        starting_after: number //number bigger than 0
    },
    fields?: {
        '...': '...', // string:string Ex: 'clientType': 'common'
        ...
    }
}
const data = sdk.CashOut.getAllLotteryCashOut(searchOptions)
  • getLotteryCashOutById
const id:string = '...'
const data = sdk.CashOut.getLotteryCashOutById(id)
  • cancelLotteryCashOut
const id:string = '...'
const data = sdk.CashOut.cancelLotteryCashOut(id)
  • confirmLottery
const id:string = '...'
const data = sdk.CashOut.confirmLottery(id)

Login

  • createLogin
const login = {
    login: string, // Ex: 'the_quick_brown_fox' or '[email protected]'
    password: string,
    accountId: string, // accountId
}

const data = sdk.Login.createLogin(login)
  • newSession
const login = {
    email: string, // Ex: 'the_quick_brown_fox' or '[email protected]'
    password: string,
    expirationInDays?: number // Ex: 10
}

const data = sdk.Login.newSession(login)
  • isSessionActive
const id:string = '...'
const data = sdk.Login.isSessionActive(id)
  • destroySession
const id:string = '...'
const data = sdk.Login.destroySession(id)
  • addNewTermsAndConditions
const newTermsAndConditions = {
    text:string = '...', // Ex: 'Payment account opening agreement...'
}

## <a name="History">History</a>

@deprecated The method should not be used, use getAllTransactionHistory
- getTransactionHistory
```typescript
const searchOptions = {
     queryParams?: {
         'fromDate': string, // Ex: '2020-12-18T16:19:09.000Z'
     	'toDate': string, // Ex: '2020-12-18T16:19:09.000Z'
         ...
     },
     pagination?: {
         limit?: number, // number bigger than 0
         starting_after: number //number bigger than 0
     },
     fields?: {
         '...': '...', // string:string Ex: 'clientType': 'common'
         ...
     }
 }
 
const data = sdk.history.getTransactionHistory(id, searchOptions)
  • getAllTransactionHistory
import {HistoryStatus, Service, ServiceType} from "./history";

const searchOptions = {
    queryParams? : {
        'fromDate': string, // Ex: '2020-12-18T16:19:09.000Z'
        'toDate': string, // Ex: '2020-12-18T16:19:09.000Z'
        'service': string, // EX: 'LEDGER,CASH_IN' // Service 
        'serviceType': string, // EX: 'BANK_SLIP,CREDIT_CARD' // ServiceType 
        'document': string,
        'amountTo': string,
        'amountFrom': string,
        'name': string,
        'status': HistoryStatus,
        ...
    },
    pagination? : {
        limit? : number, // number bigger than 0
        starting_after: number //number bigger than 0
    },
    fields? : {
        '...': '...', // string:string Ex: 'clientType': 'common'
        ...
    }
}

const data = sdk.history.getAllTransactionHistory(id, searchOptions)