From 7b007671db06fe1481912476ee67d167122674a4 Mon Sep 17 00:00:00 2001 From: Kostas Smo Date: Tue, 5 Dec 2023 17:36:41 +0200 Subject: [PATCH 1/2] Add qrUrl element to response xsd --- lib/my_data/xsd/docs/response-v1.0.2.xsd | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/my_data/xsd/docs/response-v1.0.2.xsd b/lib/my_data/xsd/docs/response-v1.0.2.xsd index 341aad8..a63d360 100644 --- a/lib/my_data/xsd/docs/response-v1.0.2.xsd +++ b/lib/my_data/xsd/docs/response-v1.0.2.xsd @@ -44,6 +44,11 @@ Συμβολοσειρά Αυθεντικοποίησης Παρόχου + + + QR Code Url + + From 35b5f2a7d8d64ad3064cdac010555542d4777a7a Mon Sep 17 00:00:00 2001 From: Kostas Smo Date: Tue, 5 Dec 2023 19:47:58 +0200 Subject: [PATCH 2/2] Add customized vcr spec on myDATA API 1.0.7 for qr_url Response captured with VCR on latest myDATA API, anonymized response qrUrl query parameter, replaced request body, mark, uid with values from send_invoices_success.yml --- .../send_invoices_success_modified_v1_0_7.yml | 95 +++++++++++++++++++ spec/lib/my_data/client_spec.rb | 8 ++ 2 files changed, 103 insertions(+) create mode 100644 spec/cassettes/send_invoices_success_modified_v1_0_7.yml diff --git a/spec/cassettes/send_invoices_success_modified_v1_0_7.yml b/spec/cassettes/send_invoices_success_modified_v1_0_7.yml new file mode 100644 index 0000000..17703d7 --- /dev/null +++ b/spec/cassettes/send_invoices_success_modified_v1_0_7.yml @@ -0,0 +1,95 @@ +--- +http_interactions: +- request: + method: post + uri: https://mydataapidev.aade.gr/SendInvoices + body: + encoding: UTF-8 + string: | + + + + + 111111111 + GR + 0 + + + A + 1 + 2021-02-21 + 11.2 + EUR + + + + 3 + 124.0 + + + + 1 + 100.0 + 1 + 24.0 + + E3_561_003 + category1_3 + 100.0 + + + + 100.0 + 24.0 + 0.0 + 0.0 + 0.0 + 0.0 + 0.0 + 124.0 + + E3_561_003 + category1_3 + 100.0 + + + + + headers: + Content-Type: + - application/xml + Accept: + - application/xml + Aade-User-Id: + - johndoe + Ocp-Apim-Subscription-Key: + - c9b79ff1841fb5cfecc66e1ea5a29b4d + User-Agent: + - Faraday v1.3.0 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Tue, 05 Dec 2023 17:31:28 GMT + Content-Type: + - application/xml; charset=utf-8 + Content-Length: + - '728' + Connection: + - keep-alive + Request-Context: + - appId=cid-v1:13c4bd32-05a8-456a-a0a3-25e8a821dcf9 + body: + encoding: UTF-8 + string: "<?xml + version=\"1.0\" encoding=\"utf-8\"?>\r\n<ResponseDoc xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" + xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n <response>\r\n + \ <index>1</index>\r\n <invoiceUid>4626E9F44FAC8F6BB3B8BBF36EF21377E8202407</invoiceUid>\r\n + \ <invoiceMark>400001832005979</invoiceMark>\r\n <qrUrl>https://mydataapidev.aade.gr/TimologioQR/QRInfo?q=encoded_string_replaced_on_cassette</qrUrl>\r\n + \ <statusCode>Success</statusCode>\r\n </response>\r\n</ResponseDoc>" + recorded_at: Tue, 05 Dec 2023 17:31:28 GMT +recorded_with: VCR 6.0.0 diff --git a/spec/lib/my_data/client_spec.rb b/spec/lib/my_data/client_spec.rb index 32c9279..f2fa515 100644 --- a/spec/lib/my_data/client_spec.rb +++ b/spec/lib/my_data/client_spec.rb @@ -158,6 +158,14 @@ expect(response_parser.errors).to be_empty end end + + context "when request is successful (myDATA API 1.0.7)", vcr: { cassette_name: "send_invoices_success_modified_v1_0_7", match_requests_on: [:body] } do + let(:doc) { build(:invoices_doc).to_xml } + + it "has proper qr_url" do + expect(response_parser.response.response.first.qr_url).to eq("https://mydataapidev.aade.gr/TimologioQR/QRInfo?q=encoded_string_replaced_on_cassette") + end + end end describe "#cancel_invoice" do