diff --git a/config.json b/config.json index ea281e8..a3526d3 100755 --- a/config.json +++ b/config.json @@ -147,6 +147,10 @@ "settleCarnetParcel": { "route": "/v1/carnet/:id/parcel/:parcel/settle", "method": "put" + }, + "payOneStep": { + "route": "/v1/charge/one-step", + "method": "post" } } } \ No newline at end of file diff --git a/demo/MainCode.dfm b/demo/MainCode.dfm index 3db93e2..0492c61 100755 --- a/demo/MainCode.dfm +++ b/demo/MainCode.dfm @@ -497,7 +497,9 @@ object MainFrm: TMainFrm 'Get Installments' 'Create Charge Balance Sheet ' 'Settle Charge' - 'Settle Carnet Parcel') + 'Settle Carnet Parcel' + 'Create One Step Billet' + 'Create One Step Card') end object txtToken: TEdit Left = 108 diff --git a/demo/MainCode.pas b/demo/MainCode.pas index b64f55b..be93185 100755 --- a/demo/MainCode.pas +++ b/demo/MainCode.pas @@ -153,6 +153,8 @@ procedure TMainFrm.ActionBtnClick(Sender: TObject); 30 : DisplayServerResponse(CreateChargeBalanceSheet(Id)); 31 : DisplayServerResponse(SettleCharge(Id)); 32 : DisplayServerResponse(settleCarnetParcel(Id, CarnetParcel)); + 33 : DisplayServerResponse(PayOneStepWithBillet); //one-step-billet + 34 : DisplayServerResponse(PayOneStepWithCard); //one-step-card end; end; @@ -161,7 +163,7 @@ procedure TMainFrm.ActionsChange(Sender: TObject); begin Option := Integer(Actions.ItemIndex); case Option of - 0,9,19,22,29 : begin + 0,9,19,22,29,33,34 : begin txtId.Enabled:= False; txtCarnetParcel.Enabled := False; txtToken.Enabled := False diff --git a/demo/uChargeEndpoints.pas b/demo/uChargeEndpoints.pas index 62f6ddd..1a1f599 100755 --- a/demo/uChargeEndpoints.pas +++ b/demo/uChargeEndpoints.pas @@ -10,6 +10,8 @@ function CreateCharge: String; function DetailCharge(Id: String): String; function PayChargeWithBillet(Id: String): String; function PayChargeWithCard(Id, Token: String): String; +function PayOneStepWithBillet: String; //one step billet +function PayOneStepWithCard: String; //one step card function CancelCharge(Id: String): String; function CreateChargeHistory(Id: String): String; function LinkCharge(Id: String): String; @@ -152,6 +154,106 @@ function PayChargeWithCard(Id, Token: String): String; end; +//one step billet +function PayOneStepWithBillet: String; +var + Body: String; + +begin + Body := + '{'+ + '"metadata": {'+ + '"custom_id": "sou_fera_0007",'+ + '"notification_url": "https://url-do-cliente.com.br/"'+ + '},'+ + '"payment": {'+ + '"banking_billet": {'+ + '"configurations": {'+ + '"fine": 200,'+ + '"interest": 33'+ + '},'+ + '"conditional_discount": {'+ + '"until_date": "2019-08-30",'+ + '"type": "percentage",'+ + '"value": 500'+ + '},'+ + '"discount": {'+ + '"type": "currency",'+ + '"value": 599'+ + '},'+ + '"expire_at": "2019-09-15",'+ + '"customer": {'+ + '"name": "Gorbadoc Oldbuck",'+ + '"cpf": "94271564656",'+ + '"phone_number": "5144916523"'+ + '}'+ + '}'+ + '},'+ + '"items": ['+ + '{'+ + '"amount": 1,'+ + '"name": "Item 1",'+ + '"value": 600'+ + '},'+ + '{'+ + '"amount": 1,'+ + '"name": "Item 2",'+ + '"value": 1000'+ + '}'+ + ']'+ + '}'; + + Result := ExecuteGerenciaNetRequest( 'payOneStep','','',Body ); +end; + +//one step card +function PayOneStepWithCard: String; +var + Body: String; + +begin + Body := + '{'+ + '"items": ['+ + '{'+ + '"name": "Product 1",'+ + '"value": 590,'+ + '"amount": 2'+ + '}'+ + '],'+ + '"shippings": ['+ + '{'+ + '"name": "Default Shipping Cost",'+ + '"value": 10'+ + '}'+ + '],'+ + '"payment": {'+ + '"credit_card": {'+ + '"installments": 1,'+ + '"payment_token": "fd6c81e1b812afcf9b57158207af3edfdb1e3ec0",'+ + '"billing_address": {'+ + '"street": "Av. JK",'+ + '"number": 909,'+ + '"neighborhood": "Bauxita",'+ + '"zipcode": "35400000",'+ + '"city": "Ouro Preto",'+ + '"state": "MG"'+ + '},'+ + '"customer": {'+ + '"name": "Gorbadoc Oldbuck",'+ + '"email": "oldbuck@gerencianet.com.br",'+ + '"cpf": "04267484171",'+ + '"birth": "1977-01-15",'+ + '"phone_number": "5144916523"'+ + '}'+ + '}'+ + '}'+ + '}'; + + Result := ExecuteGerenciaNetRequest( 'payOneStep','','',Body ); +end; + + function DetailCharge(Id: String): String; var DetailParams: String; diff --git a/src/dll-compilada/GerenciaNet.dll b/src/dll-compilada/GerenciaNet.dll index 88b0214..6cce9cb 100755 Binary files a/src/dll-compilada/GerenciaNet.dll and b/src/dll-compilada/GerenciaNet.dll differ diff --git a/src/dll-compilada/config.json b/src/dll-compilada/config.json index ea281e8..a3526d3 100755 --- a/src/dll-compilada/config.json +++ b/src/dll-compilada/config.json @@ -147,6 +147,10 @@ "settleCarnetParcel": { "route": "/v1/carnet/:id/parcel/:parcel/settle", "method": "put" + }, + "payOneStep": { + "route": "/v1/charge/one-step", + "method": "post" } } } \ No newline at end of file diff --git a/src/dll-src/uGerenciaNetIndy.pas b/src/dll-src/uGerenciaNetIndy.pas index 94853d4..c1d9863 100755 --- a/src/dll-src/uGerenciaNetIndy.pas +++ b/src/dll-src/uGerenciaNetIndy.pas @@ -18,7 +18,7 @@ function TokenExpired: Boolean; ProxyPort: Integer; ExpireDateTime : TDateTime; -const API_SDK = 'delphi-3.0.1'; +const API_SDK = 'delphi-3.0.2'; implementation