click_gerencianet 0.0.1
click_gerencianet: ^0.0.1 copied to clipboard
Com este package é possivel criar pix e consultar se o mesmo foi pago no gerencianet
example/click_gerencianet_example.dart
import 'package:click_gerencianet/click_gerencianet.dart';
import 'package:click_gerencianet/src/gerencianet/models/configuration_model.dart';
Future<void> main() async {
var gn = GerencianetRestClient(
config: ConfigurationModel(
chavePix: 'susi@clicksi.com.br',
clientId: 'Client_Id_2068118bdb77443ad6c763fce9c60dfff23e89d9',
clientSecret: 'Client_Secret_44336fad406b256298683d4a6c93a3b2fcb9eeee',
pathCertificadoCRT: 'C:\\Users\\ferde\\OneDrive\\flutter\\click\\click_api\\certificates\\prod\\pix.crt.pem',
pathCertificadoKEY: 'C:\\Users\\ferde\\OneDrive\\flutter\\click\\click_api\\certificates\\prod\\pix.key.pem',
certificadoPassword: "1234",
pixRecebedor: 'SUSELEI A BECK 11014772885',
cidade: 'PARATI'),
);
print(await gn.gerarPixCopiaCola(descricao1: 'pagamento teste', valor: 100, txId: '123123123'));
//print('Consultando se o pix txId 436002981 foi pago...');
//final pix = await gn.checkPayment(
// txId: '436002981', start: DateTime.now().firstDayOfMonth(), end: DateTime.now().lastSecondOfDay);
//
// if (pix == null) {
// print('o pagamento não foi encontrado');
// } else {
// print(pix.toString());
// }
// // Inicia a função de espera pelo pagamento em segundo plano
// print('verificando se o pix caiu...');
// final waitForPaymentFuture = gn.waitForPayment(txId: '436002981');
// // Espera por 30 segundos antes de abortar a função
// print('aguardando 30 segundos...');
// await Future.delayed(Duration(seconds: 30));
// print('abortando...');
// gn.abortWaitPayment();
// // Espera a função de espera pelo pagamento concluir sua execução
// print('esperando retorno:');
// final pix = await waitForPaymentFuture;
// if (pix == null) {
// print('pagamento não efetuado');
// } else {
// print(pix.toString());
// }
//print('testando...: ${await gn.auth().get('/v2/pix?inicio=2023-04-10T00:00:00Z&fim=2023-04-14T23:59:59Z')}');
}