Skip to content

Commit

Permalink
Application issue fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pokhrelashok committed Oct 28, 2024
1 parent 3d49552 commit 976714e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
13 changes: 7 additions & 6 deletions meroshare/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,11 @@ const PORTFOLIO_URL: &str = "https://webbackend.cdsc.com.np/api/meroShareView/";
const MERO_SHARE_URL: &str = "https://webbackend.cdsc.com.np/api/meroShare/";

pub struct Meroshare {
capitals: Mutex<Vec<Capital>>,
tokens: Mutex<HashMap<String, String>>,
}
impl Meroshare {
pub fn new() -> Meroshare {
Meroshare {
capitals: Mutex::new(vec![]),
tokens: Mutex::new(HashMap::new()),
}
}
Expand Down Expand Up @@ -156,8 +154,9 @@ impl Meroshare {
let result = make_request(&url, Method::GET, None, Some(headers)).await;
match result {
Ok(value) => {
let banks: BankDetails = value.json().await?;
Ok(banks)
let banks: Vec<BankDetails> = value.json().await?;
let bank = banks.into_iter().nth(0).unwrap();
Ok(bank)
}
Err(error) => Err(error),
}
Expand Down Expand Up @@ -350,9 +349,9 @@ impl Meroshare {
let user_details = self.get_user_details(user).await.unwrap();
let url = MERO_SHARE_URL.to_string()
+ if is_reapply {
"applicantForm/share/reapply/"
"applicantForm/share/reapply"
} else {
"applicantForm/share/apply/"
"applicantForm/share/apply"
};
let body = json!({
"accountBranchId":bank_details.account_branch_id,
Expand All @@ -365,7 +364,9 @@ impl Meroshare {
"customerId":bank_details.id,
"demat":user_details.demat,
"transactionPIN":user.pin,
"accountTypeId":bank_details.account_type_id,
});

let result = make_request(&url, Method::POST, Some(body), Some(headers)).await;
match result {
Ok(value) => match value.json::<IPOAppliedResult>().await {
Expand Down
6 changes: 2 additions & 4 deletions meroshare/src/models/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ pub struct BankDetails {
pub account_branch_id: u32,
#[serde(rename = "accountNumber")]
pub account_number: String,
#[serde(rename = "bankId")]
pub bank_id: u32,
#[serde(rename = "branchID")]
pub branch_id: u32,
#[serde(rename = "accountTypeId")]
pub account_type_id: u32,
#[serde(rename = "branchName")]
pub branch_name: String,
pub id: u32,
Expand Down

0 comments on commit 976714e

Please sign in to comment.