Skip to content
This repository was archived by the owner on Feb 29, 2024. It is now read-only.

Commit a583838

Browse files
authored
Merge pull request #1773 from KitHat/rc
Fix inner types in libindy
2 parents e61f73f + 4b29c26 commit a583838

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

libindy/src/api/payments_v2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub extern fn indy_build_get_payment_sources_with_from_request(command_handle: C
3636
check_useful_c_str!(payment_address, ErrorCode::CommonInvalidParam4);
3737
check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam5);
3838

39-
let from: Option<u64> = if from == -1 { None } else { Some(from as u64) };
39+
let from: Option<i64> = if from == -1 { None } else { Some(from) };
4040

4141
trace!("indy_build_get_payment_sources_with_from_request: entities >>> wallet_handle: {:?}, submitter_did: {:?}, payment_address: {:?}, from: {:?}", wallet_handle, submitter_did, payment_address, from);
4242

libindy/src/commands/payments.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub enum PaymentsCommand {
5555
WalletHandle,
5656
Option<String>, //submitter did
5757
String, //payment address
58-
Option<u64>, //from
58+
Option<i64>, //from
5959
Box<Fn(IndyResult<(String, String)>) + Send>),
6060
BuildGetPaymentSourcesRequestAck(
6161
i32, //handle
@@ -447,7 +447,7 @@ impl PaymentsCommandExecutor {
447447
trace!("parse_response_with_fees_ack <<<");
448448
}
449449

450-
fn build_get_payment_sources_request(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, payment_address: &str, next: Option<u64>, cb: Box<Fn(IndyResult<(String, String)>) + Send>) {
450+
fn build_get_payment_sources_request(&self, wallet_handle: WalletHandle, submitter_did: Option<&str>, payment_address: &str, next: Option<i64>, cb: Box<Fn(IndyResult<(String, String)>) + Send>) {
451451
trace!("build_get_payment_sources_request >>> wallet_handle: {:?}, submitter_did: {:?}, payment_address: {:?}", wallet_handle, submitter_did, payment_address);
452452
if let Some(did) = submitter_did {
453453
match self.crypto_service.validate_did(did).map_err(map_err_err!()) {

libindy/src/services/payments.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl PaymentsService {
145145
res
146146
}
147147

148-
pub fn build_get_payment_sources_request(&self, cmd_handle: i32, type_: &str, wallet_handle: WalletHandle, submitter_did: Option<&str>, address: &str, next: Option<u64>) -> IndyResult<()> {
148+
pub fn build_get_payment_sources_request(&self, cmd_handle: i32, type_: &str, wallet_handle: WalletHandle, submitter_did: Option<&str>, address: &str, next: Option<i64>) -> IndyResult<()> {
149149
trace!("build_get_payment_sources_request >>> type_: {:?}, wallet_handle: {:?}, submitter_did: {:?}, address: {:?}", type_, wallet_handle, submitter_did, address);
150150
let build_get_payment_sources_request: BuildGetPaymentSourcesRequestCB = self.methods.borrow().get(type_)
151151
.ok_or(err_msg(IndyErrorKind::UnknownPaymentMethodType, format!("Unknown payment method {}", type_)))?.build_get_payment_sources_request;
@@ -158,7 +158,7 @@ impl PaymentsService {
158158
wallet_handle,
159159
submitter_did.as_ref().map(|s| s.as_ptr()).unwrap_or(null()),
160160
address.as_ptr(),
161-
next.map(|a| a as i64).unwrap_or(-1),
161+
next.unwrap_or(-1),
162162
cb);
163163

164164
let res = err.into();

libindy/tests/utils/payments.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ pub fn build_get_payment_sources_request(wallet_handle: i32, submitter_did: Opti
364364
payments::build_get_payment_sources_request(wallet_handle, submitter_did, payment_address).wait()
365365
}
366366

367-
pub fn build_get_payment_sources_with_from_request(wallet_handle: i32, submitter_did: Option<&str>, payment_address: &str, from: Option<u64>) -> Result<(String, String), IndyError> {
367+
pub fn build_get_payment_sources_with_from_request(wallet_handle: i32, submitter_did: Option<&str>, payment_address: &str, from: Option<i64>) -> Result<(String, String), IndyError> {
368368
payments::build_get_payment_sources_with_from_request(wallet_handle, submitter_did, payment_address, from).wait()
369369
}
370370

@@ -381,7 +381,7 @@ pub fn parse_get_payment_sources_response(payment_method: &str, resp_json: &str)
381381
payments::parse_get_payment_sources_response(payment_method, resp_json).wait()
382382
}
383383

384-
pub fn parse_get_payment_sources_with_from_response(payment_method: &str, resp_json: &str) -> Result<(String, Option<u64>), IndyError> {
384+
pub fn parse_get_payment_sources_with_from_response(payment_method: &str, resp_json: &str) -> Result<(String, Option<i64>), IndyError> {
385385
payments::parse_get_payment_sources_with_from_response(payment_method, resp_json).wait()
386386
}
387387

wrappers/rust/src/payments.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ fn _build_get_payment_sources_request(command_handle: CommandHandle, wallet_hand
219219
/// # Returns
220220
/// * `get_utxo_txn_json` - Indy request for getting UTXO list for payment address
221221
/// * `payment_method`
222-
pub fn build_get_payment_sources_with_from_request(wallet_handle: WalletHandle, submitter_did: Option<&str>, payment_address: &str, from: Option<u64>) -> Box<Future<Item=(String, String), Error=IndyError>> {
222+
pub fn build_get_payment_sources_with_from_request(wallet_handle: WalletHandle, submitter_did: Option<&str>, payment_address: &str, from: Option<i64>) -> Box<Future<Item=(String, String), Error=IndyError>> {
223223
let (receiver, command_handle, cb) =
224224
ClosureHandler::cb_ec_string_string();
225225

@@ -228,11 +228,11 @@ pub fn build_get_payment_sources_with_from_request(wallet_handle: WalletHandle,
228228
ResultHandler::str_str(command_handle, err, receiver)
229229
}
230230

231-
fn _build_get_payment_sources_with_from_request(command_handle: CommandHandle, wallet_handle: WalletHandle, submitter_did: Option<&str>, payment_address: &str, from: Option<u64>, cb: Option<ResponseStringStringCB>) -> ErrorCode {
231+
fn _build_get_payment_sources_with_from_request(command_handle: CommandHandle, wallet_handle: WalletHandle, submitter_did: Option<&str>, payment_address: &str, from: Option<i64>, cb: Option<ResponseStringStringCB>) -> ErrorCode {
232232
let submitter_did_str = opt_c_str!(submitter_did);
233233
let payment_address = c_str!(payment_address);
234234

235-
ErrorCode::from(unsafe { payments::indy_build_get_payment_sources_with_from_request(command_handle, wallet_handle, opt_c_ptr!(submitter_did, submitter_did_str), payment_address.as_ptr(), from.map(|a| a as i64).unwrap_or(-1), cb) })
235+
ErrorCode::from(unsafe { payments::indy_build_get_payment_sources_with_from_request(command_handle, wallet_handle, opt_c_ptr!(submitter_did, submitter_did_str), payment_address.as_ptr(), from.unwrap_or(-1), cb) })
236236
}
237237

238238
/// Parses response for Indy request for getting UTXO list.
@@ -283,12 +283,12 @@ fn _parse_get_payment_sources_response(command_handle: CommandHandle, payment_me
283283
/// extra: <str>, // optional data from payment transaction
284284
/// }]
285285
/// next -- pointer to the next slice of payment sources
286-
pub fn parse_get_payment_sources_with_from_response(payment_method: &str, resp_json: &str) -> Box<Future<Item=(String, Option<u64>), Error=IndyError>> {
286+
pub fn parse_get_payment_sources_with_from_response(payment_method: &str, resp_json: &str) -> Box<Future<Item=(String, Option<i64>), Error=IndyError>> {
287287
let (receiver, command_handle, cb) = ClosureHandler::cb_ec_string_i64();
288288

289289
let err = _parse_get_payment_sources_with_from_response(command_handle, payment_method, resp_json, cb);
290290

291-
Box::new(ResultHandler::str_i64(command_handle, err, receiver).map(|(s, i)| (s, if i >= 0 {Some(i as u64)} else {None})).into_future())
291+
Box::new(ResultHandler::str_i64(command_handle, err, receiver).map(|(s, i)| (s, if i >= 0 {Some(i)} else {None})).into_future())
292292
}
293293

294294
fn _parse_get_payment_sources_with_from_response(command_handle: CommandHandle, payment_method: &str, resp_json: &str, cb: Option<ResponseStringI64CB>) -> ErrorCode {

0 commit comments

Comments
 (0)