Skip to content

Commit

Permalink
Fix: Handling country name safely in Payment profiles (TP) (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shwetabhk authored Apr 16, 2024
1 parent f72451e commit f73e5fa
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/travelperk/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,15 @@ def sync_invoice_profile(self):

response = self.connection.invoice_profiles.get_all()
for invoice_profile in response:
country_name = invoice_profile['billing_information']['country_name'] if 'country_name' in invoice_profile['billing_information'] else None
currency = invoice_profile['currency'] if 'currency' in invoice_profile else None
TravelperkProfileMapping.objects.update_or_create(
org_id=self.org_id,
profile_name=invoice_profile['name'],
source_id=invoice_profile['id'],
defaults={
'country': invoice_profile['billing_information']['country_name'],
'currency': invoice_profile['currency'],
'country': country_name,
'currency': currency,
}
)

Expand Down

0 comments on commit f73e5fa

Please sign in to comment.