Skip to content

Commit d21b56c

Browse files
committed
Payments API renaming
Signed-off-by: artem.ivanov <[email protected]>
1 parent ff76818 commit d21b56c

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

libindy/src/api/payments.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ pub type BuildGetSourcesRequestCB = extern fn(command_handle: i32,
107107
submitter_did: *const c_char,
108108
payment_address: *const c_char,
109109
cb: Option<extern fn(command_handle_: i32,
110-
err: ErrorCode,
111-
get_sources_txn_json: *const c_char) -> ErrorCode>) -> ErrorCode;
110+
err: ErrorCode,
111+
get_sources_txn_json: *const c_char) -> ErrorCode>) -> ErrorCode;
112112

113113
/// Parses response for Indy request for getting sources list.
114114
///
@@ -468,7 +468,7 @@ pub extern fn indy_list_payment_addresses(command_handle: i32,
468468
///
469469
/// Note this endpoint is EXPERIMENTAL. Function signature and behaviour may change
470470
/// in the future releases.
471-
///
471+
///
472472
/// #Params
473473
/// wallet_handle: wallet handle
474474
/// submitter_did : DID of request sender
@@ -544,7 +544,7 @@ pub extern fn indy_add_request_fees(command_handle: i32,
544544
///
545545
/// Note this endpoint is EXPERIMENTAL. Function signature and behaviour may change
546546
/// in the future releases.
547-
///
547+
///
548548
/// #Returns
549549
/// receipts_json - parsed (payment method and node version agnostic) receipts info as json:
550550
/// [{
@@ -601,13 +601,13 @@ pub extern fn indy_parse_response_with_fees(command_handle: i32,
601601
/// payment_method
602602
#[no_mangle]
603603
pub extern fn indy_build_get_sources_request(command_handle: i32,
604-
wallet_handle: i32,
605-
submitter_did: *const c_char,
606-
payment_address: *const c_char,
607-
cb: Option<extern fn(command_handle_: i32,
608-
err: ErrorCode,
609-
get_sources_txn_json: *const c_char,
610-
payment_method: *const c_char)>) -> ErrorCode {
604+
wallet_handle: i32,
605+
submitter_did: *const c_char,
606+
payment_address: *const c_char,
607+
cb: Option<extern fn(command_handle_: i32,
608+
err: ErrorCode,
609+
get_sources_txn_json: *const c_char,
610+
payment_method: *const c_char)>) -> ErrorCode {
611611
trace!("indy_build_get_sources_request: >>> wallet_handle: {:?}, submitter_did: {:?}, payment_address: {:?}", wallet_handle, submitter_did, payment_address);
612612
check_useful_c_str!(submitter_did, ErrorCode::CommonInvalidParam3);
613613
check_useful_c_str!(payment_address, ErrorCode::CommonInvalidParam4);
@@ -660,8 +660,8 @@ pub extern fn indy_parse_get_sources_response(command_handle: i32,
660660
payment_method: *const c_char,
661661
resp_json: *const c_char,
662662
cb: Option<extern fn(command_handle_: i32,
663-
err: ErrorCode,
664-
sources_json: *const c_char)>) -> ErrorCode {
663+
err: ErrorCode,
664+
sources_json: *const c_char)>) -> ErrorCode {
665665
trace!("indy_parse_get_sources_response: >>> payment_method: {:?}, resp_json: {:?}", payment_method, resp_json);
666666
check_useful_c_str!(payment_method, ErrorCode::CommonInvalidParam2);
667667
check_useful_c_str!(resp_json, ErrorCode::CommonInvalidParam3);

libindy/src/services/payments.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ pub struct PaymentsMethod {
2020
create_address: CreatePaymentAddressCB,
2121
add_request_fees: AddRequestFeesCB,
2222
parse_response_with_fees: ParseResponseWithFeesCB,
23-
build_get_utxo_request: BuildGetSourcesRequestCB,
24-
parse_get_utxo_response: ParseGetSourcesResponseCB,
23+
build_get_utxo_request: BuildGetUTXORequestCB,
24+
parse_get_utxo_response: ParseGetUTXOResponseCB,
2525
build_payment_req: BuildPaymentReqCB,
2626
parse_payment_response: ParsePaymentResponseCB,
2727
build_mint_req: BuildMintReqCB,
@@ -36,8 +36,8 @@ impl PaymentsMethodCBs {
3636
pub fn new(create_address: CreatePaymentAddressCB,
3737
add_request_fees: AddRequestFeesCB,
3838
parse_response_with_fees: ParseResponseWithFeesCB,
39-
build_get_utxo_request: BuildGetSourcesRequestCB,
40-
parse_get_utxo_response: ParseGetSourcesResponseCB,
39+
build_get_utxo_request: BuildGetUTXORequestCB,
40+
parse_get_utxo_response: ParseGetUTXOResponseCB,
4141
build_payment_req: BuildPaymentReqCB,
4242
parse_payment_response: ParsePaymentResponseCB,
4343
build_mint_req: BuildMintReqCB,
@@ -128,7 +128,7 @@ impl PaymentsService {
128128

129129
pub fn build_get_utxo_request(&self, cmd_handle: i32, type_: &str, wallet_handle: i32, submitter_did: &str, address: &str) -> Result<(), PaymentsError> {
130130
trace!("build_get_utxo_request >>> type_: {:?}, wallet_handle: {:?}, submitter_did: {:?}, address: {:?}", type_, wallet_handle, submitter_did, address);
131-
let build_get_utxo_request: BuildGetSourcesRequestCB = self.methods.borrow().get(type_)
131+
let build_get_utxo_request: BuildGetUTXORequestCB = self.methods.borrow().get(type_)
132132
.ok_or(PaymentsError::UnknownType(format!("Unknown payment method {}", type_)))?.build_get_utxo_request;
133133

134134
let submitter_did = CString::new(submitter_did)?;
@@ -145,7 +145,7 @@ impl PaymentsService {
145145

146146
pub fn parse_get_utxo_response(&self, cmd_handle: i32, type_: &str, response: &str) -> Result<(), PaymentsError> {
147147
trace!("parse_get_utxo_response >>> type_: {:?}, response: {:?}", type_, response);
148-
let parse_get_utxo_response: ParseGetSourcesResponseCB = self.methods.borrow().get(type_)
148+
let parse_get_utxo_response: ParseGetUTXOResponseCB = self.methods.borrow().get(type_)
149149
.ok_or(PaymentsError::UnknownType(format!("Unknown payment method {}", type_)))?.parse_get_utxo_response;
150150

151151
let response = CString::new(response)?;

libindy/tests/utils/payments.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ pub fn register_payment_method(payment_method_name: &str,
141141
create_payment_address: Option<CreatePaymentAddressCB>,
142142
add_request_fees: Option<AddRequestFeesCB>,
143143
parse_response_with_fees: Option<ParseResponseWithFeesCB>,
144-
build_get_utxo_request: Option<BuildGetSourcesRequestCB>,
145-
parse_get_utxo_response: Option<ParseGetSourcesResponseCB>,
144+
build_get_utxo_request: Option<BuildGetUTXORequestCB>,
145+
parse_get_utxo_response: Option<ParseGetUTXOResponseCB>,
146146
build_payment_req: Option<BuildPaymentReqCB>,
147147
parse_payment_response: Option<ParsePaymentResponseCB>,
148148
build_mint_req: Option<BuildMintReqCB>,
@@ -277,10 +277,10 @@ pub fn parse_get_utxo_response(payment_method: &str, resp_json: &str) -> Result<
277277
let payment_method = CString::new(payment_method).unwrap();
278278
let resp_json = CString::new(resp_json).unwrap();
279279

280-
let err = indy_parse_get_sources_response(cmd_handle,
281-
payment_method.as_ptr(),
282-
resp_json.as_ptr(),
283-
cb);
280+
let err = indy_parse_get_utxo_response(cmd_handle,
281+
payment_method.as_ptr(),
282+
resp_json.as_ptr(),
283+
cb);
284284

285285
super::results::result_to_string(err, receiver)
286286
}

0 commit comments

Comments
 (0)