@fatehan/tsrp 1.4.6 → 1.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
8
8
  return (mod && mod.__esModule) ? mod : { "default": mod };
9
9
  };
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.Currency = exports.Wallet = exports.protobufPackage = void 0;
11
+ exports.PaymentGateway_Config = exports.PaymentGateway = exports.Product = exports.ProductType = exports.Currency = exports.Wallet = exports.protobufPackage = void 0;
12
12
  /* eslint-disable */
13
13
  const wire_1 = require("@bufbuild/protobuf/wire");
14
14
  const long_1 = __importDefault(require("long"));
@@ -356,6 +356,828 @@ exports.Currency = {
356
356
  return message;
357
357
  },
358
358
  };
359
+ function createBaseProductType() {
360
+ return {
361
+ id: long_1.default.UZERO,
362
+ name: undefined,
363
+ description: undefined,
364
+ months: undefined,
365
+ keyType: "",
366
+ picture: undefined,
367
+ createdBy: undefined,
368
+ updatedBy: undefined,
369
+ createdAt: undefined,
370
+ updatedAt: undefined,
371
+ };
372
+ }
373
+ exports.ProductType = {
374
+ encode(message, writer = new wire_1.BinaryWriter()) {
375
+ if (!message.id.equals(long_1.default.UZERO)) {
376
+ writer.uint32(8).uint64(message.id.toString());
377
+ }
378
+ if (message.name !== undefined) {
379
+ writer.uint32(18).string(message.name);
380
+ }
381
+ if (message.description !== undefined) {
382
+ writer.uint32(26).string(message.description);
383
+ }
384
+ if (message.months !== undefined) {
385
+ writer.uint32(32).uint32(message.months);
386
+ }
387
+ if (message.keyType !== "") {
388
+ writer.uint32(42).string(message.keyType);
389
+ }
390
+ if (message.picture !== undefined) {
391
+ writer.uint32(50).string(message.picture);
392
+ }
393
+ if (message.createdBy !== undefined) {
394
+ writer.uint32(56).uint64(message.createdBy.toString());
395
+ }
396
+ if (message.updatedBy !== undefined) {
397
+ writer.uint32(64).uint64(message.updatedBy.toString());
398
+ }
399
+ if (message.createdAt !== undefined) {
400
+ timestamp_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(74).fork()).join();
401
+ }
402
+ if (message.updatedAt !== undefined) {
403
+ timestamp_1.Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(82).fork()).join();
404
+ }
405
+ return writer;
406
+ },
407
+ decode(input, length) {
408
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
409
+ const end = length === undefined ? reader.len : reader.pos + length;
410
+ const message = createBaseProductType();
411
+ while (reader.pos < end) {
412
+ const tag = reader.uint32();
413
+ switch (tag >>> 3) {
414
+ case 1: {
415
+ if (tag !== 8) {
416
+ break;
417
+ }
418
+ message.id = long_1.default.fromString(reader.uint64().toString(), true);
419
+ continue;
420
+ }
421
+ case 2: {
422
+ if (tag !== 18) {
423
+ break;
424
+ }
425
+ message.name = reader.string();
426
+ continue;
427
+ }
428
+ case 3: {
429
+ if (tag !== 26) {
430
+ break;
431
+ }
432
+ message.description = reader.string();
433
+ continue;
434
+ }
435
+ case 4: {
436
+ if (tag !== 32) {
437
+ break;
438
+ }
439
+ message.months = reader.uint32();
440
+ continue;
441
+ }
442
+ case 5: {
443
+ if (tag !== 42) {
444
+ break;
445
+ }
446
+ message.keyType = reader.string();
447
+ continue;
448
+ }
449
+ case 6: {
450
+ if (tag !== 50) {
451
+ break;
452
+ }
453
+ message.picture = reader.string();
454
+ continue;
455
+ }
456
+ case 7: {
457
+ if (tag !== 56) {
458
+ break;
459
+ }
460
+ message.createdBy = long_1.default.fromString(reader.uint64().toString(), true);
461
+ continue;
462
+ }
463
+ case 8: {
464
+ if (tag !== 64) {
465
+ break;
466
+ }
467
+ message.updatedBy = long_1.default.fromString(reader.uint64().toString(), true);
468
+ continue;
469
+ }
470
+ case 9: {
471
+ if (tag !== 74) {
472
+ break;
473
+ }
474
+ message.createdAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
475
+ continue;
476
+ }
477
+ case 10: {
478
+ if (tag !== 82) {
479
+ break;
480
+ }
481
+ message.updatedAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
482
+ continue;
483
+ }
484
+ }
485
+ if ((tag & 7) === 4 || tag === 0) {
486
+ break;
487
+ }
488
+ reader.skip(tag & 7);
489
+ }
490
+ return message;
491
+ },
492
+ fromJSON(object) {
493
+ return {
494
+ id: isSet(object.id) ? long_1.default.fromValue(object.id) : long_1.default.UZERO,
495
+ name: isSet(object.name) ? globalThis.String(object.name) : undefined,
496
+ description: isSet(object.description) ? globalThis.String(object.description) : undefined,
497
+ months: isSet(object.months) ? globalThis.Number(object.months) : undefined,
498
+ keyType: isSet(object.key_type) ? globalThis.String(object.key_type) : "",
499
+ picture: isSet(object.picture) ? globalThis.String(object.picture) : undefined,
500
+ createdBy: isSet(object.created_by) ? long_1.default.fromValue(object.created_by) : undefined,
501
+ updatedBy: isSet(object.updated_by) ? long_1.default.fromValue(object.updated_by) : undefined,
502
+ createdAt: isSet(object.created_at) ? fromJsonTimestamp(object.created_at) : undefined,
503
+ updatedAt: isSet(object.updated_at) ? fromJsonTimestamp(object.updated_at) : undefined,
504
+ };
505
+ },
506
+ toJSON(message) {
507
+ const obj = {};
508
+ if (!message.id.equals(long_1.default.UZERO)) {
509
+ obj.id = (message.id || long_1.default.UZERO).toString();
510
+ }
511
+ if (message.name !== undefined) {
512
+ obj.name = message.name;
513
+ }
514
+ if (message.description !== undefined) {
515
+ obj.description = message.description;
516
+ }
517
+ if (message.months !== undefined) {
518
+ obj.months = Math.round(message.months);
519
+ }
520
+ if (message.keyType !== "") {
521
+ obj.key_type = message.keyType;
522
+ }
523
+ if (message.picture !== undefined) {
524
+ obj.picture = message.picture;
525
+ }
526
+ if (message.createdBy !== undefined) {
527
+ obj.created_by = (message.createdBy || long_1.default.UZERO).toString();
528
+ }
529
+ if (message.updatedBy !== undefined) {
530
+ obj.updated_by = (message.updatedBy || long_1.default.UZERO).toString();
531
+ }
532
+ if (message.createdAt !== undefined) {
533
+ obj.created_at = message.createdAt.toISOString();
534
+ }
535
+ if (message.updatedAt !== undefined) {
536
+ obj.updated_at = message.updatedAt.toISOString();
537
+ }
538
+ return obj;
539
+ },
540
+ create(base) {
541
+ return exports.ProductType.fromPartial(base !== null && base !== void 0 ? base : {});
542
+ },
543
+ fromPartial(object) {
544
+ var _a, _b, _c, _d, _e, _f, _g;
545
+ const message = createBaseProductType();
546
+ message.id = (object.id !== undefined && object.id !== null) ? long_1.default.fromValue(object.id) : long_1.default.UZERO;
547
+ message.name = (_a = object.name) !== null && _a !== void 0 ? _a : undefined;
548
+ message.description = (_b = object.description) !== null && _b !== void 0 ? _b : undefined;
549
+ message.months = (_c = object.months) !== null && _c !== void 0 ? _c : undefined;
550
+ message.keyType = (_d = object.keyType) !== null && _d !== void 0 ? _d : "";
551
+ message.picture = (_e = object.picture) !== null && _e !== void 0 ? _e : undefined;
552
+ message.createdBy = (object.createdBy !== undefined && object.createdBy !== null)
553
+ ? long_1.default.fromValue(object.createdBy)
554
+ : undefined;
555
+ message.updatedBy = (object.updatedBy !== undefined && object.updatedBy !== null)
556
+ ? long_1.default.fromValue(object.updatedBy)
557
+ : undefined;
558
+ message.createdAt = (_f = object.createdAt) !== null && _f !== void 0 ? _f : undefined;
559
+ message.updatedAt = (_g = object.updatedAt) !== null && _g !== void 0 ? _g : undefined;
560
+ return message;
561
+ },
562
+ };
563
+ function createBaseProduct() {
564
+ return {
565
+ id: long_1.default.UZERO,
566
+ organizationId: undefined,
567
+ productTypeId: undefined,
568
+ createdBy: undefined,
569
+ updatedBy: undefined,
570
+ name: "",
571
+ displayName: undefined,
572
+ description: undefined,
573
+ picture: undefined,
574
+ slug: undefined,
575
+ uuid: undefined,
576
+ objectType: undefined,
577
+ objectId: undefined,
578
+ currencyId: long_1.default.UZERO,
579
+ price: long_1.default.UZERO,
580
+ createdAt: undefined,
581
+ updatedAt: undefined,
582
+ };
583
+ }
584
+ exports.Product = {
585
+ encode(message, writer = new wire_1.BinaryWriter()) {
586
+ if (!message.id.equals(long_1.default.UZERO)) {
587
+ writer.uint32(8).uint64(message.id.toString());
588
+ }
589
+ if (message.organizationId !== undefined) {
590
+ writer.uint32(16).uint64(message.organizationId.toString());
591
+ }
592
+ if (message.productTypeId !== undefined) {
593
+ writer.uint32(24).uint64(message.productTypeId.toString());
594
+ }
595
+ if (message.createdBy !== undefined) {
596
+ writer.uint32(32).uint64(message.createdBy.toString());
597
+ }
598
+ if (message.updatedBy !== undefined) {
599
+ writer.uint32(40).uint64(message.updatedBy.toString());
600
+ }
601
+ if (message.name !== "") {
602
+ writer.uint32(50).string(message.name);
603
+ }
604
+ if (message.displayName !== undefined) {
605
+ writer.uint32(58).string(message.displayName);
606
+ }
607
+ if (message.description !== undefined) {
608
+ writer.uint32(66).string(message.description);
609
+ }
610
+ if (message.picture !== undefined) {
611
+ writer.uint32(74).string(message.picture);
612
+ }
613
+ if (message.slug !== undefined) {
614
+ writer.uint32(82).string(message.slug);
615
+ }
616
+ if (message.uuid !== undefined) {
617
+ writer.uint32(90).string(message.uuid);
618
+ }
619
+ if (message.objectType !== undefined) {
620
+ writer.uint32(98).string(message.objectType);
621
+ }
622
+ if (message.objectId !== undefined) {
623
+ writer.uint32(104).uint64(message.objectId.toString());
624
+ }
625
+ if (!message.currencyId.equals(long_1.default.UZERO)) {
626
+ writer.uint32(112).uint64(message.currencyId.toString());
627
+ }
628
+ if (!message.price.equals(long_1.default.UZERO)) {
629
+ writer.uint32(120).uint64(message.price.toString());
630
+ }
631
+ if (message.createdAt !== undefined) {
632
+ timestamp_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(130).fork()).join();
633
+ }
634
+ if (message.updatedAt !== undefined) {
635
+ timestamp_1.Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(138).fork()).join();
636
+ }
637
+ return writer;
638
+ },
639
+ decode(input, length) {
640
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
641
+ const end = length === undefined ? reader.len : reader.pos + length;
642
+ const message = createBaseProduct();
643
+ while (reader.pos < end) {
644
+ const tag = reader.uint32();
645
+ switch (tag >>> 3) {
646
+ case 1: {
647
+ if (tag !== 8) {
648
+ break;
649
+ }
650
+ message.id = long_1.default.fromString(reader.uint64().toString(), true);
651
+ continue;
652
+ }
653
+ case 2: {
654
+ if (tag !== 16) {
655
+ break;
656
+ }
657
+ message.organizationId = long_1.default.fromString(reader.uint64().toString(), true);
658
+ continue;
659
+ }
660
+ case 3: {
661
+ if (tag !== 24) {
662
+ break;
663
+ }
664
+ message.productTypeId = long_1.default.fromString(reader.uint64().toString(), true);
665
+ continue;
666
+ }
667
+ case 4: {
668
+ if (tag !== 32) {
669
+ break;
670
+ }
671
+ message.createdBy = long_1.default.fromString(reader.uint64().toString(), true);
672
+ continue;
673
+ }
674
+ case 5: {
675
+ if (tag !== 40) {
676
+ break;
677
+ }
678
+ message.updatedBy = long_1.default.fromString(reader.uint64().toString(), true);
679
+ continue;
680
+ }
681
+ case 6: {
682
+ if (tag !== 50) {
683
+ break;
684
+ }
685
+ message.name = reader.string();
686
+ continue;
687
+ }
688
+ case 7: {
689
+ if (tag !== 58) {
690
+ break;
691
+ }
692
+ message.displayName = reader.string();
693
+ continue;
694
+ }
695
+ case 8: {
696
+ if (tag !== 66) {
697
+ break;
698
+ }
699
+ message.description = reader.string();
700
+ continue;
701
+ }
702
+ case 9: {
703
+ if (tag !== 74) {
704
+ break;
705
+ }
706
+ message.picture = reader.string();
707
+ continue;
708
+ }
709
+ case 10: {
710
+ if (tag !== 82) {
711
+ break;
712
+ }
713
+ message.slug = reader.string();
714
+ continue;
715
+ }
716
+ case 11: {
717
+ if (tag !== 90) {
718
+ break;
719
+ }
720
+ message.uuid = reader.string();
721
+ continue;
722
+ }
723
+ case 12: {
724
+ if (tag !== 98) {
725
+ break;
726
+ }
727
+ message.objectType = reader.string();
728
+ continue;
729
+ }
730
+ case 13: {
731
+ if (tag !== 104) {
732
+ break;
733
+ }
734
+ message.objectId = long_1.default.fromString(reader.uint64().toString(), true);
735
+ continue;
736
+ }
737
+ case 14: {
738
+ if (tag !== 112) {
739
+ break;
740
+ }
741
+ message.currencyId = long_1.default.fromString(reader.uint64().toString(), true);
742
+ continue;
743
+ }
744
+ case 15: {
745
+ if (tag !== 120) {
746
+ break;
747
+ }
748
+ message.price = long_1.default.fromString(reader.uint64().toString(), true);
749
+ continue;
750
+ }
751
+ case 16: {
752
+ if (tag !== 130) {
753
+ break;
754
+ }
755
+ message.createdAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
756
+ continue;
757
+ }
758
+ case 17: {
759
+ if (tag !== 138) {
760
+ break;
761
+ }
762
+ message.updatedAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
763
+ continue;
764
+ }
765
+ }
766
+ if ((tag & 7) === 4 || tag === 0) {
767
+ break;
768
+ }
769
+ reader.skip(tag & 7);
770
+ }
771
+ return message;
772
+ },
773
+ fromJSON(object) {
774
+ return {
775
+ id: isSet(object.id) ? long_1.default.fromValue(object.id) : long_1.default.UZERO,
776
+ organizationId: isSet(object.organization_id) ? long_1.default.fromValue(object.organization_id) : undefined,
777
+ productTypeId: isSet(object.product_type_id) ? long_1.default.fromValue(object.product_type_id) : undefined,
778
+ createdBy: isSet(object.created_by) ? long_1.default.fromValue(object.created_by) : undefined,
779
+ updatedBy: isSet(object.updated_by) ? long_1.default.fromValue(object.updated_by) : undefined,
780
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
781
+ displayName: isSet(object.display_name) ? globalThis.String(object.display_name) : undefined,
782
+ description: isSet(object.description) ? globalThis.String(object.description) : undefined,
783
+ picture: isSet(object.picture) ? globalThis.String(object.picture) : undefined,
784
+ slug: isSet(object.slug) ? globalThis.String(object.slug) : undefined,
785
+ uuid: isSet(object.uuid) ? globalThis.String(object.uuid) : undefined,
786
+ objectType: isSet(object.object_type) ? globalThis.String(object.object_type) : undefined,
787
+ objectId: isSet(object.object_id) ? long_1.default.fromValue(object.object_id) : undefined,
788
+ currencyId: isSet(object.currency_id) ? long_1.default.fromValue(object.currency_id) : long_1.default.UZERO,
789
+ price: isSet(object.price) ? long_1.default.fromValue(object.price) : long_1.default.UZERO,
790
+ createdAt: isSet(object.created_at) ? fromJsonTimestamp(object.created_at) : undefined,
791
+ updatedAt: isSet(object.updated_at) ? fromJsonTimestamp(object.updated_at) : undefined,
792
+ };
793
+ },
794
+ toJSON(message) {
795
+ const obj = {};
796
+ if (!message.id.equals(long_1.default.UZERO)) {
797
+ obj.id = (message.id || long_1.default.UZERO).toString();
798
+ }
799
+ if (message.organizationId !== undefined) {
800
+ obj.organization_id = (message.organizationId || long_1.default.UZERO).toString();
801
+ }
802
+ if (message.productTypeId !== undefined) {
803
+ obj.product_type_id = (message.productTypeId || long_1.default.UZERO).toString();
804
+ }
805
+ if (message.createdBy !== undefined) {
806
+ obj.created_by = (message.createdBy || long_1.default.UZERO).toString();
807
+ }
808
+ if (message.updatedBy !== undefined) {
809
+ obj.updated_by = (message.updatedBy || long_1.default.UZERO).toString();
810
+ }
811
+ if (message.name !== "") {
812
+ obj.name = message.name;
813
+ }
814
+ if (message.displayName !== undefined) {
815
+ obj.display_name = message.displayName;
816
+ }
817
+ if (message.description !== undefined) {
818
+ obj.description = message.description;
819
+ }
820
+ if (message.picture !== undefined) {
821
+ obj.picture = message.picture;
822
+ }
823
+ if (message.slug !== undefined) {
824
+ obj.slug = message.slug;
825
+ }
826
+ if (message.uuid !== undefined) {
827
+ obj.uuid = message.uuid;
828
+ }
829
+ if (message.objectType !== undefined) {
830
+ obj.object_type = message.objectType;
831
+ }
832
+ if (message.objectId !== undefined) {
833
+ obj.object_id = (message.objectId || long_1.default.UZERO).toString();
834
+ }
835
+ if (!message.currencyId.equals(long_1.default.UZERO)) {
836
+ obj.currency_id = (message.currencyId || long_1.default.UZERO).toString();
837
+ }
838
+ if (!message.price.equals(long_1.default.UZERO)) {
839
+ obj.price = (message.price || long_1.default.UZERO).toString();
840
+ }
841
+ if (message.createdAt !== undefined) {
842
+ obj.created_at = message.createdAt.toISOString();
843
+ }
844
+ if (message.updatedAt !== undefined) {
845
+ obj.updated_at = message.updatedAt.toISOString();
846
+ }
847
+ return obj;
848
+ },
849
+ create(base) {
850
+ return exports.Product.fromPartial(base !== null && base !== void 0 ? base : {});
851
+ },
852
+ fromPartial(object) {
853
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
854
+ const message = createBaseProduct();
855
+ message.id = (object.id !== undefined && object.id !== null) ? long_1.default.fromValue(object.id) : long_1.default.UZERO;
856
+ message.organizationId = (object.organizationId !== undefined && object.organizationId !== null)
857
+ ? long_1.default.fromValue(object.organizationId)
858
+ : undefined;
859
+ message.productTypeId = (object.productTypeId !== undefined && object.productTypeId !== null)
860
+ ? long_1.default.fromValue(object.productTypeId)
861
+ : undefined;
862
+ message.createdBy = (object.createdBy !== undefined && object.createdBy !== null)
863
+ ? long_1.default.fromValue(object.createdBy)
864
+ : undefined;
865
+ message.updatedBy = (object.updatedBy !== undefined && object.updatedBy !== null)
866
+ ? long_1.default.fromValue(object.updatedBy)
867
+ : undefined;
868
+ message.name = (_a = object.name) !== null && _a !== void 0 ? _a : "";
869
+ message.displayName = (_b = object.displayName) !== null && _b !== void 0 ? _b : undefined;
870
+ message.description = (_c = object.description) !== null && _c !== void 0 ? _c : undefined;
871
+ message.picture = (_d = object.picture) !== null && _d !== void 0 ? _d : undefined;
872
+ message.slug = (_e = object.slug) !== null && _e !== void 0 ? _e : undefined;
873
+ message.uuid = (_f = object.uuid) !== null && _f !== void 0 ? _f : undefined;
874
+ message.objectType = (_g = object.objectType) !== null && _g !== void 0 ? _g : undefined;
875
+ message.objectId = (object.objectId !== undefined && object.objectId !== null)
876
+ ? long_1.default.fromValue(object.objectId)
877
+ : undefined;
878
+ message.currencyId = (object.currencyId !== undefined && object.currencyId !== null)
879
+ ? long_1.default.fromValue(object.currencyId)
880
+ : long_1.default.UZERO;
881
+ message.price = (object.price !== undefined && object.price !== null) ? long_1.default.fromValue(object.price) : long_1.default.UZERO;
882
+ message.createdAt = (_h = object.createdAt) !== null && _h !== void 0 ? _h : undefined;
883
+ message.updatedAt = (_j = object.updatedAt) !== null && _j !== void 0 ? _j : undefined;
884
+ return message;
885
+ },
886
+ };
887
+ function createBasePaymentGateway() {
888
+ return {
889
+ id: long_1.default.UZERO,
890
+ organizationId: long_1.default.UZERO,
891
+ createdBy: undefined,
892
+ updatedBy: undefined,
893
+ gateway: "",
894
+ name: "",
895
+ default: false,
896
+ status: false,
897
+ config: [],
898
+ createdAt: undefined,
899
+ updatedAt: undefined,
900
+ };
901
+ }
902
+ exports.PaymentGateway = {
903
+ encode(message, writer = new wire_1.BinaryWriter()) {
904
+ if (!message.id.equals(long_1.default.UZERO)) {
905
+ writer.uint32(8).uint64(message.id.toString());
906
+ }
907
+ if (!message.organizationId.equals(long_1.default.UZERO)) {
908
+ writer.uint32(16).uint64(message.organizationId.toString());
909
+ }
910
+ if (message.createdBy !== undefined) {
911
+ writer.uint32(24).uint64(message.createdBy.toString());
912
+ }
913
+ if (message.updatedBy !== undefined) {
914
+ writer.uint32(32).uint64(message.updatedBy.toString());
915
+ }
916
+ if (message.gateway !== "") {
917
+ writer.uint32(42).string(message.gateway);
918
+ }
919
+ if (message.name !== "") {
920
+ writer.uint32(50).string(message.name);
921
+ }
922
+ if (message.default !== false) {
923
+ writer.uint32(56).bool(message.default);
924
+ }
925
+ if (message.status !== false) {
926
+ writer.uint32(64).bool(message.status);
927
+ }
928
+ for (const v of message.config) {
929
+ exports.PaymentGateway_Config.encode(v, writer.uint32(74).fork()).join();
930
+ }
931
+ if (message.createdAt !== undefined) {
932
+ timestamp_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(82).fork()).join();
933
+ }
934
+ if (message.updatedAt !== undefined) {
935
+ timestamp_1.Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(90).fork()).join();
936
+ }
937
+ return writer;
938
+ },
939
+ decode(input, length) {
940
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
941
+ const end = length === undefined ? reader.len : reader.pos + length;
942
+ const message = createBasePaymentGateway();
943
+ while (reader.pos < end) {
944
+ const tag = reader.uint32();
945
+ switch (tag >>> 3) {
946
+ case 1: {
947
+ if (tag !== 8) {
948
+ break;
949
+ }
950
+ message.id = long_1.default.fromString(reader.uint64().toString(), true);
951
+ continue;
952
+ }
953
+ case 2: {
954
+ if (tag !== 16) {
955
+ break;
956
+ }
957
+ message.organizationId = long_1.default.fromString(reader.uint64().toString(), true);
958
+ continue;
959
+ }
960
+ case 3: {
961
+ if (tag !== 24) {
962
+ break;
963
+ }
964
+ message.createdBy = long_1.default.fromString(reader.uint64().toString(), true);
965
+ continue;
966
+ }
967
+ case 4: {
968
+ if (tag !== 32) {
969
+ break;
970
+ }
971
+ message.updatedBy = long_1.default.fromString(reader.uint64().toString(), true);
972
+ continue;
973
+ }
974
+ case 5: {
975
+ if (tag !== 42) {
976
+ break;
977
+ }
978
+ message.gateway = reader.string();
979
+ continue;
980
+ }
981
+ case 6: {
982
+ if (tag !== 50) {
983
+ break;
984
+ }
985
+ message.name = reader.string();
986
+ continue;
987
+ }
988
+ case 7: {
989
+ if (tag !== 56) {
990
+ break;
991
+ }
992
+ message.default = reader.bool();
993
+ continue;
994
+ }
995
+ case 8: {
996
+ if (tag !== 64) {
997
+ break;
998
+ }
999
+ message.status = reader.bool();
1000
+ continue;
1001
+ }
1002
+ case 9: {
1003
+ if (tag !== 74) {
1004
+ break;
1005
+ }
1006
+ message.config.push(exports.PaymentGateway_Config.decode(reader, reader.uint32()));
1007
+ continue;
1008
+ }
1009
+ case 10: {
1010
+ if (tag !== 82) {
1011
+ break;
1012
+ }
1013
+ message.createdAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
1014
+ continue;
1015
+ }
1016
+ case 11: {
1017
+ if (tag !== 90) {
1018
+ break;
1019
+ }
1020
+ message.updatedAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
1021
+ continue;
1022
+ }
1023
+ }
1024
+ if ((tag & 7) === 4 || tag === 0) {
1025
+ break;
1026
+ }
1027
+ reader.skip(tag & 7);
1028
+ }
1029
+ return message;
1030
+ },
1031
+ fromJSON(object) {
1032
+ return {
1033
+ id: isSet(object.id) ? long_1.default.fromValue(object.id) : long_1.default.UZERO,
1034
+ organizationId: isSet(object.organization_id) ? long_1.default.fromValue(object.organization_id) : long_1.default.UZERO,
1035
+ createdBy: isSet(object.created_by) ? long_1.default.fromValue(object.created_by) : undefined,
1036
+ updatedBy: isSet(object.updated_by) ? long_1.default.fromValue(object.updated_by) : undefined,
1037
+ gateway: isSet(object.gateway) ? globalThis.String(object.gateway) : "",
1038
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
1039
+ default: isSet(object.default) ? globalThis.Boolean(object.default) : false,
1040
+ status: isSet(object.status) ? globalThis.Boolean(object.status) : false,
1041
+ config: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.config)
1042
+ ? object.config.map((e) => exports.PaymentGateway_Config.fromJSON(e))
1043
+ : [],
1044
+ createdAt: isSet(object.created_at) ? fromJsonTimestamp(object.created_at) : undefined,
1045
+ updatedAt: isSet(object.updated_at) ? fromJsonTimestamp(object.updated_at) : undefined,
1046
+ };
1047
+ },
1048
+ toJSON(message) {
1049
+ var _a;
1050
+ const obj = {};
1051
+ if (!message.id.equals(long_1.default.UZERO)) {
1052
+ obj.id = (message.id || long_1.default.UZERO).toString();
1053
+ }
1054
+ if (!message.organizationId.equals(long_1.default.UZERO)) {
1055
+ obj.organization_id = (message.organizationId || long_1.default.UZERO).toString();
1056
+ }
1057
+ if (message.createdBy !== undefined) {
1058
+ obj.created_by = (message.createdBy || long_1.default.UZERO).toString();
1059
+ }
1060
+ if (message.updatedBy !== undefined) {
1061
+ obj.updated_by = (message.updatedBy || long_1.default.UZERO).toString();
1062
+ }
1063
+ if (message.gateway !== "") {
1064
+ obj.gateway = message.gateway;
1065
+ }
1066
+ if (message.name !== "") {
1067
+ obj.name = message.name;
1068
+ }
1069
+ if (message.default !== false) {
1070
+ obj.default = message.default;
1071
+ }
1072
+ if (message.status !== false) {
1073
+ obj.status = message.status;
1074
+ }
1075
+ if ((_a = message.config) === null || _a === void 0 ? void 0 : _a.length) {
1076
+ obj.config = message.config.map((e) => exports.PaymentGateway_Config.toJSON(e));
1077
+ }
1078
+ if (message.createdAt !== undefined) {
1079
+ obj.created_at = message.createdAt.toISOString();
1080
+ }
1081
+ if (message.updatedAt !== undefined) {
1082
+ obj.updated_at = message.updatedAt.toISOString();
1083
+ }
1084
+ return obj;
1085
+ },
1086
+ create(base) {
1087
+ return exports.PaymentGateway.fromPartial(base !== null && base !== void 0 ? base : {});
1088
+ },
1089
+ fromPartial(object) {
1090
+ var _a, _b, _c, _d, _e, _f, _g;
1091
+ const message = createBasePaymentGateway();
1092
+ message.id = (object.id !== undefined && object.id !== null) ? long_1.default.fromValue(object.id) : long_1.default.UZERO;
1093
+ message.organizationId = (object.organizationId !== undefined && object.organizationId !== null)
1094
+ ? long_1.default.fromValue(object.organizationId)
1095
+ : long_1.default.UZERO;
1096
+ message.createdBy = (object.createdBy !== undefined && object.createdBy !== null)
1097
+ ? long_1.default.fromValue(object.createdBy)
1098
+ : undefined;
1099
+ message.updatedBy = (object.updatedBy !== undefined && object.updatedBy !== null)
1100
+ ? long_1.default.fromValue(object.updatedBy)
1101
+ : undefined;
1102
+ message.gateway = (_a = object.gateway) !== null && _a !== void 0 ? _a : "";
1103
+ message.name = (_b = object.name) !== null && _b !== void 0 ? _b : "";
1104
+ message.default = (_c = object.default) !== null && _c !== void 0 ? _c : false;
1105
+ message.status = (_d = object.status) !== null && _d !== void 0 ? _d : false;
1106
+ message.config = ((_e = object.config) === null || _e === void 0 ? void 0 : _e.map((e) => exports.PaymentGateway_Config.fromPartial(e))) || [];
1107
+ message.createdAt = (_f = object.createdAt) !== null && _f !== void 0 ? _f : undefined;
1108
+ message.updatedAt = (_g = object.updatedAt) !== null && _g !== void 0 ? _g : undefined;
1109
+ return message;
1110
+ },
1111
+ };
1112
+ function createBasePaymentGateway_Config() {
1113
+ return { key: "", value: "" };
1114
+ }
1115
+ exports.PaymentGateway_Config = {
1116
+ encode(message, writer = new wire_1.BinaryWriter()) {
1117
+ if (message.key !== "") {
1118
+ writer.uint32(10).string(message.key);
1119
+ }
1120
+ if (message.value !== "") {
1121
+ writer.uint32(18).string(message.value);
1122
+ }
1123
+ return writer;
1124
+ },
1125
+ decode(input, length) {
1126
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1127
+ const end = length === undefined ? reader.len : reader.pos + length;
1128
+ const message = createBasePaymentGateway_Config();
1129
+ while (reader.pos < end) {
1130
+ const tag = reader.uint32();
1131
+ switch (tag >>> 3) {
1132
+ case 1: {
1133
+ if (tag !== 10) {
1134
+ break;
1135
+ }
1136
+ message.key = reader.string();
1137
+ continue;
1138
+ }
1139
+ case 2: {
1140
+ if (tag !== 18) {
1141
+ break;
1142
+ }
1143
+ message.value = reader.string();
1144
+ continue;
1145
+ }
1146
+ }
1147
+ if ((tag & 7) === 4 || tag === 0) {
1148
+ break;
1149
+ }
1150
+ reader.skip(tag & 7);
1151
+ }
1152
+ return message;
1153
+ },
1154
+ fromJSON(object) {
1155
+ return {
1156
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
1157
+ value: isSet(object.value) ? globalThis.String(object.value) : "",
1158
+ };
1159
+ },
1160
+ toJSON(message) {
1161
+ const obj = {};
1162
+ if (message.key !== "") {
1163
+ obj.key = message.key;
1164
+ }
1165
+ if (message.value !== "") {
1166
+ obj.value = message.value;
1167
+ }
1168
+ return obj;
1169
+ },
1170
+ create(base) {
1171
+ return exports.PaymentGateway_Config.fromPartial(base !== null && base !== void 0 ? base : {});
1172
+ },
1173
+ fromPartial(object) {
1174
+ var _a, _b;
1175
+ const message = createBasePaymentGateway_Config();
1176
+ message.key = (_a = object.key) !== null && _a !== void 0 ? _a : "";
1177
+ message.value = (_b = object.value) !== null && _b !== void 0 ? _b : "";
1178
+ return message;
1179
+ },
1180
+ };
359
1181
  function toTimestamp(date) {
360
1182
  const seconds = numberToLong(Math.trunc(date.getTime() / 1000));
361
1183
  const nanos = (date.getTime() % 1000) * 1000000;