diff --git a/lib/beyond_api/services/customer.rb b/lib/beyond_api/services/customer.rb new file mode 100644 index 0000000..b24d626 --- /dev/null +++ b/lib/beyond_api/services/customer.rb @@ -0,0 +1,155 @@ +# frozen_string_literal: true + +module BeyondApi + # @example How to instantiate a client + # @client = BeyondApi::Customer.new(api_url: 'https://example.com/api', access_token: 'your_token') + class Customer < BaseService + # Retrieve the details of a customer. + # + # @see https://developer.epages.com/beyond-docs/#show_customer_details + # + # @param id [String] the customer UUID + # + # @return [Hash] + # + # @example + # @client.find('5afcf0ce-4e39-4b4d-88bb-82d5cc07c83a') + def find(id) + get("customers/#{id}") + end + + # List all customers of the shop in a paged manner. + # + # @see https://developer.epages.com/beyond-docs/#list_customers + # + # @option params [Boolean] :paginated + # @option params [Integer] :size the page size + # @option params [Integer] :page the page number + # + # @return [Hash] + # + # @example + # @client.all(size: 100, page: 0) + def all(params = {}) + fetch_all_pages('customers', params) + end + + # Create a `COCKPIT` customer. + # + # @see https://developer.epages.com/beyond-docs/#create_customer + # + # @param body [Hash] the request body + # + # @return [Hash] + # + # @example + # customer_data = { + # billing_address: { + # gender: "FEMALE", + # company: "Astrid Alster GmbH", + # first_name: "Astrid", + # last_name: "Alster", + # street: "Alsterwasserweg", + # house_number: "2", + # postal_code: "20999", + # city: "Alsterwasser", + # country: "DE", + # state: "Hamburg", + # email: "a.alsterh@example.com", + # phone: "(800) 555-0102" + # }, + # email: "a.alsterh@example.com", + # customer_comment: "A reliable customer", + # shipping_address: { + # company: "ePages GmbH", + # first_name: "Chayanne", + # last_name: "Team42", + # street: "Pilatuspool", + # house_number: "2", + # postal_code: "20999", + # city: "Alsterwasser", + # country: "DE", + # state: "Hamburg", + # email: "a.chayanne@example.com", + # phone: "(800) 555-0102" + # } + # } + # @client.create(customer_data) + def create(body) + post('customers', body) + end + + # Update a customer. + # + # @see https://developer.epages.com/beyond-docs/#update_customer + # + # @param body [Hash] the request body + # + # @return [Hash] + # + # @example + # customer_data = { + # billing_address: { + # company: "ePages GmbH", + # first_name: "Chayanne", + # last_name: "Team42", + # street: "Pilatuspool", + # house_number: "2", + # postal_code: "20999", + # city: "Alsterwasser", + # country: "DE", + # state: "Hamburg", + # email: "a.chayanne@example.com", + # phone: "(800) 555-0102" + # }, + # email: "a.alsterh@example.com", + # customer_comment: "A reliable customer", + # shipping_address: { + # gender: "FEMALE", + # company: "Astrid Alster GmbH", + # first_name: "Astrid", + # last_name: "Alster", + # street: "Alsterwasserweg", + # house_number: "2", + # postal_code: "20999", + # city: "Alsterwasser", + # country: "DE", + # state: "Hamburg", + # email: "a.alsterh@example.com", + # phone: "(800) 555-0102" + # } + # } + # @client.update('2bdc787e-4643-4eeb-babf-06bc1d4b1c1b', customer_data) + def update(id, body) + put("customers/#{id}", body) + end + + # Delete a customer. + # + # @see https://developer.epages.com/beyond-docs/#delete_customer + # + # @param id [String] the customer UUID + # + # @return [Hash] an empty hash + # + # @example + # @client.delete('71b62b1d-271a-4b56-9514-77b79f8e910a') + def delete(id) + super("customers/#{id}") # Concerns::Connection delete method + end + + # List all events of a customer. + # + # @see https://developer.epages.com/beyond-docs/#list_customer_events + # + # @param id [String] the customer UUID + # + # @return [Hash] + # + # @example + # @client.events('df184f00-2367-417f-bc23-c7f927dbf636') + def events(id) + get("customers/#{id}/events") + end + end +end diff --git a/spec/beyond_api/services/customer_spec.rb b/spec/beyond_api/services/customer_spec.rb new file mode 100644 index 0000000..de27bbb --- /dev/null +++ b/spec/beyond_api/services/customer_spec.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +RSpec.describe BeyondApi::Customer, vcr: true do + let(:client) { described_class.new(api_url: ENV.fetch('API_URL', nil), access_token: beyond_access_token) } + + describe '.all' do + it 'returns all customers' do + response = client.all + + expect(response).not_to be nil + expect(response.dig(:embedded, :customers)).to be_kind_of(Array) + expect(response[:page]).to be_kind_of(Hash) + end + end + + context 'with customer' do + before(:each) do + @customer = client.create(build(:customer_data)) + end + + describe '.create' do + it 'creates a new customer' do + expect(@customer).not_to be nil + expect(@customer.dig(:default_billing_address, :company)).to eq('ePages GmbH') + expect(@customer.dig(:default_billing_address, :first_name)).to eq('Chayanne') + expect(@customer.dig(:default_billing_address, :last_name)).to eq('Team42') + expect(@customer.dig(:default_billing_address, :street)).to eq('Pilatuspool') + expect(@customer.dig(:default_billing_address, :house_number)).to eq('2') + expect(@customer.dig(:default_billing_address, :postal_code)).to eq('20999') + expect(@customer.dig(:default_billing_address, :city)).to eq('Alsterwasser') + expect(@customer.dig(:default_billing_address, :country)).to eq('DE') + expect(@customer.dig(:default_billing_address, :state)).to eq('Hamburg') + expect(@customer.dig(:default_billing_address, :email)).to eq('chayanne@example.com') + expect(@customer.dig(:default_billing_address, :phone)).to eq('(800) 555-0102') + end + end + + describe '.find' do + it 'returns a customer' do + response = client.find(@customer[:id]) + expect(response.dig(:default_billing_address, :first_name)).to eq('Chayanne') + end + end + + describe '.update' do + it 'updates an existing customer' do + updated_customer_data = FactoryBot.build(:customer_data, :berlin_shipping) + + updated_customer = client.update(@customer[:id], updated_customer_data) + expect(updated_customer).not_to be nil + expect(updated_customer.dig(:default_shipping_address, :company)).to eq('Updated GmbH') + end + end + + describe '.events' do + it 'returns all events for a customer' do + response = client.events(@customer[:id]) + expect(response).not_to be nil + expect(response.dig(:embedded, :customer_events)).to be_kind_of(Array) + end + end + + describe '.delete' do + it 'deletes a customer' do + response = client.delete(@customer[:id]) + expect(response).to eq({}) + end + end + + after(:each) do + client.delete(@customer[:id]) + rescue BeyondApi::Error # rubocop:disable Lint/SuppressedException + end + end +end diff --git a/spec/factories/customer_data.rb b/spec/factories/customer_data.rb new file mode 100644 index 0000000..abbc1c1 --- /dev/null +++ b/spec/factories/customer_data.rb @@ -0,0 +1,62 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :customer_data, class: Hash do + email { 'chayanne@example.com' } + customer_comment { 'A reliable customer' } + + billing_address do + { + company: 'ePages GmbH', + first_name: 'Chayanne', + last_name: 'Team42', + street: 'Pilatuspool', + house_number: '2', + postal_code: '20999', + city: 'Alsterwasser', + country: 'DE', + state: 'Hamburg', + email: 'chayanne@example.com', + phone: '(800) 555-0102' + } + end + + shipping_address do + { + gender: 'FEMALE', + company: 'Astrid Alster GmbH', + first_name: 'Astrid', + last_name: 'Alster', + street: 'Alsterwasserweg', + house_number: '2', + postal_code: '20999', + city: 'Alsterwasser', + country: 'DE', + state: 'Hamburg', + email: 'alsterh@example.com', + phone: '(800) 555-0102' + } + end + + trait :berlin_shipping do + shipping_address do + { + gender: 'FEMALE', + company: 'Updated GmbH', + first_name: 'Astrid', + last_name: 'Alster', + street: 'Berlin Street', + house_number: '42', + postal_code: '12345', + city: 'Berlin', + country: 'DE', + state: 'Berlin', + email: 'alsterh@example.com', + phone: '(800) 555-0102' + } + end + end + + initialize_with { attributes } + end +end diff --git a/spec/vcr_cassettes/BeyondApi_Customer/_all/returns_all_customers.yml b/spec/vcr_cassettes/BeyondApi_Customer/_all/returns_all_customers.yml new file mode 100644 index 0000000..ad477b4 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Customer/_all/returns_all_customers.yml @@ -0,0 +1,136 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 06 Sep 2024 07:34:45 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.107' + X-B3-Traceid: + - 2ac530d347565da9f565d6df651e5d0c + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1725608085, + "jti" : "WlwVZBu3mn6PxSlPXI2D8alxDgQ=" + } + recorded_at: Fri, 06 Sep 2024 07:34:45 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/customers + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 06 Sep 2024 07:34:45 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.079' + X-B3-Traceid: + - c080a1385acada6b51c2d311182fc97e + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "customers" : [ ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers?page=0&size=20" + } + }, + "page" : { + "size" : 20, + "totalElements" : 0, + "totalPages" : 0, + "number" : 0 + } + } + recorded_at: Fri, 06 Sep 2024 07:34:45 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_create/creates_a_new_customer.yml b/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_create/creates_a_new_customer.yml new file mode 100644 index 0000000..6b406c8 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_create/creates_a_new_customer.yml @@ -0,0 +1,261 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 06 Sep 2024 07:34:46 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.100' + X-B3-Traceid: + - b03f9c28b22caaf7867420fe8b952e04 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1725608086, + "jti" : "G56YpddqUZJ6AD68z6ARhvLq9w4=" + } + recorded_at: Fri, 06 Sep 2024 07:34:46 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/customers + body: + encoding: UTF-8 + string: '{"email":"chayanne@example.com","customerComment":"A reliable customer","billingAddress":{"company":"ePages + GmbH","firstName":"Chayanne","lastName":"Team42","street":"Pilatuspool","houseNumber":"2","postalCode":"20999","city":"Alsterwasser","country":"DE","state":"Hamburg","email":"chayanne@example.com","phone":"(800) + 555-0102"},"shippingAddress":{"gender":"FEMALE","company":"Astrid Alster GmbH","firstName":"Astrid","lastName":"Alster","street":"Alsterwasserweg","houseNumber":"2","postalCode":"20999","city":"Alsterwasser","country":"DE","state":"Hamburg","email":"alsterh@example.com","phone":"(800) + 555-0102"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Fri, 06 Sep 2024 07:34:46 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/customers/1877de01-eba4-4e42-805b-3408ff375b91 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.137' + X-B3-Traceid: + - c27da866a2b8e4fad235976d33b6ac0b + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "orderSummary" : { + "total" : 0, + "openOrders" : 0, + "grandTotal" : null, + "average" : null, + "lastOrderDate" : null, + "lastOrder" : null + }, + "recentOrders" : [ ], + "customerGroups" : [ ] + }, + "email" : "chayanne@example.com", + "customerNumber" : "1008", + "customerOrigin" : "COCKPIT", + "defaultShippingAddress" : { + "salutation" : null, + "gender" : "FEMALE", + "company" : "Astrid Alster GmbH", + "title" : null, + "firstName" : "Astrid", + "middleName" : null, + "lastName" : "Alster", + "street" : "Alsterwasserweg", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "alsterh@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "Astrid Alster GmbH", "Astrid Alster", "Alsterwasserweg 2", "20999 Alsterwasser", "GERMANY" ], + "doorCode" : null + }, + "defaultBillingAddress" : { + "salutation" : null, + "gender" : null, + "company" : "ePages GmbH", + "title" : null, + "firstName" : "Chayanne", + "middleName" : null, + "lastName" : "Team42", + "street" : "Pilatuspool", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "chayanne@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "ePages GmbH", "Chayanne Team42", "Pilatuspool 2", "20999 Alsterwasser", "GERMANY" ], + "vatId" : null, + "taxNumber" : null, + "birthDate" : null + }, + "defaultShippingMethodId" : null, + "defaultPaymentMethodId" : null, + "defaultPickupOptionId" : null, + "creationDate" : "2024-09-06T07:34:46.29413293", + "testCustomer" : false, + "customerComment" : "A reliable customer", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/1877de01-eba4-4e42-805b-3408ff375b91" + }, + "customer" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/1877de01-eba4-4e42-805b-3408ff375b91" + }, + "events" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/1877de01-eba4-4e42-805b-3408ff375b91/events" + }, + "customer-groups" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/1877de01-eba4-4e42-805b-3408ff375b91/customer-groups" + } + }, + "_id" : "1877de01-eba4-4e42-805b-3408ff375b91" + } + recorded_at: Fri, 06 Sep 2024 07:34:46 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/customers/1877de01-eba4-4e42-805b-3408ff375b91 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Fri, 06 Sep 2024 07:34:46 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.058' + X-B3-Traceid: + - 19cade8642609c0f079d8016af1c0347 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Fri, 06 Sep 2024 07:34:46 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_delete/deletes_a_customer.yml b/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_delete/deletes_a_customer.yml new file mode 100644 index 0000000..4e292f8 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_delete/deletes_a_customer.yml @@ -0,0 +1,313 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 06 Sep 2024 07:34:48 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.083' + X-B3-Traceid: + - 4dc97a749e07e9c38bcba51d9995d655 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1725608088, + "jti" : "dYRgDKfN8buk+vVRIqFfoTSk1Zw=" + } + recorded_at: Fri, 06 Sep 2024 07:34:48 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/customers + body: + encoding: UTF-8 + string: '{"email":"chayanne@example.com","customerComment":"A reliable customer","billingAddress":{"company":"ePages + GmbH","firstName":"Chayanne","lastName":"Team42","street":"Pilatuspool","houseNumber":"2","postalCode":"20999","city":"Alsterwasser","country":"DE","state":"Hamburg","email":"chayanne@example.com","phone":"(800) + 555-0102"},"shippingAddress":{"gender":"FEMALE","company":"Astrid Alster GmbH","firstName":"Astrid","lastName":"Alster","street":"Alsterwasserweg","houseNumber":"2","postalCode":"20999","city":"Alsterwasser","country":"DE","state":"Hamburg","email":"alsterh@example.com","phone":"(800) + 555-0102"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Fri, 06 Sep 2024 07:34:48 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/customers/00abc7e5-f708-4609-9f6c-b92406c2b2f8 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.081' + X-B3-Traceid: + - 121adc793826d2464816c0e7534ddd89 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "orderSummary" : { + "total" : 0, + "openOrders" : 0, + "grandTotal" : null, + "average" : null, + "lastOrderDate" : null, + "lastOrder" : null + }, + "recentOrders" : [ ], + "customerGroups" : [ ] + }, + "email" : "chayanne@example.com", + "customerNumber" : "1012", + "customerOrigin" : "COCKPIT", + "defaultShippingAddress" : { + "salutation" : null, + "gender" : "FEMALE", + "company" : "Astrid Alster GmbH", + "title" : null, + "firstName" : "Astrid", + "middleName" : null, + "lastName" : "Alster", + "street" : "Alsterwasserweg", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "alsterh@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "Astrid Alster GmbH", "Astrid Alster", "Alsterwasserweg 2", "20999 Alsterwasser", "GERMANY" ], + "doorCode" : null + }, + "defaultBillingAddress" : { + "salutation" : null, + "gender" : null, + "company" : "ePages GmbH", + "title" : null, + "firstName" : "Chayanne", + "middleName" : null, + "lastName" : "Team42", + "street" : "Pilatuspool", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "chayanne@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "ePages GmbH", "Chayanne Team42", "Pilatuspool 2", "20999 Alsterwasser", "GERMANY" ], + "vatId" : null, + "taxNumber" : null, + "birthDate" : null + }, + "defaultShippingMethodId" : null, + "defaultPaymentMethodId" : null, + "defaultPickupOptionId" : null, + "creationDate" : "2024-09-06T07:34:48.73401719", + "testCustomer" : false, + "customerComment" : "A reliable customer", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/00abc7e5-f708-4609-9f6c-b92406c2b2f8" + }, + "customer" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/00abc7e5-f708-4609-9f6c-b92406c2b2f8" + }, + "events" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/00abc7e5-f708-4609-9f6c-b92406c2b2f8/events" + }, + "customer-groups" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/00abc7e5-f708-4609-9f6c-b92406c2b2f8/customer-groups" + } + }, + "_id" : "00abc7e5-f708-4609-9f6c-b92406c2b2f8" + } + recorded_at: Fri, 06 Sep 2024 07:34:48 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/customers/00abc7e5-f708-4609-9f6c-b92406c2b2f8 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Fri, 06 Sep 2024 07:34:48 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.046' + X-B3-Traceid: + - 3cc80114aadd012741905cfc2e83f882 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Fri, 06 Sep 2024 07:34:48 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/customers/00abc7e5-f708-4609-9f6c-b92406c2b2f8 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 404 + message: Not Found + headers: + Date: + - Fri, 06 Sep 2024 07:34:48 GMT + Content-Length: + - '0' + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.013' + X-B3-Traceid: + - f22d2ee2da14b08c9d68b8ddcdbd9b1e + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Fri, 06 Sep 2024 07:34:48 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_events/returns_all_events_for_a_customer.yml b/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_events/returns_all_events_for_a_customer.yml new file mode 100644 index 0000000..83acfbf --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_events/returns_all_events_for_a_customer.yml @@ -0,0 +1,345 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 06 Sep 2024 07:34:47 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.093' + X-B3-Traceid: + - 9a2f316a96cb4e0ff1958053e01a71f3 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1725608087, + "jti" : "mZTHMuKS0YHRRj6b8bPgAll0z08=" + } + recorded_at: Fri, 06 Sep 2024 07:34:47 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/customers + body: + encoding: UTF-8 + string: '{"email":"chayanne@example.com","customerComment":"A reliable customer","billingAddress":{"company":"ePages + GmbH","firstName":"Chayanne","lastName":"Team42","street":"Pilatuspool","houseNumber":"2","postalCode":"20999","city":"Alsterwasser","country":"DE","state":"Hamburg","email":"chayanne@example.com","phone":"(800) + 555-0102"},"shippingAddress":{"gender":"FEMALE","company":"Astrid Alster GmbH","firstName":"Astrid","lastName":"Alster","street":"Alsterwasserweg","houseNumber":"2","postalCode":"20999","city":"Alsterwasser","country":"DE","state":"Hamburg","email":"alsterh@example.com","phone":"(800) + 555-0102"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Fri, 06 Sep 2024 07:34:48 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/customers/fe4e14cf-06ed-43d0-86ba-b0ff40e579f1 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.088' + X-B3-Traceid: + - d1b2c78fc9d65f14d4ed54a9e3f9ee84 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "orderSummary" : { + "total" : 0, + "openOrders" : 0, + "grandTotal" : null, + "average" : null, + "lastOrderDate" : null, + "lastOrder" : null + }, + "recentOrders" : [ ], + "customerGroups" : [ ] + }, + "email" : "chayanne@example.com", + "customerNumber" : "1011", + "customerOrigin" : "COCKPIT", + "defaultShippingAddress" : { + "salutation" : null, + "gender" : "FEMALE", + "company" : "Astrid Alster GmbH", + "title" : null, + "firstName" : "Astrid", + "middleName" : null, + "lastName" : "Alster", + "street" : "Alsterwasserweg", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "alsterh@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "Astrid Alster GmbH", "Astrid Alster", "Alsterwasserweg 2", "20999 Alsterwasser", "GERMANY" ], + "doorCode" : null + }, + "defaultBillingAddress" : { + "salutation" : null, + "gender" : null, + "company" : "ePages GmbH", + "title" : null, + "firstName" : "Chayanne", + "middleName" : null, + "lastName" : "Team42", + "street" : "Pilatuspool", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "chayanne@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "ePages GmbH", "Chayanne Team42", "Pilatuspool 2", "20999 Alsterwasser", "GERMANY" ], + "vatId" : null, + "taxNumber" : null, + "birthDate" : null + }, + "defaultShippingMethodId" : null, + "defaultPaymentMethodId" : null, + "defaultPickupOptionId" : null, + "creationDate" : "2024-09-06T07:34:48.128473616", + "testCustomer" : false, + "customerComment" : "A reliable customer", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/fe4e14cf-06ed-43d0-86ba-b0ff40e579f1" + }, + "customer" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/fe4e14cf-06ed-43d0-86ba-b0ff40e579f1" + }, + "events" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/fe4e14cf-06ed-43d0-86ba-b0ff40e579f1/events" + }, + "customer-groups" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/fe4e14cf-06ed-43d0-86ba-b0ff40e579f1/customer-groups" + } + }, + "_id" : "fe4e14cf-06ed-43d0-86ba-b0ff40e579f1" + } + recorded_at: Fri, 06 Sep 2024 07:34:48 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/customers/fe4e14cf-06ed-43d0-86ba-b0ff40e579f1/events + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 06 Sep 2024 07:34:48 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.026' + X-B3-Traceid: + - cf48748a0e1f8682193ef0112de0e412 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "customer-events" : [ { + "type" : "customer-comment-created", + "comment" : "A reliable customer", + "eventTimestamp" : "2024-09-06T07:34:48.154", + "details" : { }, + "triggeredBy" : "merchant" + }, { + "type" : "customer-created", + "comment" : null, + "eventTimestamp" : "2024-09-06T07:34:48.128", + "details" : { + "origin" : "COCKPIT" + }, + "triggeredBy" : "merchant" + } ] + }, + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/fe4e14cf-06ed-43d0-86ba-b0ff40e579f1/events?page=0&size=20&sort=eventTimestamp,desc" + } + }, + "page" : { + "size" : 20, + "totalElements" : 2, + "totalPages" : 1, + "number" : 0 + } + } + recorded_at: Fri, 06 Sep 2024 07:34:48 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/customers/fe4e14cf-06ed-43d0-86ba-b0ff40e579f1 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Fri, 06 Sep 2024 07:34:48 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.045' + X-B3-Traceid: + - 352c8beb5134c286377074729c4cb0ce + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Fri, 06 Sep 2024 07:34:48 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_find/returns_a_customer.yml b/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_find/returns_a_customer.yml new file mode 100644 index 0000000..fe9e6ee --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_find/returns_a_customer.yml @@ -0,0 +1,401 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 06 Sep 2024 07:34:46 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.086' + X-B3-Traceid: + - 5a26da8fcc9624a47a9a57868740fab7 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1725608086, + "jti" : "ehrm8T60HaqIVDmHOTJqnIcxJjI=" + } + recorded_at: Fri, 06 Sep 2024 07:34:46 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/customers + body: + encoding: UTF-8 + string: '{"email":"chayanne@example.com","customerComment":"A reliable customer","billingAddress":{"company":"ePages + GmbH","firstName":"Chayanne","lastName":"Team42","street":"Pilatuspool","houseNumber":"2","postalCode":"20999","city":"Alsterwasser","country":"DE","state":"Hamburg","email":"chayanne@example.com","phone":"(800) + 555-0102"},"shippingAddress":{"gender":"FEMALE","company":"Astrid Alster GmbH","firstName":"Astrid","lastName":"Alster","street":"Alsterwasserweg","houseNumber":"2","postalCode":"20999","city":"Alsterwasser","country":"DE","state":"Hamburg","email":"alsterh@example.com","phone":"(800) + 555-0102"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Fri, 06 Sep 2024 07:34:46 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/customers/f9122ba1-91b9-448e-b28e-f027ce4ea5d6 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.082' + X-B3-Traceid: + - 449c5bdc4ef74a1acc5382fb22f940dc + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "orderSummary" : { + "total" : 0, + "openOrders" : 0, + "grandTotal" : null, + "average" : null, + "lastOrderDate" : null, + "lastOrder" : null + }, + "recentOrders" : [ ], + "customerGroups" : [ ] + }, + "email" : "chayanne@example.com", + "customerNumber" : "1009", + "customerOrigin" : "COCKPIT", + "defaultShippingAddress" : { + "salutation" : null, + "gender" : "FEMALE", + "company" : "Astrid Alster GmbH", + "title" : null, + "firstName" : "Astrid", + "middleName" : null, + "lastName" : "Alster", + "street" : "Alsterwasserweg", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "alsterh@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "Astrid Alster GmbH", "Astrid Alster", "Alsterwasserweg 2", "20999 Alsterwasser", "GERMANY" ], + "doorCode" : null + }, + "defaultBillingAddress" : { + "salutation" : null, + "gender" : null, + "company" : "ePages GmbH", + "title" : null, + "firstName" : "Chayanne", + "middleName" : null, + "lastName" : "Team42", + "street" : "Pilatuspool", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "chayanne@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "ePages GmbH", "Chayanne Team42", "Pilatuspool 2", "20999 Alsterwasser", "GERMANY" ], + "vatId" : null, + "taxNumber" : null, + "birthDate" : null + }, + "defaultShippingMethodId" : null, + "defaultPaymentMethodId" : null, + "defaultPickupOptionId" : null, + "creationDate" : "2024-09-06T07:34:46.820923909", + "testCustomer" : false, + "customerComment" : "A reliable customer", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/f9122ba1-91b9-448e-b28e-f027ce4ea5d6" + }, + "customer" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/f9122ba1-91b9-448e-b28e-f027ce4ea5d6" + }, + "events" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/f9122ba1-91b9-448e-b28e-f027ce4ea5d6/events" + }, + "customer-groups" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/f9122ba1-91b9-448e-b28e-f027ce4ea5d6/customer-groups" + } + }, + "_id" : "f9122ba1-91b9-448e-b28e-f027ce4ea5d6" + } + recorded_at: Fri, 06 Sep 2024 07:34:46 GMT +- request: + method: get + uri: https://team42-beyond-api.beyondshop.cloud/api/customers/f9122ba1-91b9-448e-b28e-f027ce4ea5d6 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 06 Sep 2024 07:34:46 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.037' + X-B3-Traceid: + - e2305f5a6f5cd0d68f001c651eec32d9 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "orderSummary" : { + "total" : 0, + "openOrders" : 0, + "grandTotal" : null, + "average" : null, + "lastOrderDate" : null, + "lastOrder" : null + }, + "recentOrders" : [ ], + "customerGroups" : [ ] + }, + "email" : "chayanne@example.com", + "customerNumber" : "1009", + "customerOrigin" : "COCKPIT", + "defaultShippingAddress" : { + "salutation" : null, + "gender" : "FEMALE", + "company" : "Astrid Alster GmbH", + "title" : null, + "firstName" : "Astrid", + "middleName" : null, + "lastName" : "Alster", + "street" : "Alsterwasserweg", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "alsterh@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "Astrid Alster GmbH", "Astrid Alster", "Alsterwasserweg 2", "20999 Alsterwasser", "GERMANY" ], + "doorCode" : null + }, + "defaultBillingAddress" : { + "salutation" : null, + "gender" : null, + "company" : "ePages GmbH", + "title" : null, + "firstName" : "Chayanne", + "middleName" : null, + "lastName" : "Team42", + "street" : "Pilatuspool", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "chayanne@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "ePages GmbH", "Chayanne Team42", "Pilatuspool 2", "20999 Alsterwasser", "GERMANY" ], + "vatId" : null, + "taxNumber" : null, + "birthDate" : null + }, + "defaultShippingMethodId" : null, + "defaultPaymentMethodId" : null, + "defaultPickupOptionId" : null, + "creationDate" : "2024-09-06T07:34:46.821", + "testCustomer" : false, + "customerComment" : "A reliable customer", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/f9122ba1-91b9-448e-b28e-f027ce4ea5d6" + }, + "customer" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/f9122ba1-91b9-448e-b28e-f027ce4ea5d6" + }, + "events" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/f9122ba1-91b9-448e-b28e-f027ce4ea5d6/events" + }, + "customer-groups" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/f9122ba1-91b9-448e-b28e-f027ce4ea5d6/customer-groups" + } + }, + "_id" : "f9122ba1-91b9-448e-b28e-f027ce4ea5d6" + } + recorded_at: Fri, 06 Sep 2024 07:34:46 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/customers/f9122ba1-91b9-448e-b28e-f027ce4ea5d6 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Fri, 06 Sep 2024 07:34:47 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.077' + X-B3-Traceid: + - cd16a546b3bbea02d2b3c938bb0cf041 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Fri, 06 Sep 2024 07:34:47 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_update/updates_an_existing_customer.yml b/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_update/updates_an_existing_customer.yml new file mode 100644 index 0000000..68e1de8 --- /dev/null +++ b/spec/vcr_cassettes/BeyondApi_Customer/with_customer/_update/updates_an_existing_customer.yml @@ -0,0 +1,405 @@ +--- +http_interactions: +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/oauth/token?grant_type=client_credentials + body: + encoding: UTF-8 + string: "{}" + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Basic + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 06 Sep 2024 07:34:47 GMT + Content-Type: + - application/json;charset=utf-8 + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Cache-Control: + - no-store + Pragma: + - no-cache + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Strict-Transport-Security: + - max-age=31536000 ; includeSubDomains + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.084' + X-B3-Traceid: + - daf221371168badd6c37feb412fd2b4d + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "access_token" : "", + "token_type" : "bearer", + "expires_in" : 3599, + "scope" : "orde:r prat:dcur pypr:cur prod:urdc lcnt:u pymt:ur loca:urcd sctg:m shat:cdru rfpr:ur prad:rcd shpz:dcur shad:u ordr:cur shop:u shim:cd cust:urcd clpr:cr legl:ur prda:ru rtpr:rc oset:ur shpr:rcu cset:ru ordp:r catg:cdur nltg:m", + "tenantId" : 8542, + "iat" : 1725608087, + "jti" : "ZTEKBBs76N9cpZnst22rXtXINiE=" + } + recorded_at: Fri, 06 Sep 2024 07:34:47 GMT +- request: + method: post + uri: https://team42-beyond-api.beyondshop.cloud/api/customers + body: + encoding: UTF-8 + string: '{"email":"chayanne@example.com","customerComment":"A reliable customer","billingAddress":{"company":"ePages + GmbH","firstName":"Chayanne","lastName":"Team42","street":"Pilatuspool","houseNumber":"2","postalCode":"20999","city":"Alsterwasser","country":"DE","state":"Hamburg","email":"chayanne@example.com","phone":"(800) + 555-0102"},"shippingAddress":{"gender":"FEMALE","company":"Astrid Alster GmbH","firstName":"Astrid","lastName":"Alster","street":"Alsterwasserweg","houseNumber":"2","postalCode":"20999","city":"Alsterwasser","country":"DE","state":"Hamburg","email":"alsterh@example.com","phone":"(800) + 555-0102"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 201 + message: Created + headers: + Date: + - Fri, 06 Sep 2024 07:34:47 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + Location: + - https://team42-beyond-api.beyondshop.cloud/api/customers/327dbf86-bcca-49b4-97b7-45853f684b49 + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.085' + X-B3-Traceid: + - 66c66daa14fb3f20f4a94f206fa4ed12 + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "orderSummary" : { + "total" : 0, + "openOrders" : 0, + "grandTotal" : null, + "average" : null, + "lastOrderDate" : null, + "lastOrder" : null + }, + "recentOrders" : [ ], + "customerGroups" : [ ] + }, + "email" : "chayanne@example.com", + "customerNumber" : "1010", + "customerOrigin" : "COCKPIT", + "defaultShippingAddress" : { + "salutation" : null, + "gender" : "FEMALE", + "company" : "Astrid Alster GmbH", + "title" : null, + "firstName" : "Astrid", + "middleName" : null, + "lastName" : "Alster", + "street" : "Alsterwasserweg", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "alsterh@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "Astrid Alster GmbH", "Astrid Alster", "Alsterwasserweg 2", "20999 Alsterwasser", "GERMANY" ], + "doorCode" : null + }, + "defaultBillingAddress" : { + "salutation" : null, + "gender" : null, + "company" : "ePages GmbH", + "title" : null, + "firstName" : "Chayanne", + "middleName" : null, + "lastName" : "Team42", + "street" : "Pilatuspool", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "chayanne@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "ePages GmbH", "Chayanne Team42", "Pilatuspool 2", "20999 Alsterwasser", "GERMANY" ], + "vatId" : null, + "taxNumber" : null, + "birthDate" : null + }, + "defaultShippingMethodId" : null, + "defaultPaymentMethodId" : null, + "defaultPickupOptionId" : null, + "creationDate" : "2024-09-06T07:34:47.474604165", + "testCustomer" : false, + "customerComment" : "A reliable customer", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/327dbf86-bcca-49b4-97b7-45853f684b49" + }, + "customer" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/327dbf86-bcca-49b4-97b7-45853f684b49" + }, + "events" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/327dbf86-bcca-49b4-97b7-45853f684b49/events" + }, + "customer-groups" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/327dbf86-bcca-49b4-97b7-45853f684b49/customer-groups" + } + }, + "_id" : "327dbf86-bcca-49b4-97b7-45853f684b49" + } + recorded_at: Fri, 06 Sep 2024 07:34:47 GMT +- request: + method: put + uri: https://team42-beyond-api.beyondshop.cloud/api/customers/327dbf86-bcca-49b4-97b7-45853f684b49 + body: + encoding: UTF-8 + string: '{"email":"chayanne@example.com","customerComment":"A reliable customer","billingAddress":{"company":"ePages + GmbH","firstName":"Chayanne","lastName":"Team42","street":"Pilatuspool","houseNumber":"2","postalCode":"20999","city":"Alsterwasser","country":"DE","state":"Hamburg","email":"chayanne@example.com","phone":"(800) + 555-0102"},"shippingAddress":{"gender":"FEMALE","company":"Updated GmbH","firstName":"Astrid","lastName":"Alster","street":"Berlin + Street","houseNumber":"42","postalCode":"12345","city":"Berlin","country":"DE","state":"Berlin","email":"alsterh@example.com","phone":"(800) + 555-0102"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 200 + message: OK + headers: + Date: + - Fri, 06 Sep 2024 07:34:47 GMT + Content-Type: + - application/json + Transfer-Encoding: + - chunked + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.069' + X-B3-Traceid: + - 7872fda102ff05d8bf687043381d5e2b + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: |- + { + "_embedded" : { + "orderSummary" : { + "total" : 0, + "openOrders" : 0, + "grandTotal" : null, + "average" : null, + "lastOrderDate" : null, + "lastOrder" : null + }, + "recentOrders" : [ ], + "customerGroups" : [ ] + }, + "email" : "chayanne@example.com", + "customerNumber" : "1010", + "customerOrigin" : "COCKPIT", + "defaultShippingAddress" : { + "salutation" : null, + "gender" : "FEMALE", + "company" : "Updated GmbH", + "title" : null, + "firstName" : "Astrid", + "middleName" : null, + "lastName" : "Alster", + "street" : "Berlin Street", + "houseNumber" : "42", + "street2" : null, + "addressExtension" : null, + "postalCode" : "12345", + "dependentLocality" : null, + "city" : "Berlin", + "country" : "DE", + "state" : "Berlin", + "email" : "alsterh@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "Updated GmbH", "Astrid Alster", "Berlin Street 42", "12345 Berlin", "GERMANY" ], + "doorCode" : null + }, + "defaultBillingAddress" : { + "salutation" : null, + "gender" : null, + "company" : "ePages GmbH", + "title" : null, + "firstName" : "Chayanne", + "middleName" : null, + "lastName" : "Team42", + "street" : "Pilatuspool", + "houseNumber" : "2", + "street2" : null, + "addressExtension" : null, + "postalCode" : "20999", + "dependentLocality" : null, + "city" : "Alsterwasser", + "country" : "DE", + "state" : "Hamburg", + "email" : "chayanne@example.com", + "phone" : "(800) 555-0102", + "mobile" : null, + "displayAddressLines" : [ "ePages GmbH", "Chayanne Team42", "Pilatuspool 2", "20999 Alsterwasser", "GERMANY" ], + "vatId" : null, + "taxNumber" : null, + "birthDate" : null + }, + "defaultShippingMethodId" : null, + "defaultPaymentMethodId" : null, + "defaultPickupOptionId" : null, + "creationDate" : "2024-09-06T07:34:47.475", + "testCustomer" : false, + "customerComment" : "A reliable customer", + "_links" : { + "self" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/327dbf86-bcca-49b4-97b7-45853f684b49" + }, + "customer" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/327dbf86-bcca-49b4-97b7-45853f684b49" + }, + "events" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/327dbf86-bcca-49b4-97b7-45853f684b49/events" + }, + "customer-groups" : { + "href" : "https://team42-beyond-api.beyondshop.cloud/api/customers/327dbf86-bcca-49b4-97b7-45853f684b49/customer-groups" + } + }, + "_id" : "327dbf86-bcca-49b4-97b7-45853f684b49" + } + recorded_at: Fri, 06 Sep 2024 07:34:47 GMT +- request: + method: delete + uri: https://team42-beyond-api.beyondshop.cloud/api/customers/327dbf86-bcca-49b4-97b7-45853f684b49 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - application/json + Content-Type: + - application/json + User-Agent: + - Faraday v2.10.1 + Authorization: + - Bearer + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + response: + status: + code: 204 + message: No Content + headers: + Date: + - Fri, 06 Sep 2024 07:34:47 GMT + Connection: + - keep-alive + X-Content-Type-Options: + - nosniff + X-Xss-Protection: + - 1; mode=block + Cache-Control: + - no-cache, no-store, max-age=0, must-revalidate + Pragma: + - no-cache + Expires: + - '0' + X-Frame-Options: + - DENY + Server: + - epages-beyond + X-Request-Time: + - '0.046' + X-B3-Traceid: + - '0950a5bd9ab975cdf726fdf3636f67ae' + X-Hello-Human: + - Come work with us! https://developer.epages.com/devjobs/ + body: + encoding: UTF-8 + string: '' + recorded_at: Fri, 06 Sep 2024 07:34:47 GMT +recorded_with: VCR 6.2.0