Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Api 42872 coutry to coutrycode poa v2 #19650

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ def validate_address
collect_error_messages(
source: '/claimant/address/',
detail: "If claimant is present 'address' must be filled in " \
' with required fields addressLine1, city, stateCode, country and zipCode'
'with required fields addressLine1, city, stateCode, countryCode and zipCode'
)
else
validate_address_line_one(address)
validate_address_city(address)
validate_address_state_code(address)
validate_address_country(address)
validate_address_country_code(address)
validate_address_zip_code(address)
end
end
Expand Down Expand Up @@ -116,11 +116,11 @@ def validate_address_state_code(address)
end
end

def validate_address_country(address)
if address['country'].nil?
def validate_address_country_code(address)
if address['countryCode'].nil?
collect_error_messages(
source: '/claimant/address/country',
detail: "If claimant is present 'country' must be filled in"
source: '/claimant/address/countryCode',
detail: "If claimant is present 'countryCode' must be filled in"
)
end
end
Expand Down
132 changes: 71 additions & 61 deletions modules/claims_api/app/swagger/claims_api/v2/dev/swagger.json

Large diffs are not rendered by default.

132 changes: 71 additions & 61 deletions modules/claims_api/app/swagger/claims_api/v2/production/swagger.json

Large diffs are not rendered by default.

21 changes: 13 additions & 8 deletions modules/claims_api/config/schemas/v2/2122.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"required": [
"addressLine1",
"city",
"country",
"countryCode",
"stateCode",
"zipCode"
],
Expand All @@ -48,10 +48,11 @@
"pattern": "^[a-z,A-Z]{2}$",
"example": "OR"
},
"country": {
"description": "Country of the address.",
"countryCode": {
"description": "Country code of the address.",
"type": "string",
"example": "USA"
"pattern": "^[a-z,A-Z]{2}$",
"example": "US"
},
"zipCode": {
"description": "Zipcode (First 5 digits) of the address.",
Expand Down Expand Up @@ -148,10 +149,11 @@
"pattern": "^[a-z,A-Z]{2}$",
"example": "OR"
},
"country": {
"description": "Country of the address. Required if claimant information provided.",
"countryCode": {
"description": "Country code of the address. Required if claimant information provided.",
"type": "string",
"example": "USA"
"pattern": "^[a-z,A-Z]{2}$",
"example": "US"
},
"zipCode": {
"description": "Zipcode (First 5 digits) of the address. Required if claimant information provided.",
Expand All @@ -177,7 +179,10 @@
"phoneNumber"
],
"properties": {
"countryCode": { "type": "string", "pattern": "^[0-9]+$" },
"countryCode": {
"type": "string",
"pattern": "^[0-9]+$"
},
"areaCode": {
"description": "Area code of the phone number.",
"type": "string", "pattern": "^[2-9][0-9]{2}$",
Expand Down
34 changes: 22 additions & 12 deletions modules/claims_api/config/schemas/v2/2122a.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"addressLine1",
"city",
"stateCode",
"country",
"countryCode",
"zipCode"
],
"properties" : {
Expand All @@ -73,10 +73,11 @@
"pattern": "^[a-z,A-Z]{2}$",
"example": "OR"
},
"country": {
"description": "Country of the address.",
"countryCode": {
"description": "Country code of the address.",
"type": "string",
"example": "USA"
"pattern": "^[a-z,A-Z]{2}$",
"example": "US"
},
"zipCode": {
"description": "Zipcode (First 5 digits) of the address.",
Expand All @@ -101,7 +102,10 @@
"phoneNumber"
],
"properties": {
"countryCode": { "type": "string", "pattern": "^[0-9]+$" },
"countryCode": {
"type": "string",
"pattern": "^[0-9]+$"
},
"areaCode": {
"description": "Area code of the phone number.",
"type": "string", "pattern": "^[2-9][0-9]{2}$",
Expand Down Expand Up @@ -159,9 +163,10 @@
"pattern": "^[a-z,A-Z]{2}$",
"example": "OR"
},
"country": {
"description": "Country of the address. Required if claimant information provided.",
"countryCode": {
"description": "Country code of the address. Required if claimant information provided.",
"type": "string",
"pattern": "^[a-z,A-Z]{2}$",
"example": "USA"
},
"zipCode": {
Expand All @@ -187,15 +192,19 @@
"phoneNumber"
],
"properties": {
"countryCode": { "type": "string", "pattern": "^[0-9]+$" },
"countryCode": {
"type": "string",
"pattern": "^[0-9]+$"
},
"areaCode": {
"description": "Area code of the phone number.",
"type": "string", "pattern": "^[2-9][0-9]{2}$",
"example": "555"
},
"phoneNumber": {
"description": "Phone number.",
"type": "string", "pattern": "^[0-9]{1,14}$",
"type": "string",
"pattern": "^[0-9]{1,14}$",
"example": "555-5555"
},
"phoneNumberExt": { "type": "string", "pattern": "^[a-zA-Z0-9]{1,10}$" }
Expand Down Expand Up @@ -270,10 +279,11 @@
"pattern": "^[a-z,A-Z]{2}$",
"example": "OR"
},
"country": {
"description": "Country of the address.",
"countryCode": {
"description": "Country code of the address.",
"type": "string",
"example": "USA"
"pattern": "^[a-z,A-Z]{2}$",
"example": "US"
},
"zipCode": {
"description": "Zipcode (First 5 digits) of the address.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"addressLine1": "123",
"city": "city",
"stateCode": "OR",
"country": "US",
"countryCode": "US",
"zipCode": "12345"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"addressLine1": "123",
"city": "city",
"stateCode": "OR",
"country": "US",
"countryCode": "US",
"zipCode": "12345"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"addressLine1": "123",
"city": "city",
"stateCode": "OR",
"country": "US",
"countryCode": "US",
"zipCode": "12345"
}
},
Expand All @@ -17,7 +17,7 @@
"address": {
"addressLine1": "123",
"city": "city",
"country": "US",
"countryCode": "US",
"zipCode": "12345"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"address": {
"addressLine1": "123",
"city": "city",
"country": "US",
"countryCode": "US",
"zipCode": "12345"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"addressLine1": "123",
"addressLine2": "2a",
"city": "city",
"country": "US",
"countryCode": "US",
"stateCode":"OR",
"zipCode": "12345",
"zipCodeSuffix":"6789"
Expand All @@ -20,7 +20,7 @@
"addressLine1": "123",
"addressLine2": "2a",
"city": "city",
"country": "US",
"countryCode": "US",
"stateCode":"OR",
"zipCode": "12345",
"zipCodeSuffix":"6789"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
addressLine1: '123',
city: 'city',
stateCode: 'OR',
country: 'US',
countryCode: 'US',
zipCode: '12345'
}
},
Expand Down Expand Up @@ -88,7 +88,7 @@
addressLine1: '123 anystreet',
city: 'anytown',
stateCode: 'OR',
country: 'USA',
countryCode: 'US',
zipCode: '12345'
},
relationship: 'Child'
Expand Down Expand Up @@ -620,7 +620,7 @@
addressLine1: '2688 S Camino Real',
city: 'Palm Springs',
stateCode: 'CA',
country: 'US',
countryCode: 'US',
zipCode: '92264'
},
phone: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
addressLine1: '123',
city: 'city',
stateCode: 'OR',
country: 'US',
countryCode: 'US',
zipCode: '12345'
}
},
Expand All @@ -44,7 +44,7 @@
address: {
addressLine1: '123',
city: 'city',
country: 'US',
countryCode: 'US',
zipCode: '12345'
}
}
Expand All @@ -62,7 +62,7 @@
addressLine1: '123',
city: 'city',
stateCode: 'OR',
country: 'US',
countryCode: 'US',
zipCode: '12345'
}
},
Expand All @@ -74,7 +74,7 @@
addressLine1: '123',
city: 'city',
stateCode: 'OR',
country: 'US',
countryCode: 'US',
zipCode: '12345'
}
},
Expand All @@ -84,7 +84,7 @@
addressLine1: '123',
city: 'city',
stateCode: 'OR',
country: 'US',
countryCode: 'US',
zipCode: '12345'
},
relationship: 'spouse'
Expand Down Expand Up @@ -147,7 +147,7 @@
addressLine1: '123 anystreet',
city: 'anytown',
stateCode: 'OR',
country: 'USA',
countryCode: 'US',
zipCode: '12345'
},
relationship: 'Child'
Expand Down Expand Up @@ -319,16 +319,16 @@
end
end

