/
model.go
2196 lines (1939 loc) · 84.9 KB
/
model.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package bankly
import (
"os"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/contbank/grok"
)
const (
// LoginPath ...
LoginPath = "connect/token"
// LoginMtlsPath ...
LoginMtlsPath = "oauth2/token"
// ClientPath ...
ClientPath = "oauth2/register"
// CustomersPath ..
CustomersPath = "customers"
// AccountsPath ...
AccountsPath = "accounts"
// IncomeReportPath ...
IncomeReportPath = "income-report"
// TransfersPath ...
TransfersPath = "fund-transfers"
// BusinessPath ...
BusinessPath = "business"
// CorporationBusinessPath ...
CorporationBusinessPath = "corporation-business"
// BoletosPath ...
BoletosPath = "bankslip"
// PaymentPath ...
PaymentPath = "bill-payment"
// BanksPath ...
BanksPath = "banklist"
//BankStatementsPath ...
BankStatementsPath = "events"
// DocumentAnalysisPath ...
DocumentAnalysisPath = "/document-analysis"
// CardDocumentPath ...
CardDocumentPath = "cards/document"
// BoletosSettledPath ...
BoletosSettledPath = "/bankslip/settlementpayment"
)
type PixType string
const (
// PixCNPJ ...
PixCNPJ PixType = "CNPJ"
// PixCPF ...
PixCPF PixType = "CPF"
// PixEMAIL ...
PixEMAIL PixType = "EMAIL"
// PixPHONE ...
PixPHONE PixType = "PHONE"
// PixEVP ...
PixEVP PixType = "EVP"
)
type PixClaimType string
const (
Portability PixClaimType = "PORTABILITY"
Ownership PixClaimType = "OWNERSHIP"
)
type StatusClaim string
const (
Open StatusClaim = "OPEN"
WaitingResolution StatusClaim = "WAITING_RESOLUTION"
Confirmed StatusClaim = "CONFIRMED"
CanceledClaim StatusClaim = "CANCELED"
CompletedClaim StatusClaim = "COMPLETED"
)
type CancelReason string
const (
ClaimerRequest CancelReason = "CLAIMER_REQUEST"
DonorRequest CancelReason = "DONOR_REQUEST"
AccountClosure CancelReason = "ACCOUNT_CLOSURE"
Fraud CancelReason = "FRAUD"
DefaultOperation CancelReason = "DEFAULT_OPERATION"
)
const (
// InternalBankCode ...
InternalBankCode string = "332"
)
type DocumentType string
const (
// DocumentTypeRG ...
DocumentTypeRG DocumentType = "RG"
// DocumentTypeCNH ...
DocumentTypeCNH DocumentType = "CNH"
// DocumentTypeSELFIE ...
DocumentTypeSELFIE DocumentType = "SELFIE"
// DocumentTypeARTICLES_OF_INCORPORATION ...
DocumentTypeARTICLES_OF_INCORPORATION DocumentType = "ARTICLES_OF_INCORPORATION"
// DocumentTypeLAST_CONTRACT_CHANGE ...
DocumentTypeLAST_CONTRACT_CHANGE DocumentType = "LAST_CONTRACT_CHANGE"
// DocumentTypeBALANCE_SHEET ...
DocumentTypeBALANCE_SHEET DocumentType = "BALANCE_SHEET"
// DocumentTypePOWER_OF_ATTORNEY ...
DocumentTypePOWER_OF_ATTORNEY DocumentType = "POWER_OF_ATTORNEY"
)
type DocumentSide string
const (
// DocumentSideFront ...
DocumentSideFront DocumentSide = "FRONT"
// DocumentSideBack ...
DocumentSideBack DocumentSide = "BACK"
)
type Provider string
const (
// DocumentProviderUnicoCheck ...
DocumentProviderUnicoCheck Provider = "UNICO_CHECK"
)
// AccountType ...
type AccountType string
const (
// PaymentAccount ...
PaymentAccount AccountType = "PAYMENT_ACCOUNT"
)
// CustomerStatus
type CustomerStatus string
const (
// CustomerStatusPendingApproval
CustomerStatusPendingApproval CustomerStatus = "PENDING_APPROVAL"
// CustomerStatusApproved
CustomerStatusApproved CustomerStatus = "APPROVED"
// CustomerStatusReproved
CustomerStatusReproved CustomerStatus = "REPROVED"
// CustomerStatusCanceled
CustomerStatusCanceled CustomerStatus = "CANCELED"
// CustomerStatusBlacklisted
CustomerStatusBlacklisted CustomerStatus = "BLACKLISTED"
)
type DocumentAnalysisStatus string
const (
// DocumentAnalysisStatusAnalyzing...
DocumentAnalysisStatusAnalyzing DocumentAnalysisStatus = "ANALYZING"
// DocumentAnalysisStatusAnalysisCompleted ...
DocumentAnalysisStatusAnalysisCompleted DocumentAnalysisStatus = "ANALYSIS_COMPLETED"
// DocumentAnalysisStatusUnexpectedError ...
DocumentAnalysisStatusUnexpectedError DocumentAnalysisStatus = "UNEXPECTED_ERROR"
// DocumentAnalysisStatusForbiddenWord ...
DocumentAnalysisStatusForbiddenWord DocumentAnalysisStatus = "FORBIDDEN_WORD"
// DocumentAnalysisStatusDataRecused ...
DocumentAnalysisStatusDataRecused DocumentAnalysisStatus = "DATA_RECUSED"
// DocumentAnalysisStatusPhotoRecused ...
DocumentAnalysisStatusPhotoRecused DocumentAnalysisStatus = "PHOTO_RECUSED"
)
type DetailsStatus string
const (
// DetailsStatusLivenessFound ...
DetailsStatusLivenessFound DetailsStatus = "LIVENESS_FOUND"
// DetailsStatusNoLiveness ...
DetailsStatusNoLiveness DetailsStatus = "NO_LIVENESS"
// DetailsStatusCouldNotDetectFace ...
DetailsStatusCouldNotDetectFace DetailsStatus = "COULD_NOT_DETECT_FACE"
// DetailsStatusDetectFace ...
DetailsStatusDetectFace DetailsStatus = "DETECTED_FACE"
// DetailsStatusManyFacesDetected ...
DetailsStatusManyFacesDetected DetailsStatus = "MANY_FACES_DETECTED"
// DetailsStatusHasFaceMatch ...
DetailsStatusHasFaceMatch DetailsStatus = "HAS_FACE_MATCH"
// DetailsStatusUnMatchedDocument ...
DetailsStatusUnMatchedDocument DetailsStatus = "UNMATCHED_DOCUMENT"
// DetailsStatusNoDocumentFound ...
DetailsStatusNoDocumentFound DetailsStatus = "NO_DOCUMENT_FOUND"
// DetailsStatusNoInfoFound ...
DetailsStatusNoInfoFound DetailsStatus = "NO_INFO_FOUND"
// DetailsStatusDetectedDocument ...
DetailsStatusDetectedDocument DetailsStatus = "DETECTED_DOCUMENT"
)
// DeclaredIncome Faixa de renda declarada (PF)
type DeclaredIncome string
const (
// LESS_THAN_ONE_THOUSAND Inferior a mil.
LESS_THAN_ONE_THOUSAND DeclaredIncome = "LESS_THAN_ONE_THOUSAND"
// FROM_ONE_THOUSAND_TO_TWO_THOUSAND De mil a dois mil.
FROM_ONE_THOUSAND_TO_TWO_THOUSAND DeclaredIncome = "FROM_ONE_THOUSAND_TO_TWO_THOUSAND"
// FROM_TWO_THOUSAND_TO_THREE_THOUSAND De 2 mil a 3 mil.
FROM_TWO_THOUSAND_TO_THREE_THOUSAND DeclaredIncome = "FROM_TWO_THOUSAND_TO_THREE_THOUSAND"
// FROM_THREE_THOUSAND_TO_FIVE_THOUSAND De 3 mil a 5 mil.
FROM_THREE_THOUSAND_TO_FIVE_THOUSAND DeclaredIncome = "FROM_THREE_THOUSAND_TO_FIVE_THOUSAND"
// FROM_FIVE_THOUSAND_TO_TEN_THOUSAND De 5 mil a 10 mil.
FROM_FIVE_THOUSAND_TO_TEN_THOUSAND DeclaredIncome = "FROM_FIVE_THOUSAND_TO_TEN_THOUSAND"
// FROM_TEN_THOUSAND_TO_TWENTY_THOUSAND De 10 mil a 20 mil.
FROM_TEN_THOUSAND_TO_TWENTY_THOUSAND DeclaredIncome = "FROM_TEN_THOUSAND_TO_TWENTY_THOUSAND"
// OVER_TWENTY_THOUSAND Acima de 20 mil.
OVER_TWENTY_THOUSAND DeclaredIncome = "OVER_TWENTY_THOUSAND"
)
type PoliticallyExposedPersonLevel string
const (
// NONE nenhuma exposição política
NONE PoliticallyExposedPersonLevel = "NONE"
// SELF a própria pessoa é exposta politicamente
SELF PoliticallyExposedPersonLevel = "SELF"
// RELATED algum parente ou pessoa relacionada é exposta politicamente
RELATED PoliticallyExposedPersonLevel = "RELATED"
)
// DeclaredAnnualBilling Faixa de faturamento anual da empresa (PJ)
type DeclaredAnnualBilling string
const (
// UP_TO_FIFTY_THOUSAND Até 50 mil
UP_TO_FIFTY_THOUSAND DeclaredAnnualBilling = "UP_TO_FIFTY_THOUSAND"
// MORE_THAN_FIFTY_THOUSAND_UP_TO_ONE_HUNDRED_THOUSAND De 50 mil a 100 mil.
MORE_THAN_FIFTY_THOUSAND_UP_TO_ONE_HUNDRED_THOUSAND DeclaredAnnualBilling = "MORE_THAN_FIFTY_THOUSAND_UP_TO_ONE_HUNDRED_THOUSAND"
// MORE_THAN_ONE_HUNDRED_THOUSAND_UP_TO_TWO_HUNDRED_AND_FIFTY_THOUSAND De 100 mil a 250 mil.
MORE_THAN_ONE_HUNDRED_THOUSAND_UP_TO_TWO_HUNDRED_AND_FIFTY_THOUSAND DeclaredAnnualBilling = "MORE_THAN_ONE_HUNDRED_THOUSAND_UP_TO_TWO_HUNDRED_AND_FIFTY_THOUSAND"
// MORE_THAN_TWO_HUNDRED_AND_FIFTY_THOUSAND_UP_TO_FIVE_HUNDRED_THOUSAND De 250 mil a 500 mil.
MORE_THAN_TWO_HUNDRED_AND_FIFTY_THOUSAND_UP_TO_FIVE_HUNDRED_THOUSAND DeclaredAnnualBilling = "MORE_THAN_TWO_HUNDRED_AND_FIFTY_THOUSAND_UP_TO_FIVE_HUNDRED_THOUSAND"
// MORE_THAN_FIVE_HUNDRED_THOUSAND_UP_TO_ONE_MILLION De 500 mil a 1 milhão.
MORE_THAN_FIVE_HUNDRED_THOUSAND_UP_TO_ONE_MILLION DeclaredAnnualBilling = "MORE_THAN_FIVE_HUNDRED_THOUSAND_UP_TO_ONE_MILLION"
// MORE_THAN_ONE_MILLION_UP_TO_TWO_MILLION_AND_FIVE_HUNDRED_THOUSAND De 1 milhão a 2 milhões e 500 mil.
MORE_THAN_ONE_MILLION_UP_TO_TWO_MILLION_AND_FIVE_HUNDRED_THOUSAND DeclaredAnnualBilling = "MORE_THAN_ONE_MILLION_UP_TO_TWO_MILLION_AND_FIVE_HUNDRED_THOUSAND"
// MORE_THAN_TWO_MILLION_AND_FIVE_HUNDRED_THOUSAND_UP_TO_FIVE_MILLION De 2 milhões e 500 mil a 5 milhões.
MORE_THAN_TWO_MILLION_AND_FIVE_HUNDRED_THOUSAND_UP_TO_FIVE_MILLION DeclaredAnnualBilling = "MORE_THAN_TWO_MILLION_AND_FIVE_HUNDRED_THOUSAND_UP_TO_FIVE_MILLION"
// MORE_THAN_FIVE_MILLION_UP_TO_TEN_MILLION De 5 milhões a 10 milhões.
MORE_THAN_FIVE_MILLION_UP_TO_TEN_MILLION DeclaredAnnualBilling = "MORE_THAN_FIVE_MILLION_UP_TO_TEN_MILLION"
// MORE_THAN_TEN_MILLION_UP_TO_TWENTY_FIVE_MILLION De 10 milhões a 25 milhões.
MORE_THAN_TEN_MILLION_UP_TO_TWENTY_FIVE_MILLION DeclaredAnnualBilling = "MORE_THAN_TEN_MILLION_UP_TO_TWENTY_FIVE_MILLION"
// MORE_THAN_TWENTY_FIVE_MILLION_UP_TO_FIFTY_MILLION De 25 milhões a 50 milhões.
MORE_THAN_TWENTY_FIVE_MILLION_UP_TO_FIFTY_MILLION DeclaredAnnualBilling = "MORE_THAN_TWENTY_FIVE_MILLION_UP_TO_FIFTY_MILLION"
// MORE_THAN_FIFTY_MILLION_UP_TO_ONE_HUNDRED_MILLION De 50 milhões a 100 milhões.
MORE_THAN_FIFTY_MILLION_UP_TO_ONE_HUNDRED_MILLION DeclaredAnnualBilling = "MORE_THAN_FIFTY_MILLION_UP_TO_ONE_HUNDRED_MILLION"
// MORE_THAN_ONE_HUNDRED_MILLION_UP_TO_TWO_HUNDRED_AND_FIFTY_MILLION De 100 milhões a 250 milhões.
MORE_THAN_ONE_HUNDRED_MILLION_UP_TO_TWO_HUNDRED_AND_FIFTY_MILLION DeclaredAnnualBilling = "MORE_THAN_ONE_HUNDRED_MILLION_UP_TO_TWO_HUNDRED_AND_FIFTY_MILLION"
// MORE_THAN_TWO_HUNDRED_AND_FIFTY_MILLION_UP_TO_FIVE_HUNDRED_MILLION De 250 milhões a 500 milhões.
MORE_THAN_TWO_HUNDRED_AND_FIFTY_MILLION_UP_TO_FIVE_HUNDRED_MILLION DeclaredAnnualBilling = "MORE_THAN_TWO_HUNDRED_AND_FIFTY_MILLION_UP_TO_FIVE_HUNDRED_MILLION"
// MORE_THAN_FIVE_HUNDRED_MILLION Mais de 500 milhões.
MORE_THAN_FIVE_HUNDRED_MILLION DeclaredAnnualBilling = "MORE_THAN_FIVE_HUNDRED_MILLION"
// NOT_DECLARED Não declarada.
NOT_DECLARED DeclaredAnnualBilling = "NOT_DECLARED"
// EXEMPT_COMPANY Empresa isenta.
EXEMPT_COMPANY DeclaredAnnualBilling = "EXEMPT_COMPANY"
// INACTIVE_COMPANY Empresa inativa.
INACTIVE_COMPANY DeclaredAnnualBilling = "INACTIVE_COMPANY"
)
type DuplicateCardStatus string
const (
// LOST_MY_CARD Cartão perdido
LOST_MY_CARD DuplicateCardStatus = "LostMyCard"
// CARD_WAS_STOLEN Cartão roubado
CARD_WAS_STOLEN DuplicateCardStatus = "CardWasStolen"
// CARD_WAS_DAMAGED Cartão danificado
CARD_WAS_DAMAGED DuplicateCardStatus = "CardWasDamaged"
// CARD_NOT_DELIVERED Cartão não entregue
CARD_NOT_DELIVERED DuplicateCardStatus = "CardNotDelivered"
// UNRECOGNIZED_ONLINE_PURCHASE Compra online não reconhecida
UNRECOGNIZED_ONLINE_PURCHASE DuplicateCardStatus = "UnrecognizedOnlinePurchase"
)
// DocumentAnalysisUnicoCheckRequest ...
type DocumentAnalysisUnicoCheckRequest struct {
Document string `validate:"required" json:"document,omitempty"`
DocumentType DocumentType `validate:"required" json:"document_type,omitempty"`
DocumentSide DocumentSide `validate:"required" json:"document_side,omitempty"`
ImageFile os.File `validate:"required" json:"image,omitempty"`
Provider string `validate:"required" json:"provider,omitempty"`
ProviderMetaData *ProviderMetadataRequest `json:"provider_metadata,omitempty"`
}
// ProviderMetadataRequest ...
type ProviderMetadataRequest struct {
IsLastDocument bool `validate:"required" json:"is_last_document,omitempty"`
Encrypted string `validate:"required" json:"encrypted,omitempty"`
}
// ParseProviderMetadaRequest ...
func ParseProviderMetadaRequest(r *ProviderMetadataRequest) *ProviderMetadata {
return &ProviderMetadata{
IsLastDocument: r.IsLastDocument,
Encrypted: r.Encrypted,
}
}
// DocumentAnalysisUnicoCheck ...
type DocumentAnalysisUnicoCheck struct {
Document string `validate:"required" json:"document,omitempty"`
DocumentType DocumentType `validate:"required" json:"documentType,omitempty"`
DocumentSide DocumentSide `validate:"required" json:"documentSide,omitempty"`
ImageFile os.File `validate:"required" json:"image,omitempty"`
Provider string `validate:"required" json:"provider,omitempty"`
ProviderMetaData *ProviderMetadata `json:"providerMetadata,omitempty"`
}
// ProviderMetadata ...
type ProviderMetadata struct {
IsLastDocument bool `json:"isLastDocument,omitempty"`
Encrypted string `json:"encrypted,omitempty"`
}
// AuthenticationResponse ...
type AuthenticationResponse struct {
AccessToken string `json:"access_token"`
ExpiresIn int `json:"expires_in"`
TokenType string `json:"token_type"`
}
// ErrorLoginResponse ...
type ErrorLoginResponse struct {
Message string `json:"error"`
}
// CustomersRequest ...
type CustomersRequest struct {
Document string `validate:"required,cpf" json:"documentNumber,omitempty"`
RegisterName string `validate:"required" json:"registerName,omitempty"`
SocialName string `json:"socialName,omitempty"`
Email string `validate:"required" json:"email,omitempty"`
Phone *Phone `validate:"required,dive" json:"phone,omitempty"`
Address *Address `validate:"required,dive" json:"address,omitempty"`
BirthDate time.Time `validate:"required" json:"birthDate,omitempty"`
MotherName string `validate:"required" json:"motherName,omitempty"`
DeclaredIncome DeclaredIncome `json:"declaredIncome,omitempty"` // deprecated
AssertedIncome AssertedIncome `validate:"required" json:"assertedIncome,omitempty"`
Occupation string `validate:"required" json:"occupation,omitempty"`
PoliticallyExposedPerson PoliticallyExposedPerson `validate:"required,dive" json:"pep,omitempty"`
Documentation Documentation `validate:"required,dive" json:"documentation,omitempty"`
}
// AssertedIncome ...
type AssertedIncome struct {
Value float64 `json:"value,omitempty"`
Currency string `json:"currency,omitempty"`
}
// Documentation
type Documentation struct {
DocumentNumber string `json:"documentNumber,omitempty"`
TokenSelfie string `validate:"required" json:"selfie,omitempty"`
TokenCardFront string `validate:"required" json:"idCardFront,omitempty"`
TokenCardBack string `validate:"required" json:"idCardBack,omitempty"`
}
// CorporationBusinessDocumentation
type CorporationBusinessDocumentation struct {
ArticlesOfIncorporation *string `json:"articlesOfIncorporation,omitempty"`
LastContractChange *string `json:"lastContractChange,omitempty"`
BalanceSheet *string `json:"balanceSheet,omitempty"`
LegalRepresentative Documentation `json:"legalRepresentative,omitempty"`
PowerOfAttorney *string `json:"powerOfAttorney,omitempty"`
}
// PoliticallyExposedPerson ...
type PoliticallyExposedPerson struct {
Level PoliticallyExposedPersonLevel `validate:"required" json:"level,omitempty"`
}
// CustomersAccountRequest ...
type CustomersAccountRequest struct {
AccountType AccountType `validate:"required" json:"accountType"`
}
// CustomersResponse ...
type CustomersResponse struct {
DocumentNumber string `json:"documentNumber"`
RegisterName string `json:"registerName"`
SocialName string `json:"socialName"`
Email string `json:"email"`
Phone Phone `json:"phone"`
Address Address `json:"address"`
MotherName string `json:"motherName"`
IsPoliticallyExposedPerson bool `json:"isPoliticallyExposedPerson"`
Reasons []string `json:"reasons"`
Status CustomerStatus `json:"status"`
Profile string `json:"profile"`
}
// Phone ...
type Phone struct {
CountryCode string `validate:"required" json:"countryCode,omitempty"`
Number string `validate:"required" json:"number,omitempty"`
}
// Address ...
type Address struct {
ZipCode string `validate:"required" json:"zipCode,omitempty"`
AddressLine string `validate:"required" json:"addressLine,omitempty"`
BuildingNumber string `validate:"required" json:"buildingNumber,omitempty"`
Complement *string `json:"complement,omitempty"`
Neighborhood string `validate:"required" json:"neighborhood,omitempty"`
City string `validate:"required" json:"city,omitempty"`
State string `validate:"required" json:"state,omitempty"`
Country string `validate:"required" json:"country,omitempty"`
}
// CardAddress ...
type CardAddress struct {
ZipCode string `validate:"required" json:"zipCode,omitempty"`
Address string `validate:"required" json:"address,omitempty"`
Number string `validate:"required" json:"number,omitempty"`
Complement *string `json:"complement,omitempty"`
Neighborhood string `validate:"required" json:"neighborhood,omitempty"`
City string `validate:"required" json:"city,omitempty"`
State string `validate:"required" json:"state,omitempty"`
Country string `validate:"required" json:"country,omitempty"`
IsActive bool `json:"isActive,omitempty"`
}
// BoletoAddress ...
type BoletoAddress struct {
ZipCode string `validate:"required" json:"zipCode,omitempty"`
AddressLine string `validate:"required" json:"addressLine,omitempty"`
Neighborhood string `validate:"required" json:"neighborhood,omitempty"`
State string `validate:"required" json:"state,omitempty"`
City string `validate:"required" json:"city,omitempty"`
}
// Account ...
type Account struct {
Number string `validate:"required" json:"number,omitempty"`
Branch string `validate:"required" json:"branch,omitempty"`
AccountType TransfersAccountType `json:"type,omitempty"`
}
// Payer ...
type Payer struct {
Name string `validate:"required" json:"name,omitempty"`
TradeName string `json:"tradeName,omitempty"`
Document string `validate:"required,cnpjcpf" json:"document,omitempty"`
Address *BoletoAddress `validate:"required" json:"address,omitempty"`
}
// BoletoPayer ...
type BoletoPayer struct {
Name string `validate:"required,max=50" json:"name,omitempty"`
TradeName string `validate:"max=80" json:"tradeName,omitempty"`
Document string `validate:"required,cnpjcpf" json:"document,omitempty"`
Address *BoletoAddress `validate:"required" json:"address,omitempty"`
}
// ErrorResponse ...
type ErrorResponse struct {
Errors []ErrorModel `json:"errors,omitempty"`
Title string `json:"title,omitempty"`
Status int32 `json:"status,omitempty"`
TraceId string `json:"traceId,omitempty"`
Reference string `json:"reference,omitempty"`
CodeMessageErrorResponse
}
// CardErrorResponse ...
type CardErrorResponse struct {
ErrorKey string `json:"errorKey,omitempty"`
CodeMessageErrorResponse
}
// CodeMessageErrorResponse ...
type CodeMessageErrorResponse struct {
Code string `json:"code,omitempty"`
Message string `json:"message,omitempty"`
}
// TransferErrorResponse ...
type TransferErrorResponse struct {
Layer string `json:"layer,omitempty"`
ApplicationName string `json:"applicationName,omitempty"`
Errors []KeyValueErrorModel `json:"errors,omitempty"`
CodeMessageErrorResponse
}
// ErrorModel ...
type ErrorModel struct {
Code string `json:"code,omitempty"`
PropertyName string `json:"propertyName,omitempty"`
Messages []string `json:"messages,omitempty"`
KeyValueErrorModel
}
// KeyValueErrorModel ...
type KeyValueErrorModel struct {
Key string `json:"key,omitempty"`
Value string `json:"value,omitempty"`
}
// AccountResponse ...
type AccountResponse struct {
Balance *BalanceRespone `json:"balance,omitempty"`
Status string `json:"status,omitempty"`
Branch string `json:"branch,omitempty"`
Number string `json:"number,omitempty"`
Bank *BankData `json:"bank,omitempty"`
}
// BalanceRespone ...
type BalanceRespone struct {
InProcess BalanceValue `json:"inProcess,omitempty"`
Available BalanceValue `json:"available,omitempty"`
Blocked BalanceValue `json:"blocked,omitempty"`
}
// BalanceValue ...
type BalanceValue struct {
Amount float64 `json:"amount,omitempty"`
Currency string `json:"currency,omitempty"`
}
// TransfersRequest ...
type TransfersRequest struct {
Amount int64 `validate:"required" json:"amount"`
Sender SenderRequest `validate:"required,dive" json:"sender"`
Recipient RecipientRequest `validate:"required,dive" json:"recipient"`
Description string `json:"description"`
}
// SenderRequest ...
type SenderRequest struct {
Branch string `validate:"required" json:"branch"`
Account string `validate:"required" json:"account"`
Document string `validate:"required" json:"document"`
Name string `validate:"required" json:"name"`
}
// RecipientRequest ...
type RecipientRequest struct {
TransfersAccountType TransfersAccountType `validate:"required" json:"accountType"`
BankCode string `validate:"required" json:"bankCode"`
Branch string `validate:"required" json:"branch"`
Account string `validate:"required" json:"account"`
Document string `validate:"required" json:"document"`
Name string `validate:"required" json:"name"`
}
// IncomeReportRequest ...
type IncomeReportRequest struct {
Account string `validate:"required" form:"account"`
Year string `validate:"required" form:"year"`
}
// IncomeReportResponse ...
type IncomeReportResponse struct {
Data IncomeReportData `json:"data"`
Links []IncomeReportLink `json:"links"`
}
// IncomeReportData ...
type IncomeReportData struct {
Holder *IncomeReportHolder `json:"holder"`
Account *IncomeReportAccount `json:"account"`
Payers []IncomeReportPayers `json:"payers"`
}
// IncomeReportHolder ...
type IncomeReportHolder struct {
Type string `json:"type"`
CreatedAt time.Time `json:"createdAt"`
Name string `json:"name"`
Document *IncomeReportDocument `json:"document"`
}
// IncomeReportDocument ...
type IncomeReportDocument struct {
Value string `json:"value"`
Type string `json:"type"`
}
// IncomeReportSource ...
type IncomeReportSource struct {
Name string `json:"name"`
Document *IncomeReportDocument `json:"document"`
}
// IncomeReportPayers ...
type IncomeReportPayers struct {
Source *IncomeReportSource `json:"source"`
Currencies *IncomeReportCurrency `json:"currencies"`
NetIncome *IncomeReportNetIncome `json:"netIncome"`
}
// IncomeReportNetIncome ...
type IncomeReportNetIncome struct {
Year int `json:"year"`
Amount IncomeReportAmount `json:"amount"`
}
// IncomeReportCurrency ...
type IncomeReportCurrency struct {
BRL *IncomeReportBRL `json:"brl"`
}
// IncomeReportBRL ...
type IncomeReportBRL struct {
Balances []IncomeReportBalance `json:"balances"`
}
// IncomeReportBalance ...
type IncomeReportBalance struct {
Year int `json:"year"`
Amount *IncomeReportAmount `json:"amount"`
}
// IncomeReportAmount ...
type IncomeReportAmount struct {
Value float64 `json:"value"`
Currency string `json:"currency"`
}
// IncomeReportAccount ...
type IncomeReportAccount struct {
Branch string `json:"branch"`
Number string `json:"number"`
}
// IncomeReportLink ...
type IncomeReportLink struct {
URL string `json:"url"`
Rel string `json:"rel"`
Method string `json:"method"`
}
// TransfersAccountType ...
type TransfersAccountType string
const (
//CheckingAccount Conta corrente
CheckingAccount TransfersAccountType = "CHECKING"
//SavingsAccount Conta Poupança
SavingsAccount TransfersAccountType = "SAVINGS"
)
// TransfersStatus
type TransfersStatus string
const (
// Created
TransfersStatusCreated TransfersStatus = "CREATED"
// InProcess
TransfersStatusInProcess TransfersStatus = "IN_PROCESS"
// Approved
TransfersStatusApproved TransfersStatus = "APPROVED"
// Reproved
TransfersStatusReproved TransfersStatus = "REPROVED"
// Done
TransfersStatusDone TransfersStatus = "DONE"
// Undone
TransfersStatusUndone TransfersStatus = "UNDONE"
// Canceled
TransfersStatusCanceled TransfersStatus = "CANCELED"
)
// TransfersResponse ...
type TransfersResponse struct {
ContinuationToken string `json:"continuationToken"`
Data []TransferByCodeResponse `json:"data"`
}
// TransferByCodeResponse ...
type TransferByCodeResponse struct {
CompanyKey string `json:"companyKey"`
AuthenticationCode string `json:"authenticationCode"`
Amount float64 `json:"amount"`
CorrelationId string `json:"correlationId"`
Sender *SenderResponse `json:"sender"`
Recipient *RecipientResponse `json:"recipient"`
Channel string `json:"channel"`
Operation string `json:"operation"`
Identifier string `json:"identifier"`
Status TransfersStatus `json:"status"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
// BusinessRequest ...
type BusinessRequest struct {
DocumentNumber string `json:"documentNumber,omitempty"`
BusinessName string `json:"businessName,omitempty"`
TradingName string `json:"tradingName,omitempty"`
BusinessEmail string `json:"businessEmail,omitempty"`
BusinessType BusinessType `json:"businessType"`
BusinessSize BusinessSize `json:"businessSize"`
BusinessAddress *Address `json:"businessAddress,omitempty"`
DeclaredAnnualBilling DeclaredAnnualBilling `json:"declaredAnnualBilling"`
LegalRepresentatives []*LegalRepresentative `json:"legalRepresentatives,omitempty"`
}
// SimpleBusinessRequest ...
type SimpleBusinessRequest struct {
DocumentNumber string `validate:"required,cnpj" json:"documentNumber,omitempty"`
BusinessName string `validate:"required" json:"businessName,omitempty"`
TradingName string `json:"tradingName,omitempty"`
BusinessEmail string `validate:"required" json:"businessEmail,omitempty"`
BusinessType BusinessType `validate:"required" json:"businessType"`
BusinessSize BusinessSize `validate:"required" json:"businessSize"`
BusinessAddress *Address `validate:"required,dive" json:"businessAddress,omitempty"`
DeclaredAnnualBilling DeclaredAnnualBilling `validate:"required" json:"declaredAnnualBilling"`
LegalRepresentative *SimpleLegalRepresentative `validate:"required,dive" json:"legalRepresentative,omitempty"`
}
// CorporationBusinessRequest ...
type CorporationBusinessRequest struct {
DocumentNumber string `validate:"required,cnpj" json:"documentNumber,omitempty"`
BusinessName string `validate:"required" json:"businessName,omitempty"`
TradingName string `json:"tradingName,omitempty"`
BusinessEmail string `validate:"required" json:"businessEmail,omitempty"`
Phone *Phone `validate:"required,dive" json:"phone,omitempty"`
BusinessAddress *Address `validate:"required,dive" json:"businessAddress,omitempty"`
BusinessType BusinessType `validate:"required" json:"businessType"`
BusinessSize string `validate:"required" json:"businessSize"`
CNAECode *string `validate:"required" json:"cnaeCode,omitempty"`
LegalNature *string `validate:"required" json:"legalNature,omitempty"`
OpeningDate *time.Time `validate:"required" json:"openingDate,omitempty"`
AnnualBilling *float64 `json:"annualBilling,omitempty"` //deprecated
DeclaredAnnualBilling DeclaredAnnualBilling `validate:"required" json:"declaredAnnualBilling,omitempty"`
LegalRepresentatives []*CorporationLegalRepresentative `validate:"required,dive" json:"legalRepresentatives,omitempty"`
Owners []*Owners `json:"owners,omitempty"`
Documentation CorporationBusinessDocumentation `validate:"required,dive" json:"documentation,omitempty"`
}
// BusinessUpdateRequest ...
type BusinessUpdateRequest struct {
BusinessName string `validate:"required" json:"businessName,omitempty"`
TradingName string `json:"tradingName,omitempty"`
BusinessEmail string `json:"businessEmail,omitempty"`
BusinessType BusinessType `validate:"required" json:"businessType"`
BusinessSize BusinessSize `validate:"required" json:"businessSize"`
BusinessAddress *Address `validate:"required,dive" json:"businessAddress,omitempty"`
LegalRepresentative *LegalRepresentative `validate:"required,dive" json:"legalRepresentative,omitempty"`
}
// CustomerUpdateRequest ...
type CustomerUpdateRequest struct {
RegisterName string `validate:"required" json:"registerName,omitempty"`
SocialName string `json:"socialName,omitempty"`
Phone *Phone `validate:"required,dive" json:"phone,omitempty"`
Address *Address `validate:"required,dive" json:"address,omitempty"`
BirthDate time.Time `validate:"required" json:"birthDate,omitempty"`
MotherName string `validate:"required" json:"motherName,omitempty"`
Email string `validate:"required" json:"email,omitempty"`
PoliticallyExposedPerson PoliticallyExposedPerson `json:"pep,omitempty"`
Occupation string `json:"occupation,omitempty"`
AssertedIncome AssertedIncome `json:"assertedIncome,omitempty"`
}
// CancelAccountReason ...
type CancelAccountReason string
const (
// HolderRequest ...
CancelAccountHolderRequest CancelAccountReason = "HOLDER_REQUEST"
// CommercialDisagreement ...
CancelAccountCommercialDisagreement CancelAccountReason = "COMMERCIAL_DISAGREEMENT"
)
// CancelAccountRequest ...
type CancelAccountRequest struct {
Reason CancelAccountReason `validate:"required" json:"reason"`
}
// BusinessType ...
type BusinessType string
const (
BusinessTypeMEI BusinessType = "MEI"
BusinessTypeEI BusinessType = "EI"
BusinessTypeEIRELI BusinessType = "EIRELI"
BusinessTypeLTDA BusinessType = "LTDA"
BusinessTypeSA BusinessType = "SA"
)
// BusinessSize ...
type BusinessSize string
const (
BusinessSizeMEI BusinessSize = "MEI"
BusinessSizeME BusinessSize = "ME"
BusinessSizeEPP BusinessSize = "EPP"
)
// CorporationBusinessSize ...
type CorporationBusinessSize string
const (
CorporationBusinessSizeSMALL CorporationBusinessSize = "SMALL"
CorporationBusinessSizeMEDIUM CorporationBusinessSize = "MEDIUM"
CorporationBusinessSizeLARGE CorporationBusinessSize = "LARGE"
)
// BusinessSize ...
type ResultLevel string
const (
ResultLevelBasic ResultLevel = "BASIC"
ResultLevelDetailed ResultLevel = "DETAILED"
ResultLevelOnlyStatus ResultLevel = "ONLY_STATUS"
)
// LegalRepresentative ...
type LegalRepresentative struct {
DocumentNumber string `validate:"required,cnpjcpf" json:"documentNumber,omitempty"`
Document LegalRepresentativeDocument `json:"document,omitempty"`
RegisterName string `json:"registerName,omitempty"`
SocialName string `json:"socialName,omitempty"`
BusinessName string `json:"businessName,omitempty"`
TradingName string `json:"tradingName,omitempty"`
BusinessType BusinessType `json:"businessType,omitempty"`
Email string `validate:"required" json:"email,omitempty"`
Phone *Phone `validate:"required,dive" json:"phone,omitempty"`
Address *Address `validate:"required,dive" json:"address,omitempty"`
BirthDate time.Time `json:"birthDate,omitempty"`
MotherName string `json:"motherName,omitempty"`
IncomeDeclared *float64 `json:"incomeDeclared,omitempty"` //deprecated
DeclaredIncome DeclaredIncome `json:"declaredIncome,omitempty"`
DeclaredAnnualBilling DeclaredAnnualBilling `json:"declaredAnnualBilling,omitempty"`
Occupation string `json:"occupation,omitempty"`
ParticipationPercentage *int `json:"participationPercentage,omitempty"`
IsPoliticallyExposedPerson *bool `json:"isPoliticallyExposedPerson,omitempty"` //deprecated
PoliticallyExposedPerson PoliticallyExposedPerson `json:"pep,omitempty"`
MemberQualification *string `json:"memberQualification,omitempty"`
PowerOfAttorney *PowerOfAttorney `json:"powerOfAttorney,omitempty"`
Documentation *Documentation `json:"documentation,omitempty"`
}
// CorporationLegalRepresentative ...
type CorporationLegalRepresentative struct {
DocumentNumber string `validate:"required,cnpjcpf" json:"documentNumber,omitempty"` //// corporation nao
RegisterName string `validate:"required" json:"registerName,omitempty"`
SocialName string `json:"socialName,omitempty"`
BirthDate time.Time `validate:"required" json:"birthDate,omitempty"`
MotherName string `validate:"required" json:"motherName,omitempty"`
Email string `validate:"required" json:"email,omitempty"`
DeclaredIncome DeclaredIncome `validate:"required" json:"declaredIncome,omitempty"`
Occupation string `validate:"required" json:"occupation,omitempty"`
IsPoliticallyExposedPerson *bool `json:"isPoliticallyExposedPerson,omitempty"` //deprecated
PoliticallyExposedPerson PoliticallyExposedPerson `validate:"required,dive" json:"pep,omitempty"`
Phone *Phone `validate:"required,dive" json:"phone,omitempty"`
Address *Address `validate:"required,dive" json:"address,omitempty"`
MemberQualification *string `json:"memberQualification,omitempty"`
PowerOfAttorney *PowerOfAttorney `json:"powerOfAttorney,omitempty"`
}
// PowerOfAttorney ...
type PowerOfAttorney struct {
StartDate time.Time `json:"startDate,omitempty"`
EndDate time.Time `json:"endDate,omitempty"`
}
// Owners ...
type Owners struct {
LegalRepresentative
}
// SimpleLegalRepresentative ...
type SimpleLegalRepresentative struct {
DocumentNumber string `validate:"required,cnpjcpf" json:"documentNumber,omitempty"` //deprecated
Document LegalRepresentativeDocument `validate:"required,dive" json:"document,omitempty"`
RegisterName string `validate:"required" json:"registerName,omitempty"`
SocialName string `json:"socialName,omitempty"`
Email string `validate:"required" json:"email,omitempty"`
Phone *Phone `validate:"required,dive" json:"phone,omitempty"`
Address *Address `validate:"required,dive" json:"address,omitempty"`
BirthDate time.Time `validate:"required" json:"birthDate,omitempty"`
MotherName string `validate:"required" json:"motherName,omitempty"`
DeclaredIncome DeclaredIncome `validate:"required" json:"declaredIncome,omitempty"`
Occupation string `validate:"required" json:"occupation,omitempty"`
PoliticallyExposedPerson PoliticallyExposedPerson `validate:"required,dive" json:"pep,omitempty"`
Documentation Documentation `validate:"required,dive" json:"documentation,omitempty"`
}
// LegalRepresentativeDocument ...
type LegalRepresentativeDocument struct {
Value string `validate:"required,cnpjcpf" json:"value,omitempty"`
Type string `validate:"required" json:"type,omitempty"`
}
// BusinessResponse ...
type BusinessResponse struct {
ResultLevel ResultLevel `json:"resultLevel,omitempty"`
Document string `json:"documentNumber,omitempty"`
BusinessName string `json:"businessName,omitempty"`
TradingName string `json:"tradingName,omitempty"`
BusinessEmail string `json:"businessEmail,omitempty"`
Status string `json:"status,omitempty"`
Reasons []string `json:"reasons,omitempty"`
BusinessType BusinessType `json:"businessType"`
BusinessSize BusinessSize `json:"businessSize"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
// BusinessAccountRequest ...
type BusinessAccountRequest struct {
Document string `validate:"required,cnpj" json:"documentNumber,omitempty"`
AccountType AccountType `validate:"required" json:"accountType"`
}
// BoletoType ...
type BoletoType string
const (
Deposit BoletoType = "Deposit" // depósito (quando emitente é o próprio pagador)
Levy BoletoType = "Levy" // cobrança (quando emitente é diferente do pagador)
Invoice BoletoType = "Invoice" // cartão de crédito
)
// BoletoRequest ...
type BoletoRequest struct {
APIVersion *string `validate:"required" json:"api_version,omitempty"`
Account *Account `validate:"required" json:"account,omitempty"`
Document string `validate:"required,cnpjcpf" json:"documentNumber,omitempty"`
Amount float64 `validate:"required" json:"amount,omitempty"`
DueDate time.Time `validate:"required" json:"dueDate,omitempty"`
Type BoletoType `validate:"required" json:"type,omitempty"`
Alias *string `json:"alias,omitempty"`
Payer *BoletoPayer `json:"payer,omitempty"`
Fine *BoletoFine `json:"fine,omitempty"`
Interest *BoletoInterest `json:"interest,omitempty"`
Discount *BoletoDiscounts `json:"discount,omitempty"` // api-version 2.0
Discounts *BoletoDiscounts `json:"discounts,omitempty"` // deprecated // api-version 1.0
ClosePayment time.Time `json:"closePayment,omitempty"`
}
// BoletoResponse ...
type BoletoResponse struct {
AuthenticationCode string `json:"authenticationCode,omitempty"`
Account *Account `json:"account,omitempty"`
}
// BoletoInterestType ...
type BoletoInterestType string
const (
FixedAmountInterestType BoletoInterestType = "FixedAmount"
PercentInterestType BoletoInterestType = "Percent"
)
// BoletoInterest ...
type BoletoInterest struct {
StartDate time.Time `validate:"required" json:"startDate,omitempty"`
Value float64 `validate:"required" json:"value,omitempty"`
Type BoletoInterestType `validate:"required" json:"type,omitempty"`
}
// BoletoFineType ...
type BoletoFineType string
const (
FixedAmountFineType BoletoFineType = "FixedAmount"
PercentFineType BoletoFineType = "Percent"
)
// BoletoFine ...
type BoletoFine struct {
StartDate time.Time `validate:"required" json:"startDate,omitempty"`
Value float64 `validate:"required" json:"value,omitempty"`
Type BoletoFineType `validate:"required" json:"type,omitempty"`
}
// BoletoDiscountsType ...
type BoletoDiscountsType string
const (
FixedAmountDiscountType BoletoDiscountsType = "FixedAmountUntilLimitDate"
FixedPercentDiscountType BoletoDiscountsType = "FixedPercentUntilLimitDate"
)
// BoletoDiscounts ...
type BoletoDiscounts struct {
LimitDate time.Time `json:"limitDate"`
Value float64 `validate:"required" json:"value,omitempty"`
Type BoletoDiscountsType `validate:"required" json:"type,omitempty"`
}
// BoletoAmount ...
type BoletoAmount struct {
Value float64 `json:"value,omitempty"`
Currency string `json:"currency,omitempty"`
}
type PaymentChannel string
const (