Announcement

Collapse
No announcement yet.

An incoming MvCall

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    An incoming MvCall

    So, I think is kind of the reverse, and I'm not sure how to capture incoming data, since I know hardly anything.

    From the info I currently have (questions not answered yet by the service at the endpoint) the incoming payload is likely JSON. But, I'm not sure of that yet. The custom module will make a call with a REST API function where the request is a JSON string that has a return-callback URL element for error reporting presumably different from the starting point (the Miva admin, or a scheduled task). So, the return information doesn't appear to be available in the s.callvalue. This means I need to parse that information in the callback URL endpoint.

    I don't recall having this scenario come up before. So, if I don't know what's coming, how do I capture that? I don't if there will be a URI to parse. Could "how" o "what" be included in an HTTP Header, such as the content is JSON, and how would deal with responding to this?

    Thanks,

    Scott


    Need to offer Shipping Insurance?
    Interactive Design Solutions https://www.myids.net
    MivaMerchant Business Partner | Certified MivaMerchant Web Developer
    Competitive Rates, Custom Modules and Integrations, Store Integration
    AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
    My T-shirt Collection is mostly MivaCon T-shirts!!

    #2
    If the returning call back url can be specified, you can set it to :thisdomain.com/talk-to-momma.html?myStuff=notyours

    and just monitor a system action for (or even logging i suppose) for g.myStuff

    ???
    Bruce Golub
    Phosphor Media - "Your Success is our Business"

    Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
    phosphormedia.com

    Comment


      #3
      You could implement the system API feature and then use the "SystemModule_Screen" to intercept the callback. You would set your callback to <your_domain>/merchant.mvc?Screen=MY_CUSTOM_SCREEN and then have that API function handle that screen code. The posted data will be in the s.content_data variable, but if the service sending the data sets the content-type to application/json, then s.json_data will be populated and already contain the data in a structure / array.
      David Carver
      Miva, Inc. | Software Developer

      Comment


        #4
        You could also implement the JSON feature and have your callback URL point to your JSON function that would do the same thing as mentioned above.
        David Carver
        Miva, Inc. | Software Developer

        Comment


          #5
          Thanks David.

          "Implement the JSON feature?" Not sure of the context. Is this the module feature?

          In your first response though, seem simple, MY_CUSTOM_SCREEN doesn't need to be an existing template page because the custom module needs to have a System module feature and the "SystemModule_Screen" function intercepts the SCREEN CGI variable? And, I don't actually need to parse the HTTP header because Empressa/merchant.mvc is doing this work?

          Scott
          Need to offer Shipping Insurance?
          Interactive Design Solutions https://www.myids.net
          MivaMerchant Business Partner | Certified MivaMerchant Web Developer
          Competitive Rates, Custom Modules and Integrations, Store Integration
          AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
          My T-shirt Collection is mostly MivaCon T-shirts!!

          Comment


            #6
            Pretty much. https://www.miva.com/apiguide lists all API functions. You'll be passed the screen code so you know whether to handle it or not. And as always the headers will be available to you through the system variables.
            David Carver
            Miva, Inc. | Software Developer

            Comment


              #7
              To monitor a reply - like a webhook or a json payload use this:
              <MvAssign name="l.ok" value="{ miva_json_decode(s.content_data, respOut) }">
              William Gilligan - Orange Marmalade, Inc.
              www.OrangeMarmaladeinc.com

              Comment

              Working...
              X