From b2af725a2ff5793c6917235d152348e119466e0a Mon Sep 17 00:00:00 2001 From: LovroColic Date: Tue, 17 Sep 2024 17:19:00 +0200 Subject: [PATCH] fix: change gcl customer payload (#2593) ## Context GCL payload needs to be fixed. All attributes need to be wrapped under `payload` --- .../payment_provider_customers/gocardless_service.rb | 2 +- .../gocardless_service_spec.rb | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/services/payment_provider_customers/gocardless_service.rb b/app/services/payment_provider_customers/gocardless_service.rb index bc0a7b993b8..2adeafe1356 100644 --- a/app/services/payment_provider_customers/gocardless_service.rb +++ b/app/services/payment_provider_customers/gocardless_service.rb @@ -77,7 +77,7 @@ def create_gocardless_customer family_name: customer.lastname.presence }.compact - client.customers.create(customer_params) + client.customers.create(params: customer_params) rescue GoCardlessPro::Error => e deliver_error_webhook(e) diff --git a/spec/services/payment_provider_customers/gocardless_service_spec.rb b/spec/services/payment_provider_customers/gocardless_service_spec.rb index 0e76abb64a4..0c7e9aa458d 100644 --- a/spec/services/payment_provider_customers/gocardless_service_spec.rb +++ b/spec/services/payment_provider_customers/gocardless_service_spec.rb @@ -32,10 +32,12 @@ gocardless_service.create expect(gocardless_customers_service).to have_received(:create).with( hash_including( - email: customer.email, - company_name: customer.name, - given_name: customer.firstname, - family_name: customer.lastname + params: { + email: customer.email, + company_name: customer.name, + given_name: customer.firstname, + family_name: customer.lastname + } ) ) end