quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

FTalerWalletcore.m (1437B)


      1 /*
      2  * This file is part of GNU Taler, ©2022-25 Taler Systems S.A.
      3  * See LICENSE.md
      4  */
      5 /**
      6  * @author Marc Stibane
      7  */
      8 #import "FTalerWalletcore.h"
      9 
     10 static void TALER_WALLET_test_handler(void *cls, const char *message)
     11 {
     12     printf("%s\n", message);
     13 }
     14 
     15 struct TALER_WALLET_Instance *
     16 TALER_WALLET_test(int wait)
     17 {
     18     struct TALER_WALLET_Instance *twi = TALER_WALLET_create();
     19 
     20     TALER_WALLET_set_message_handler(twi, &TALER_WALLET_test_handler, NULL);
     21 
     22     TALER_WALLET_run(twi);
     23 
     24     TALER_WALLET_send_request(twi, "{\"operation\": \"init\", \"args\": {\"skipDefaults\": true}}");
     25 
     26     TALER_WALLET_send_request(twi, "{\"operation\": \"getVersion\"}");
     27 
     28     TALER_WALLET_send_request(twi, "{\"operation\": \"runIntegrationTest\", \"args\": {"
     29                               "\"amountToWithdraw\": \"KUDOS:3\", \"amountToSpend\": \"KUDOS:1\", "
     30                               "\"bankBaseUrl\": \"https://bank.demo.taler.net/demobanks/default/access-api/\", "
     31                               "\"exchangeBaseUrl\": \"https://exchange.demo.taler.net/\", "
     32                               "\"merchantBaseUrl\": \"https://backend.demo.taler.net/\", "
     33                               "\"merchantAuthToken\": \"secret-token:sandbox\"}}");
     34     if (wait) {
     35         // Wait for wallet thread to finish.
     36         // If we don't call this, main() exits
     37         // and the wallet thread is killed.
     38         TALER_WALLET_join(twi);
     39     }
     40     return twi;
     41 }