Skip to content

Atualização no endpoint de envio de PIX #2

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Api Compilada/ApisGN.exe
Binary file not shown.
233 changes: 220 additions & 13 deletions ApisGN.dproj

Large diffs are not rendered by default.

452 changes: 226 additions & 226 deletions ApisGN.dproj.local

Large diffs are not rendered by default.

Binary file modified ApisGN.identcache
Binary file not shown.
Binary file modified ApisGN.res
Binary file not shown.
2 changes: 2 additions & 0 deletions Code/Api Pix/Utils/Classes/BodyPixClass.pas
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ interface
TFavored = record
[Alias('chave')]
Key: String;
[Alias('cpf')] Cpf: String;

end;

TPayer = record
Expand Down
2 changes: 1 addition & 1 deletion Code/Api Pix/Utils/EndPoints/PixEndpoints.pas
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ procedure PixSend;
WriteStringToStream(JsonToSend, Modal.Body, IndyTextEncoding_UTF8);
JsonToSend.Position := 0;

sResponse := HttpClient.Post( MainPix.frmPix.Enviroment + '/v2/pix', JsonToSend);
sResponse := HttpClient.Put( MainPix.frmPix.Enviroment + '/v2/gn/pix/' + Modal.txtIdEnvio.Text, JsonToSend);

MainPix.frmPix.MemoResponse.text := sresponse;
end;
Expand Down
2 changes: 1 addition & 1 deletion Code/Api Pix/Utils/MainPix.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ object MainPix: TMainPix
Top = 32
Width = 197
Height = 33
Caption = 'Post /v2/pix'
Caption = 'Put /v2/gn/pix'
TabOrder = 1
OnClick = pixSendClick
end
Expand Down
84 changes: 67 additions & 17 deletions Code/Api Pix/Utils/Views/ViewPixSend.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ object ViewPixSend: TViewPixSend
Left = 0
Top = 0
Caption = 'Modal da Requisi'#231#227'o'
ClientHeight = 261
ClientHeight = 327
ClientWidth = 584
Color = 6001140
Font.Charset = DEFAULT_CHARSET
Expand All @@ -18,22 +18,23 @@ object ViewPixSend: TViewPixSend
Left = 0
Top = 0
Width = 584
Height = 261
Height = 327
Align = alClient
Caption = '*Campos Obrigat'#243'rios'
TabOrder = 0
ExplicitHeight = 638
object btnConfirmRequest: TButton
Left = 286
Top = 226
Left = 290
Top = 290
Width = 291
Height = 32
Caption = 'Confirmar a Requisi'#231#227'o'
TabOrder = 1
OnClick = btnConfirmRequestClick
end
object btnCancelRequest: TButton
Left = 8
Top = 226
Left = 3
Top = 290
Width = 275
Height = 32
Caption = 'Cancelar a Requisi'#231#227'o'
Expand All @@ -43,29 +44,52 @@ object ViewPixSend: TViewPixSend
object GroupBox1: TGroupBox
Left = 7
Top = 16
Width = 569
Height = 208
Width = 1027
Height = 268
Caption = 'Body da Requisi'#231#227'o'
TabOrder = 0
object Label3: TLabel
Left = 8
Top = 22
AlignWithMargins = True
Left = 5
Top = 18
Width = 81
Height = 13
Align = alTop
Caption = '*Valor - Ex. 5.00'
Constraints.MaxWidth = 81
Constraints.MinWidth = 81
ExplicitLeft = 8
ExplicitTop = 22
end
object Label1: TLabel
AlignWithMargins = True
Left = 5
Top = 49
Width = 81
Height = 13
Margins.Top = 15
Align = alTop
Caption = '*Identificador'
Constraints.MaxWidth = 81
Constraints.MinWidth = 81
end
object txtValue: TEdit
Left = 95
Top = 19
Left = 98
Top = 15
Width = 468
Height = 21
Align = alCustom
Constraints.MaxHeight = 21
Constraints.MaxWidth = 468
Constraints.MinHeight = 21
Constraints.MinWidth = 468
TabOrder = 0
end
object GroupBox2: TGroupBox
Left = 6
Top = 142
Left = 3
Top = 162
Width = 560
Height = 51
Height = 95
Caption = 'Favorecido'
TabOrder = 2
object Label4: TLabel
Expand All @@ -75,17 +99,31 @@ object ViewPixSend: TViewPixSend
Height = 13
Caption = '*Chave Pix - Ex. jo'#227'o@meuemail.com'
end
object Label2: TLabel
Left = 6
Top = 64
Width = 128
Height = 13
Caption = '*CPF/CNPJ (Sem mascara)'
end
object txtKeyFav: TEdit
Left = 192
Top = 21
Width = 365
Height = 21
TabOrder = 0
end
object txtDocumento: TEdit
Left = 192
Top = 61
Width = 365
Height = 21
TabOrder = 1
end
end
object GroupBox4: TGroupBox
Left = 6
Top = 51
Left = 3
Top = 73
Width = 560
Height = 83
Caption = '*Pagador'
Expand Down Expand Up @@ -119,6 +157,18 @@ object ViewPixSend: TViewPixSend
TabOrder = 1
end
end
object txtIdEnvio: TEdit
Left = 98
Top = 46
Width = 468
Height = 21
Align = alCustom
Constraints.MaxHeight = 21
Constraints.MaxWidth = 468
Constraints.MinHeight = 21
Constraints.MinWidth = 468
TabOrder = 3
end
end
end
end
26 changes: 25 additions & 1 deletion Code/Api Pix/Utils/Views/ViewPixSend.pas
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, BodyPixClass, XSuperJSON, XSuperObject,
System.UITypes;
System.UITypes, System.JSON;

