From cae9c98f4fa986a7c2f53c6cd45f8f494f2f100d Mon Sep 17 00:00:00 2001 From: Alex Kiessling <32677188+ajkiessl@users.noreply.github.com> Date: Mon, 29 Jul 2024 10:56:18 -0400 Subject: [PATCH] Convert degree name to match GPMS pattern when checking to see if fee is paid. Adds test for this (#812) --- app/services/fee_payment_service.rb | 3 ++- spec/services/fee_payment_service_spec.rb | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/services/fee_payment_service.rb b/app/services/fee_payment_service.rb index f91a07993..87086e48f 100644 --- a/app/services/fee_payment_service.rb +++ b/app/services/fee_payment_service.rb @@ -41,7 +41,8 @@ def author_psu_idn end def degree_name - submission.degree.name + # All caps and convert space to underscore to match GPMS pattern + submission.degree.name.upcase.gsub(' ', '_') end attr_accessor :submission diff --git a/spec/services/fee_payment_service_spec.rb b/spec/services/fee_payment_service_spec.rb index 752528238..0fc64e006 100644 --- a/spec/services/fee_payment_service_spec.rb +++ b/spec/services/fee_payment_service_spec.rb @@ -59,6 +59,23 @@ expect(service.fee_is_paid?).to eq true end end + + context "when the submission degree is M Ed" do + it 'returns true' do + submission.degree.name = 'M Ed' + submission.save! + stub_request(:get, "https://secure.gradsch.psu.edu/services/etd/etdPayment.cfm?degree=M_ED&psuid=#{submission.author.psu_idn}") + .with( + headers: { + 'Accept' => '*/*', + 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', + 'User-Agent' => 'Ruby' + } + ) + .to_return(status: 200, body: "\r\n {\"data\":[{\"ETDPAYMENTFOUND\":\"Y\"}],\"error\":\"\"}\r\n ", headers: {}) + expect(service.fee_is_paid?).to eq true + end + end end context "when the student's fee has not been paid" do