From d0a5ab4829ad09e1a51b47e37440c3eeae68413a Mon Sep 17 00:00:00 2001 From: Kristin Merbach Date: Tue, 14 Sep 2021 16:23:05 -0400 Subject: [PATCH 1/2] aces transfers --- .../aces/encode_account_transfer_request.rb | 13 +++++++------ .../aces/submit_account_transfer_payload.rb | 3 ++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/operations/aces/encode_account_transfer_request.rb b/app/operations/aces/encode_account_transfer_request.rb index bf9d58b4..c0d9b6ed 100644 --- a/app/operations/aces/encode_account_transfer_request.rb +++ b/app/operations/aces/encode_account_transfer_request.rb @@ -13,7 +13,8 @@ class EncodeAccountTransferRequest # @param [Aces::AccountTransferRequest] request # @return [Dry::Result] def call(request) - encode_soap_envelope(request) + envelope = encode_soap_envelope(request) + encode_soap_body(envelope, request) end protected @@ -42,17 +43,17 @@ def encode_soap_header(xml, request) end end - def encode_soap_body(xml, request) - xml[:soap].Body do |header| - header << request.raw_body - end + def encode_soap_body(built, request) + str = "<\/soap:Header>" + pos = built.value!.index(str) + puts built.value!.insert(pos + str.size, "#{request.raw_body}<\/soap:Body>") + Success(built.value!.insert(pos + str.size, "#{request.raw_body}<\/soap:Body>")) end def encode_soap_envelope(request) builder = Nokogiri::XML::Builder.new do |xml| xml[:soap].Envelope({ "xmlns:soap" => "http://www.w3.org/2003/05/soap-envelope" }) do |envelope| encode_soap_header(envelope, request) - encode_soap_body(envelope, request) end end Success(builder.to_xml) diff --git a/app/operations/aces/submit_account_transfer_payload.rb b/app/operations/aces/submit_account_transfer_payload.rb index 637549cd..491a799b 100644 --- a/app/operations/aces/submit_account_transfer_payload.rb +++ b/app/operations/aces/submit_account_transfer_payload.rb @@ -26,10 +26,11 @@ def read_endpoint_setting end def submit_request(service_uri, payload) + clean_payload = payload.to_s.gsub("", "").gsub("", "") result = Try do Faraday.post( service_uri, - payload, + clean_payload, "Content-Type" => "application/soap+xml" ) end From 9e7d1dd60ac9a85cec18c16c1fae87186d041f6c Mon Sep 17 00:00:00 2001 From: Kristin Merbach Date: Tue, 14 Sep 2021 16:29:31 -0400 Subject: [PATCH 2/2] aces_encoding --- app/operations/aces/encode_account_transfer_request.rb | 1 - app/operations/transfers/to_aces.rb | 1 - 2 files changed, 2 deletions(-) diff --git a/app/operations/aces/encode_account_transfer_request.rb b/app/operations/aces/encode_account_transfer_request.rb index c0d9b6ed..6ec215f4 100644 --- a/app/operations/aces/encode_account_transfer_request.rb +++ b/app/operations/aces/encode_account_transfer_request.rb @@ -46,7 +46,6 @@ def encode_soap_header(xml, request) def encode_soap_body(built, request) str = "<\/soap:Header>" pos = built.value!.index(str) - puts built.value!.insert(pos + str.size, "#{request.raw_body}<\/soap:Body>") Success(built.value!.insert(pos + str.size, "#{request.raw_body}<\/soap:Body>")) end diff --git a/app/operations/transfers/to_aces.rb b/app/operations/transfers/to_aces.rb index 367b0cc4..c943e517 100644 --- a/app/operations/transfers/to_aces.rb +++ b/app/operations/transfers/to_aces.rb @@ -49,7 +49,6 @@ def initiate_transfer(payload, service, params) def record_transfer(service, params, response) payload = JSON.parse(params) - puts payload Transfers::Create.new.call({ service: service, application_identifier: payload["family"]["magi_medicaid_applications"][0]["hbx_id"], family_identifier: payload["family"]["hbx_id"],