Skip to content

Commit e98989f

Browse files
authored
feat: DAH-3315 send listingType and leasingAgent for email (#2630)
* feat: DAH-3315 send listingType and leasingAgent for email * test: DAH-3315 update tests * DAH-3315 use Office_Hours
1 parent beca70e commit e98989f

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

app/services/dahlia_backend/api_client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def http_client
2727
end
2828

2929
def post(endpoint, params)
30-
response = http_client.post("#{api_url}#{endpoint}", params: params)
30+
response = http_client.post("#{api_url}#{endpoint}", json: params)
3131

3232
if response.code >= 400
3333
log_error("POST request failed: #{response.code} #{response.body}", nil)

app/services/dahlia_backend/message_service.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,14 @@ def prepare_submission_fields(application_params, application_response)
5959
listingId: listing_id,
6060
lotteryNumber: application_response&.[]('lotteryNumber').to_s,
6161
listingName: listing.Name.to_s,
62+
isRental: listing.RecordType.Name == 'Rental',
6263
lotteryDate: formatted_date,
64+
leasingAgent: {
65+
name: listing.Leasing_Agent_Name.to_s,
66+
email: listing.Leasing_Agent_Email.to_s,
67+
phone: listing.Leasing_Agent_Phone.to_s,
68+
officeHours: listing.Office_Hours.to_s,
69+
},
6370
}
6471
end
6572

spec/services/dahlia_backend/message_service_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
let(:client) { instance_double(DahliaBackend::ApiClient) }
55
let(:listing_id) { 'listing-123' }
66
let(:listing) do
7-
double('Listing', Name: 'Test Listing', Lottery_Date: '2024-07-01T00:00:00Z')
7+
double('Listing', Name: 'Test Listing', Lottery_Date: '2024-07-01T00:00:00Z',
8+
RecordType: Hashie::Mash.new(Name: 'Rental'),
9+
Leasing_Agent_Name: 'John Doe', Leasing_Agent_Email: 'email', Leasing_Agent_Phone: '123-456-7890', Office_Hours: '9am-5pm')
810
end
911
let(:application_params) do
1012
{

0 commit comments

Comments
 (0)