Package org.gsm.oneapi.endpoints

Examples of org.gsm.oneapi.endpoints.ServiceEndpoints


  public static void main(String[] args) {
    BasicConfigurator.configure();
   
    dumpRequestAndResponse=true;

    ServiceEndpoints serviceEndpoints=CommandLineOptions.getServiceEndpoints(args);
   
    String username=CommandLineOptions.getUsername(args);
    String password=CommandLineOptions.getPassword(args);

    if (username==null) username="Fred.Jones";
    if (password==null) password="1234";   
    if (serviceEndpoints==null) serviceEndpoints=new ServiceEndpoints();

    logger.debug("Demonstration of outbound SMS API");
   
    logger.debug("SMS send endpoint="+serviceEndpoints.getSendSMSEndpoint());
   
    String authorisationHeader=JSONRequest.getAuthorisationHeader(username, password);
   
    SMSSend me=new SMSSend(serviceEndpoints, authorisationHeader);
   
    String[] sendTo={"tel:123", "tel:124", "tel:125", "tel126"};
    String notifyURL="http://test.com/notifyThis/Message="+JSONRequest.urlEncode("This is encoded");
    SMSSendResponse sendResponse=me.sendSMS("tel:9876", sendTo, "welcome to the GSMA One API demonstration.", "ref12345", notifyURL, "ACME Inc.", "some-data-useful-to-the-requester");
       
    if (sendResponse!=null) {
      logger.debug("Have SMS send response:\n"+sendResponse.toString());
    } else {
      logger.debug("No response obtained");
    }
   
    logger.debug("Query delivery status using endpoint="+serviceEndpoints.getQuerySMSDeliveryEndpoint());
   
    SMSSendDeliveryStatusResponse deliveryStatus=me.queryDeliveryStatus("tel:987654", "ref2781398");
    if (deliveryStatus!=null) {
      logger.debug("SMSSendDeliveryStatusResponse="+deliveryStatus.toString());
    } else {
      logger.debug("No response obtained");
    }
   
    logger.debug("Register a delivery report receipt notification endpoint="+serviceEndpoints.getSMSDeliverySubscriptionsEndpoint());
   
    SMSDeliveryReceiptSubscriptionResponse deliveryReceiptSubcription=me.subscribeToDeliveryNotifications("tel:12345", "ref12345", notifyURL, "subscription1");
    if (deliveryReceiptSubcription!=null) {
      logger.debug("SMSDeliveryReceiptSubscriptionResponse="+deliveryReceiptSubcription.toString());
    } else {
      logger.debug("No response obtained");
    }

    logger.debug("Cancel delivery receipt notification endpoint="+serviceEndpoints.getCancelSMSDeliverySubscriptionEndpoint());
   
    int cancelSubscriptionResponse=me.cancelDeliveryNotifications("sub789");
    logger.debug("Cancel subscription response code="+cancelSubscriptionResponse);

  }
