update_member is changed
This commit is contained in:
parent
f8dcce0eba
commit
3c9ba78a06
|
@ -324,10 +324,10 @@ impl Service<'_> {
|
||||||
if let Some(a) = request.bank_account {
|
if let Some(a) = request.bank_account {
|
||||||
let bank_id = uuid::Uuid::from_str(a.bank_id.as_str()).map_err(|e| {
|
let bank_id = uuid::Uuid::from_str(a.bank_id.as_str()).map_err(|e| {
|
||||||
bcr::error::rpc::Error::InvalidParams(bcr::error::rpc::InvalidParams {
|
bcr::error::rpc::Error::InvalidParams(bcr::error::rpc::InvalidParams {
|
||||||
message: "invalid bank_id param".to_string(),
|
message: "invalid bank_account.bank_id param".to_string(),
|
||||||
detail: bcr::error::rpc::InvalidParamsDetail {
|
detail: bcr::error::rpc::InvalidParamsDetail {
|
||||||
location: "request".to_string(),
|
location: "request".to_string(),
|
||||||
param: "bank_id".to_string(),
|
param: "bank_account.bank_id".to_string(),
|
||||||
value: a.bank_id.clone(),
|
value: a.bank_id.clone(),
|
||||||
error_type: bcr::error::rpc::InvalidParamsType::Required,
|
error_type: bcr::error::rpc::InvalidParamsType::Required,
|
||||||
message: e.to_string(),
|
message: e.to_string(),
|
||||||
|
@ -335,13 +335,41 @@ impl Service<'_> {
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
if a.exchange_password.trim().eq("") {
|
||||||
|
return Err(bcr::error::rpc::Error::InvalidParams(
|
||||||
|
bcr::error::rpc::InvalidParams {
|
||||||
|
message: "invalid bank_account.exchange_password param".to_string(),
|
||||||
|
detail: bcr::error::rpc::InvalidParamsDetail {
|
||||||
|
location: "request".to_string(),
|
||||||
|
param: "bank_account.exchange_password".to_string(),
|
||||||
|
value: a.exchange_password,
|
||||||
|
error_type: bcr::error::rpc::InvalidParamsType::Required,
|
||||||
|
message: "bank_account.exchange_password is required".to_string(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
let exchange_password_hash = argon2::hash_encoded(
|
||||||
|
a.exchange_password.as_bytes(),
|
||||||
|
self.password_salt.as_bytes(),
|
||||||
|
&self.argon2_config,
|
||||||
|
)
|
||||||
|
.map_err(|e| {
|
||||||
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
|
message: format!("server {}", e),
|
||||||
|
data: None,
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
|
||||||
let new_member_bank_account =
|
let new_member_bank_account =
|
||||||
repositories::member_bank_account::models::NewMemberBankAccount {
|
repositories::member_bank_account::models::NewMemberBankAccount {
|
||||||
member_id: m.id,
|
member_id: m.id,
|
||||||
bank_id,
|
bank_id,
|
||||||
name: a.name,
|
name: a.name,
|
||||||
account_number: a.account_number,
|
account_number: a.account_number,
|
||||||
exchange_password: a.exchange_password,
|
exchange_password: exchange_password_hash,
|
||||||
memo: None,
|
memo: None,
|
||||||
};
|
};
|
||||||
self
|
self
|
||||||
|
@ -1069,12 +1097,25 @@ impl Service<'_> {
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
let exchange_password_hash = argon2::hash_encoded(
|
||||||
|
a.exchange_password.as_bytes(),
|
||||||
|
self.password_salt.as_bytes(),
|
||||||
|
&self.argon2_config,
|
||||||
|
)
|
||||||
|
.map_err(|e| {
|
||||||
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
|
message: format!("server {}", e),
|
||||||
|
data: None,
|
||||||
|
})
|
||||||
|
})?;
|
||||||
|
|
||||||
let modify_member_bank_account =
|
let modify_member_bank_account =
|
||||||
repositories::member_bank_account::models::ModifyMemberBankAccount {
|
repositories::member_bank_account::models::ModifyMemberBankAccount {
|
||||||
bank_id,
|
bank_id,
|
||||||
name: a.name,
|
name: a.name,
|
||||||
account_number: a.account_number,
|
account_number: a.account_number,
|
||||||
exchange_password: a.exchange_password,
|
exchange_password: exchange_password_hash,
|
||||||
memo: None,
|
memo: None,
|
||||||
};
|
};
|
||||||
self
|
self
|
||||||
|
|
Loading…
Reference in New Issue
Block a user