@@ -632,6 +632,93 @@ async fn test_get_transaction_info() {
632632 ) ;
633633}
634634
635+ #[ tokio:: test]
636+ async fn test_app_transaction_info ( ) {
637+ let client = app_store_server_api_client_with_body_from_file (
638+ "tests/resources/models/appTransactionInfoResponse.json" ,
639+ StatusCode :: OK ,
640+ Some ( Box :: new ( |req, body| {
641+ assert_eq ! ( & Method :: GET , req. method( ) ) ;
642+ assert_eq ! (
643+ "https://local-testing-base-url/inApps/v1/transactions/appTransactions/1234" ,
644+ req. uri( ) . to_string( )
645+ ) ;
646+ assert ! ( body. is_empty( ) , "GET request should have empty body" ) ;
647+ } ) ) ,
648+ ) ;
649+
650+ let response = client
651+ . app_transaction_info ( "1234" )
652+ . await
653+ . unwrap ( ) ;
654+ assert_eq ! (
655+ "signed_app_transaction_info_value" ,
656+ response
657+ . signed_app_transaction_info
658+ . unwrap( )
659+ ) ;
660+ }
661+
662+ #[ tokio:: test]
663+ async fn test_app_transaction_info_invalid_transaction_id ( ) {
664+ let client = app_store_server_api_client_with_body_from_file (
665+ "tests/resources/models/invalidTransactionIdError.json" ,
666+ StatusCode :: BAD_REQUEST ,
667+ None ,
668+ ) ;
669+
670+ let result = client
671+ . app_transaction_info ( "invalid_id" )
672+ . await ;
673+
674+ assert ! ( result. is_err( ) ) ;
675+ let err = result. unwrap_err ( ) ;
676+ assert_eq ! ( 400 , err. http_status_code) ;
677+ assert_eq ! ( Some ( ApiErrorCode :: InvalidTransactionId ) , err. api_error) ;
678+ assert_eq ! ( Some ( 4000006 ) , err. error_code) ;
679+ assert_eq ! ( Some ( "Invalid transaction id." . to_string( ) ) , err. error_message) ;
680+ }
681+
682+ #[ tokio:: test]
683+ async fn test_app_transaction_info_transaction_id_not_found ( ) {
684+ let client = app_store_server_api_client_with_body_from_file (
685+ "tests/resources/models/transactionIdNotFoundError.json" ,
686+ StatusCode :: NOT_FOUND ,
687+ None ,
688+ ) ;
689+
690+ let result = client
691+ . app_transaction_info ( "not_found_id" )
692+ . await ;
693+
694+ assert ! ( result. is_err( ) ) ;
695+ let err = result. unwrap_err ( ) ;
696+ assert_eq ! ( 404 , err. http_status_code) ;
697+ assert_eq ! ( Some ( ApiErrorCode :: TransactionIdNotFound ) , err. api_error) ;
698+ assert_eq ! ( Some ( 4040010 ) , err. error_code) ;
699+ assert_eq ! ( Some ( "Transaction id not found." . to_string( ) ) , err. error_message) ;
700+ }
701+
702+ #[ tokio:: test]
703+ async fn test_app_transaction_info_app_transaction_does_not_exist ( ) {
704+ let client = app_store_server_api_client_with_body_from_file (
705+ "tests/resources/models/appTransactionDoesNotExistError.json" ,
706+ StatusCode :: NOT_FOUND ,
707+ None ,
708+ ) ;
709+
710+ let result = client
711+ . app_transaction_info ( "no_app_transaction" )
712+ . await ;
713+
714+ assert ! ( result. is_err( ) ) ;
715+ let err = result. unwrap_err ( ) ;
716+ assert_eq ! ( 404 , err. http_status_code) ;
717+ assert_eq ! ( Some ( ApiErrorCode :: AppTransactionDoesNotExist ) , err. api_error) ;
718+ assert_eq ! ( Some ( 4040019 ) , err. error_code) ;
719+ assert_eq ! ( Some ( "No AppTransaction exists for the customer." . to_string( ) ) , err. error_message) ;
720+ }
721+
635722#[ tokio:: test]
636723async fn test_look_up_order_id ( ) {
637724 let client = app_store_server_api_client_with_body_from_file (
0 commit comments