View Full Code Here


  public static void main(String[] args) {
    BasicConfigurator.configure();
   
    dumpRequestAndResponse=true;
   
    ServiceEndpoints serviceEndpoints=CommandLineOptions.getServiceEndpoints(args);
   
    String username=CommandLineOptions.getUsername(args);
    String password=CommandLineOptions.getPassword(args);

    if (username==null) username="Fred.Jones";
    if (password==null) password="1234";   
    if (serviceEndpoints==null) serviceEndpoints=new ServiceEndpoints();

    logger.debug("Demonstration of inbound SMS API");
   
    String authorisationHeader=JSONRequest.getAuthorisationHeader(username, password);
   
    SMSRetrieve me=new SMSRetrieve(serviceEndpoints, authorisationHeader);
   
    logger.debug("SMS receive endpoint="+serviceEndpoints.getRetrieveSMSEndpoint());   
    RetrieveSMSResponse retrieveResponse=me.retrieveMessages("3456", 2);       
    if (retrieveResponse!=null) {
      logger.debug("Have SMS retrieve response:\n"+retrieveResponse.toString());
    } else {
      logger.debug("No response obtained");
    }

    String notifyURL="http://test.com/notifyThis/Message="+JSONRequest.urlEncode("This is encoded");

    logger.debug("Register a message receipt notification endpoint="+serviceEndpoints.getSMSReceiptSubscriptionsEndpoint());

    SMSMessageReceiptSubscriptionResponse receiptSubscription=me.subscribeToReceiptNotifications("3456", notifyURL, "Vote%", "JSON", "12345", "doSomething()");
    if (receiptSubscription!=null) {
      logger.debug("SMSMessageReceiptSubscriptionResponse="+receiptSubscription.toString());
    } else {
      logger.debug("No response obtained");
    }

    logger.debug("Cancel message receipt notification endpoint="+serviceEndpoints.getCancelSMSReceiptSubscriptionEndpoint());
   
    int cancelSubscriptionResponse=me.cancelReceiptNotifications("sub789");
    logger.debug("Cancel receipt subscription response code="+cancelSubscriptionResponse);

View Full Code Here

  }

  public static void main(String[] args) {
    BasicConfigurator.configure();
   
    ServiceEndpoints serviceEndpoints=CommandLineOptions.getServiceEndpoints(args);
   
    String username=CommandLineOptions.getUsername(args);
    String password=CommandLineOptions.getPassword(args);

    if (username==null) username="Fred.Jones";
    if (password==null) password="1234";   
    if (serviceEndpoints==null) serviceEndpoints=new ServiceEndpoints();

    dumpRequestAndResponse=true;
   
    logger.debug("Demonstration of Payment API charging calls");
   
    logger.debug("Charging endpoint="+serviceEndpoints.getAmountChargeEndpoint());
   
    String authorisationHeader=JSONRequest.getAuthorisationHeader(username, password);
   
    Charge me=new Charge(serviceEndpoints, authorisationHeader);
   
    PaymentResponse chargeResponse=me.charge("tel:1234567890", "REF-12345", "Space Invaders", "USD", 2.5, "C100", "http://notaurl.com", "54321", "Amazing Apps", "Game", "Wap", 0.0, "SID1234", "PID8976");
       
    if (chargeResponse!=null) {
      logger.debug("Charge response:\n"+chargeResponse.toString());
    } else {
      logger.debug("No response obtained");
    }

    logger.debug("Refund endpoint="+serviceEndpoints.getAmountRefundEndpoint());
    PaymentResponse refundResponse=me.refund("tel:1234567890", "REF-12345", "Space Invaders", "USD", 2.5, "C100", "54321", "ABC-123", "Amazing Apps", "Game", "Wap", 0.0, "SID1234", "PID8976");
   
    if (refundResponse!=null) {
      logger.debug("Refund response:\n"+refundResponse.toString());
    } else {
View Full Code Here

  /**
   * Get a classname for service endpoints, expected to be the argument following '-e', '-end' or '-endpoints'
   */
  public static ServiceEndpoints getServiceEndpoints(String[] args) {
    ServiceEndpoints endpoints=null;
    if (args!=null && args.length>0) {
      boolean found=false;
      for (int i=0; i<args.length-1 && !found; i++) {
        if (args[i]!=null && (args[i].equals("-e") || args[i].equals("-end") || args[i].equals("-endpoints"))) {
          String endpointClass = args[i+1];
View Full Code Here

    return response;
  }

  public static void main(String[] args) {
    BasicConfigurator.configure();
    ServiceEndpoints serviceEndpoints=CommandLineOptions.getServiceEndpoints(args);
   
    String username=CommandLineOptions.getUsername(args);
    String password=CommandLineOptions.getPassword(args);

    if (username==null) username="Fred.Jones";
    if (password==null) password="1234";   
    if (serviceEndpoints==null) serviceEndpoints=new ServiceEndpoints();
       
    logger.debug("Location endpoint="+serviceEndpoints.getLocationEndpoint());
   
    String authorisationHeader=JSONRequest.getAuthorisationHeader(username, password);
   
    logger.debug("AuthorisationHeader="+authorisationHeader);
   
View Full Code Here

  public static void main(String[] args) {
    BasicConfigurator.configure();
    dumpRequestAndResponse=true;

    ServiceEndpoints serviceEndpoints=CommandLineOptions.getServiceEndpoints(args);
   
    String username=CommandLineOptions.getUsername(args);
    String password=CommandLineOptions.getPassword(args);

    if (username==null) username="Fred.Jones";
    if (password==null) password="1234";   
    if (serviceEndpoints==null) serviceEndpoints=new ServiceEndpoints();

    logger.debug("Reservation endpoint="+serviceEndpoints.getAmountReserveEndpoint());
   
    String authorisationHeader=JSONRequest.getAuthorisationHeader(username, password);   
   
    logger.debug("AuthorisationHeader="+authorisationHeader);
   
    Reservation me=new Reservation(serviceEndpoints, authorisationHeader);
   
    PaymentResponse reserveInitialResponse=me.reserveInitialAmount("tel:1234567890", "REF-12345", "The Big Fight", "USD"3.0, "C258", "CORR-0001", "Jupiter TV", "Video", "Wap", 0.0, "JUP-1", "JUP-001234");
           
    if (reserveInitialResponse!=null) {
      logger.debug("Reserve initial response:\n"+reserveInitialResponse.toString());
    } else {
      logger.debug("No response obtained");
    }

    int sequenceNumber=2;
   
    logger.debug("Reserve additional endpoint="+serviceEndpoints.getAmountReserveAdditionalEndpoint());

    PaymentResponse reserveAdditionalResponse=me.reserveAdditionalAmount("tel:1234567890", "REF-12345", "The Big Fight", "USD"1.5, sequenceNumber++, "C258");
   
    if (reserveAdditionalResponse!=null) {
      logger.debug("Reserve additional response:\n"+reserveAdditionalResponse.toString());
    } else {
      logger.debug("No response obtained");
    }

    logger.debug("Reservation charge endpoint="+serviceEndpoints.getAmountReservationChargeEndpoint());

    PaymentResponse chargeResponse=me.chargeAmount("tel:1234567890", "REF-12345", "The Big Fight", "USD"3.0, sequenceNumber++, "C528", "http://notaurl.com", "CORR-0001", "Jupiter TV", "Video", "Wap", 0.0, "JUP-1", "JUP-001234");
   
    if (reserveInitialResponse!=null) {
      logger.debug("Reservation charge response:\n"+chargeResponse.toString());
    } else {
      logger.debug("No response obtained");
    }

    logger.debug("Reservation release endpoint="+serviceEndpoints.getAmountReservationReleaseEndpoint());

    PaymentResponse releaseResponse=me.releaseReservation("tel:1234567890", "REF-12345", sequenceNumber);
   
    if (releaseResponse!=null) {
      logger.debug("Reservation response:\n"+releaseResponse.toString());
View Full Code Here

TOP

Related Classes of org.gsm.oneapi.endpoints.ServiceEndpoints

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.