Skip to content

Commit

Permalink
EACQAPW-4510 // Отсутствует инициализатор для AgentData и SupplierInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanglushko committed Apr 13, 2023
1 parent 8266ce1 commit ca0d203
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,30 @@ public struct AgentData: Codable, Equatable {
/// - обязателен если `AgentSign` = `bankPayingSubagent`
var operatorInn: String?

// MARK: Init

public init(
agentSign: AgentSign,
operationName: String? = nil,
phones: [String]? = nil,
receiverPhones: [String]? = nil,
transferPhones: [String]? = nil,
operatorName: String? = nil,
operatorAddress: String? = nil,
operatorInn: String? = nil
) {
self.agentSign = agentSign
self.operationName = operationName
self.phones = phones
self.receiverPhones = receiverPhones
self.transferPhones = transferPhones
self.operatorName = operatorName
self.operatorAddress = operatorAddress
self.operatorInn = operatorInn
}

// MARK: Init from decoder

public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
if let agent = try? container.decode(String.self, forKey: .agentSign) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@ public struct SupplierInfo: Codable, Equatable {
/// ИНН поставщика. Строка длиной от 10 до 12 символов.
var inn: String?

// MARK: Init

public init(
phones: [String]? = nil,
name: String? = nil,
inn: String? = nil
) {
self.phones = phones
self.name = name
self.inn = inn
}

// MARK: Init from decoder

public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
phones = try? container.decode([String].self, forKey: .phones)
Expand Down

0 comments on commit ca0d203

Please sign in to comment.