type
TViewPixSend = class(TForm)
Expand All @@ -23,6 +23,10 @@ TViewPixSend = class(TForm)
txtKeyPag: TEdit;
txtPayerInfo: TEdit;
Label6: TLabel;
Label1: TLabel;
txtIdEnvio: TEdit;
Label2: TLabel;
txtDocumento: TEdit;
procedure btnConfirmRequestClick(Sender: TObject);
procedure btnCancelRequestClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
Expand Down Expand Up @@ -63,6 +67,18 @@ procedure TViewPixSend.btnConfirmRequestClick(Sender: TObject);
if txtKeyFav.CanFocus then
txtKeyFav.SetFocus;
end
else if txtIdEnvio.Text = EmptyStr then
begin
MessageDlg('Identificador n�o pode ser vazio', TMsgDlgType.mtInformation, [TMsgDlgBtn.mbOK], 0);
if txtIdEnvio.CanFocus then
txtIdEnvio.SetFocus;
end
else if txtDocumento.Text = EmptyStr then
begin
MessageDlg('Documento n�o pode ser vazio', TMsgDlgType.mtInformation, [TMsgDlgBtn.mbOK], 0);
if txtDocumento.CanFocus then
txtDocumento.SetFocus;
end
else
ModalResult := mrOk;
end;
Expand All @@ -86,6 +102,7 @@ function TViewPixSend.GetBody: String;
FValue := txtValue.Text;

FFavored.Key := txtKeyFav.Text;
FFavored.Cpf := txtDocumento.Text;
ClassPix.Favored := FFavored;

FPayer.key := txtKeyPag.Text;
Expand All @@ -96,9 +113,14 @@ function TViewPixSend.GetBody: String;

BodyRequest := SO(ClassPix.AsJSON(False, False));



if ClassPix.Payer.PayingInfo = EmptyStr then
BodyRequest.Remove('infoPagador');




Result := BodyRequest.AsJSON;
end;

Expand All @@ -108,6 +130,8 @@ procedure TViewPixSend.ClearRequestfields;
txtKeyFav.Text := '';
txtKeyPag.Text := '';
txtPayerInfo.Text := '';
txtIdEnvio.Text := '';
txtDocumento.Text := '';
end;


Expand Down