Sha256: bc3b0b1d254d0b51c55533a6b801dd9cb2a9e5d77b21ce88393b7ad8d517479d

Contents?: true

Size: 1.01 KB

Versions: 6

Compression:

Stored size: 1.01 KB

Contents

module JoyUssdEngine
    class HubtelTransformer < JoyUssdEngine::DataTransformer
        # Tranforms request and response payload between hubtel and our application
        def request_params(params)
            {
                session_id: params[:Mobile],
                message: params[:Message],
                Mobile: params[:Mobile],
                ClientState: params[:ClientState],
                Type: params[:Type],
                data: params
            }
        end

        def app_terminator(params)
            params[:Type] == 'Release' || (params[:Type] != "Initiation" && @context.get_state.blank?)
        end

        def response(message, client_state)
            {
                Type: "Response",
                Message: message,
                ClientState: client_state
            }
        end
    
        def release(message)
            {
                Type: "Release",
                Message: message,
                ClientState: "EndJoyUssdEngine"
            }
        end
    end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
joy_ussd_engine-0.1.11 lib/joy_ussd_engine/hubtel_transformer.rb
joy_ussd_engine-0.1.10 lib/joy_ussd_engine/hubtel_transformer.rb
joy_ussd_engine-0.1.9 lib/joy_ussd_engine/hubtel_transformer.rb
joy_ussd_engine-0.1.8 lib/joy_ussd_engine/hubtel_transformer.rb
joy_ussd_engine-0.1.7 lib/joy_ussd_engine/hubtel_transformer.rb
joy_ussd_engine-0.1.6 lib/joy_ussd_engine/hubtel_transformer.rb