Sha256: 2662ba79fc19073eb3e19881fe3e3193dd75f12ccfae2ad565c1f3f08c7213f8

Contents?: true

Size: 993 Bytes

Versions: 1

Compression:

Stored size: 993 Bytes

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],
                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

1 entries across 1 versions & 1 rubygems

Version Path
joy_ussd_engine-0.1.5 lib/joy_ussd_engine/hubtel_transformer.rb