it 'returns a 422 if claimant.address.country is not provided' do
it 'returns a 422 if claimant.address.countryCode is not provided' do
mock_ccg(scopes) do |auth_header|
claimant_data[:data][:attributes][:claimant][:address][:country] = nil
claimant_data[:data][:attributes][:claimant][:address][:countryCode] = nil
VCR.use_cassette('claims_api/mpi/find_candidate/valid_icn_full') do
post appoint_individual_path, params: claimant_data.to_json, headers: auth_header
end
expect(response).to have_http_status(:unprocessable_entity)
response_body = JSON.parse(response.body)
expect(response_body['errors'][0]['detail']).to eq(
"If claimant is present 'country' must be filled in"
"If claimant is present 'countryCode' must be filled in"
)
end
end
Expand Down Expand Up @@ -411,7 +411,7 @@
address: {
addressLine1: '123',
city: 'city',
country: 'US',
countryCode: 'US',
zipCode: '12345'
}
},
Expand All @@ -421,7 +421,7 @@
address: {
addressLine1: '123',
city: 'city',
country: 'US',
countryCode: 'US',
zipCode: '12345'
}
}
Expand Down Expand Up @@ -737,7 +737,7 @@
addressLine1: '2688 S Camino Real',
city: 'Palm Springs',
stateCode: 'CA',
country: 'US',
countryCode: 'US',
zipCode: '92264'
},
phone: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@
it 'returns a meaningful 422' do
VCR.use_cassette('claims_api/mpi/find_candidate/valid_icn_full') do
mock_ccg(scopes) do |auth_header|
detail = "If claimant is present 'address' must be filled in with required fields addressLine1, " \
'city, stateCode, country and zipCode'
detail = "If claimant is present 'address' must be filled in with required fields addressLine1, " \
'city, stateCode, countryCode and zipCode'

post request_path, params: request_body, headers: auth_header

Expand Down
Loading
Loading