7
7
8
8
namespace MobileConfiguration . Factories ;
9
9
10
- public static class Factory
11
- {
10
+ public static class Factory {
12
11
public static Models . MobileConfiguration ToMobileConfiguration ( Configuration configuration ) {
13
- Models . MobileConfiguration configurationModel = new ( )
14
- {
12
+ Models . MobileConfiguration configurationModel = new ( ) {
15
13
ClientId = configuration . ClientId ,
16
14
ClientSecret = configuration . ClientSecret ,
17
15
ConfigurationType = ConfigurationType . TransactionMobile ,
@@ -21,12 +19,10 @@ public static Models.MobileConfiguration ToMobileConfiguration(Configuration con
21
19
HostAddresses = new List < Models . HostAddress > ( )
22
20
} ;
23
21
24
- foreach ( HostAddress configurationHostAddress in configuration . HostAddresses )
25
- {
26
- Models . HostAddress hostAddressModel = new ( )
27
- {
28
- Uri = configurationHostAddress . Uri , ServiceType = configurationHostAddress . ServiceType switch
29
- {
22
+ foreach ( HostAddress configurationHostAddress in configuration . HostAddresses ) {
23
+ Models . HostAddress hostAddressModel = new ( ) {
24
+ Uri = configurationHostAddress . Uri ,
25
+ ServiceType = configurationHostAddress . ServiceType switch {
30
26
ServiceType . EstateManagement => Models . ServiceType . EstateManagement ,
31
27
ServiceType . TransactionProcessorAcl => Models . ServiceType . TransactionProcessorAcl ,
32
28
ServiceType . VoucherManagementAcl => Models . ServiceType . VoucherManagementAcl ,
@@ -37,8 +33,7 @@ public static Models.MobileConfiguration ToMobileConfiguration(Configuration con
37
33
configurationModel . HostAddresses . Add ( hostAddressModel ) ;
38
34
}
39
35
40
- configurationModel . LogLevel = configuration . LogLevel switch
41
- {
36
+ configurationModel . LogLevel = configuration . LogLevel switch {
42
37
LoggingLevel . Debug => Models . LoggingLevel . Debug ,
43
38
LoggingLevel . Error => Models . LoggingLevel . Error ,
44
39
LoggingLevel . Fatal => Models . LoggingLevel . Fatal ,
@@ -52,59 +47,50 @@ public static Models.MobileConfiguration ToMobileConfiguration(Configuration con
52
47
}
53
48
54
49
public static Database . Entities . Configuration ToEntityConfiguration ( Models . MobileConfiguration configurationModel ) {
55
- Database . Entities . Configuration configurationEntity = new ( )
56
- {
50
+ Database . Entities . Configuration configurationEntity = new ( ) {
57
51
Id = configurationModel . Id ,
58
52
ConfigType = ( Int32 ) ConfigurationType . TransactionMobile ,
59
- ClientId = configurationModel . ClientId ,
60
- ClientSecret = configurationModel . ClientSecret ,
61
- DeviceIdentifier = configurationModel . DeviceIdentifier ,
62
- EnableAutoUpdates = configurationModel . EnableAutoUpdates ,
63
- LogLevelId = ( Int32 ) configurationModel . LogLevel ,
64
- HostAddresses = JsonConvert . SerializeObject ( configurationModel . HostAddresses )
65
- } ;
66
-
67
- return configurationEntity ;
68
- }
69
-
70
- public static ConfigurationResponse ToConfigurationResponse ( Models . MobileConfiguration configurationModel ) {
71
- ConfigurationResponse response = new ConfigurationResponse
72
- {
73
- HostAddresses = new List < HostAddress > ( ) ,
74
- Id = configurationModel . Id ,
75
- ClientSecret = configurationModel . ClientSecret ,
76
- DeviceIdentifier = configurationModel . DeviceIdentifier ,
77
- EnableAutoUpdates = configurationModel . EnableAutoUpdates ,
78
- ClientId = configurationModel . ClientId ,
79
- } ;
53
+ ClientId = configurationModel . ClientId ,
54
+ ClientSecret = configurationModel . ClientSecret ,
55
+ DeviceIdentifier = configurationModel . DeviceIdentifier ,
56
+ EnableAutoUpdates = configurationModel . EnableAutoUpdates ,
57
+ LogLevelId = ( Int32 ) configurationModel . LogLevel ,
58
+ HostAddresses = JsonConvert . SerializeObject ( configurationModel . HostAddresses )
59
+ } ;
80
60
81
- foreach ( Models . HostAddress configurationHostAddress in configurationModel . HostAddresses )
82
- {
83
- HostAddress hostAddress = new HostAddress
84
- {
85
- Uri = configurationHostAddress . Uri ,
86
- } ;
87
- hostAddress . ServiceType = configurationHostAddress . ServiceType switch
88
- {
89
- Models . ServiceType . TransactionProcessorAcl => ServiceType . TransactionProcessorAcl ,
90
- _ => ServiceType . Security
91
- } ;
61
+ return configurationEntity ;
62
+ }
92
63
93
- response . HostAddresses . Add ( hostAddress ) ;
94
- }
64
+ public static ConfigurationResponse ToConfigurationResponse ( Models . MobileConfiguration configurationModel ) {
65
+ ConfigurationResponse response = new ConfigurationResponse {
66
+ HostAddresses = new List < HostAddress > ( ) ,
67
+ Id = configurationModel . Id ,
68
+ ClientSecret = configurationModel . ClientSecret ,
69
+ DeviceIdentifier = configurationModel . DeviceIdentifier ,
70
+ EnableAutoUpdates = configurationModel . EnableAutoUpdates ,
71
+ ClientId = configurationModel . ClientId ,
72
+ } ;
95
73
96
- response . LogLevel = configurationModel . LogLevel switch
97
- {
98
- Models . LoggingLevel . Debug => LoggingLevel . Debug ,
99
- Models . LoggingLevel . Error => LoggingLevel . Error ,
100
- Models . LoggingLevel . Fatal => LoggingLevel . Fatal ,
101
- Models . LoggingLevel . Information => LoggingLevel . Information ,
102
- Models . LoggingLevel . Trace => LoggingLevel . Trace ,
103
- Models . LoggingLevel . Warning => LoggingLevel . Warning ,
104
- _ => LoggingLevel . Information
74
+ foreach ( Models . HostAddress configurationHostAddress in configurationModel . HostAddresses ) {
75
+ HostAddress hostAddress = new HostAddress { Uri = configurationHostAddress . Uri , } ;
76
+ hostAddress . ServiceType = configurationHostAddress . ServiceType switch {
77
+ Models . ServiceType . TransactionProcessorAcl => ServiceType . TransactionProcessorAcl ,
78
+ _ => ServiceType . Security
105
79
} ;
106
80
107
- return response ;
81
+ response . HostAddresses . Add ( hostAddress ) ;
108
82
}
83
+
84
+ response . LogLevel = configurationModel . LogLevel switch {
85
+ Models . LoggingLevel . Debug => LoggingLevel . Debug ,
86
+ Models . LoggingLevel . Error => LoggingLevel . Error ,
87
+ Models . LoggingLevel . Fatal => LoggingLevel . Fatal ,
88
+ Models . LoggingLevel . Information => LoggingLevel . Information ,
89
+ Models . LoggingLevel . Trace => LoggingLevel . Trace ,
90
+ Models . LoggingLevel . Warning => LoggingLevel . Warning ,
91
+ _ => LoggingLevel . Information
92
+ } ;
93
+
94
+ return response ;
109
95
}
110
- }
96
+ }
0 commit comments