Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #17  
Antiguo 26-02-2025
Maska10 Maska10 is offline
Miembro
 
Registrado: abr 2020
Posts: 50
Poder: 7
Maska10 Va por buen camino
Aquí os dejo el código, la primera función es solo para pasar el array of char a String, la segunda función es la que creo que buscais:

Código Delphi [-]
function tfrmentradassalidascaja.ArrayToString(const a: array of Char): string;
begin
  if Length(a)>0 then
    SetString(Result, PChar(@a[0]), Length(a))
  else
    Result := '';
end;


procedure tfrmentradassalidascaja.enviadatafono(Sender: TObject);
type
  TIniTpvpcLatente = Function(cComercio,cTerminal,cClaveFirma,cConfPuerto,cVersion: string) : integer;stdcall;
  TOperPinPad = function(cImporte, cFactura, cTipoOper :string; var cXmlResp :array of Char; iTamMaxResp : integer) : integer;stdcall;
var
  DLLHandle: THandle;
  IniTpvpcLatente: TIniTpvpcLatente;
  OperPinPad: TOperPinPad;
  respuesta: integer;
  strrespuesta, codcomercio,terminal,firma,importe,venta: string;
  Str2: array[0..29999] of Char;

begin

  codcomercio:='45465464';
  firma:='assadfsadfasdfsadfsadf';
  terminal:='1';
  importe:='20.50';
  venta:='Fact1001';

  DLLHandle := LoadLibrary('dllTpvpcLatente.dll');
  try
    if DLLHandle <= 0 then
      begin
      ShowMessage('Error, conector dllTpvcLatente.dll no encontrado');
      exit;
      end;


    @IniTpvpcLatente := GetProcAddress(DLLHandle, 'fnDllIniTpvpcLatente');
    @OperPinPad := GetProcAddress(DLLHandle, PChar('fnDllOperPinPad'));

    if Assigned(IniTpvpcLatente) then
    begin
           respuesta:=IniTpvpcLatente(codcomercio,terminal,firma,'','');
           if respuesta < 0 then
              begin
              showmessage('Error de comunicación con el Datafono/Tpv/PinPad, código de error: ' + inttostr(respuesta));
              Exit;
              end;

           strrespuesta:='';
           respuesta:=OperPinPad(importe,venta,'PAGO',Str2,30000);
           if respuesta < 0 then
              begin
              showmessage('Error al enviar la orden al Datafono/Tpv/PinPad, código de error: ' + inttostr(respuesta));
              Exit;
              end;

           strrespuesta:=ArrayToString(Str2);


           if pos('Autorizada',strrespuesta)> 0 then
              begin
              // aceptada
        showmessage('Operación Aceptada');
              end
           else
              begin
              // denegada
              showmessage('Operación Denegada');
              exit;
              end;

    end
    else
      begin
      ShowMessage('Error, procedimiento/Funcion no encontrado');
      end;

  except
     on E : Exception do
     begin
       ShowMessage('Exception class name = '+E.ClassName);
       ShowMessage('Exception message = '+E.Message);
     end;
  end;

end;

Última edición por Casimiro Noteví fecha: 26-02-2025 a las 20:34:39.
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Integración con una dll externa con COM+ jars Providers 2 08-03-2013 11:09:42
Pago con Tarjeta de Credito OnLine Neeruu Internet 8 24-02-2012 22:33:14
Integración de php y delphi Will PHP 4 10-08-2006 23:13:48
Integración de datos kalimero Firebird e Interbase 3 17-02-2005 22:03:38
Pago con tarjeta de crédito aom PHP 6 30-11-2004 10:16:40


La franja horaria es GMT +2. Ahora son las 09:24:44.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi