ms-salesforce-api 2.24.0.dev6__py3-none-any.whl → 3.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,6 +23,8 @@ SELECT
23
23
  FiscalQuarter,
24
24
  FiscalYear,
25
25
  FORMAT(convertCurrency(Amount)) convertAmount,
26
+ LKP_AccountManager__R.Name,
27
+ LKP_AccountManager__R.MAIL_Email__c,
26
28
  FRM_GoogleDriveLink__c,
27
29
  FRM_JiraDefaultName__c,
28
30
  FRM_ProjectCode__c,
@@ -204,7 +204,7 @@ class OpportunityDTO(object):
204
204
  created_by,
205
205
  last_modified_by,
206
206
  finance_contact,
207
- convertAmount,
207
+ converted_amount_eur,
208
208
  project_code,
209
209
  google_drive_link,
210
210
  project_status,
@@ -286,7 +286,7 @@ class OpportunityDTO(object):
286
286
  self.created_by = created_by
287
287
  self.last_modified_by = last_modified_by
288
288
  self.finance_contact = finance_contact
289
- self.convertAmount = convertAmount
289
+ self.converted_amount_eur = converted_amount_eur
290
290
  self.project_code = project_code
291
291
  self.google_drive_link = google_drive_link
292
292
  self.project_status = project_status
@@ -380,6 +380,16 @@ class OpportunityDTO(object):
380
380
  except (KeyError, TypeError):
381
381
  return ""
382
382
 
383
+ def _get_convert_amount():
384
+ try:
385
+ value = record["convertAmount"]
386
+ clean_value = value.replace("EUR", "")
387
+ clean_value = clean_value.replace(",", "")
388
+
389
+ return float(clean_value)
390
+ except (KeyError, TypeError, ValueError):
391
+ return None
392
+
383
393
  opportunity_line_items = record.get("OpportunityLineItems", {})
384
394
  if opportunity_line_items and isinstance(opportunity_line_items, dict):
385
395
  line_items_records = record.get("OpportunityLineItems", {}).get(
@@ -509,7 +519,7 @@ class OpportunityDTO(object):
509
519
  created_by=_get_created_by(),
510
520
  last_modified_by=_get_last_modified_by(),
511
521
  finance_contact=record["MAIL_FinanceContact__c"],
512
- convertAmount=record["convertAmount"],
522
+ converted_amount_eur=_get_convert_amount(),
513
523
  project_code=record["FRM_ProjectCode__c"],
514
524
  google_drive_link=record["FRM_GoogleDriveLink__c"],
515
525
  project_status=record["PCK_ProjectStatus__c"],
@@ -594,7 +604,7 @@ class OpportunityDTO(object):
594
604
  "created_by": self.created_by,
595
605
  "last_modified_by": self.last_modified_by,
596
606
  "finance_contact": self.finance_contact,
597
- "convertAmount": self.convertAmount,
607
+ "converted_amount_eur": self.converted_amount_eur,
598
608
  "project_code": self.project_code,
599
609
  "google_drive_link": self.google_drive_link,
600
610
  "project_status": self.project_status,
@@ -97,12 +97,12 @@ class BigQueryExporter:
97
97
  "created_by": "STRING",
98
98
  "last_modified_by": "STRING",
99
99
  "finance_contact": "STRING",
100
- "convertAmount": "STRING",
100
+ "converted_amount_eur": "FLOAT",
101
101
  "project_code": "STRING",
102
102
  "google_drive_link": "STRING",
103
103
  "project_status": "STRING",
104
104
  "pck_division": "STRING",
105
- "out_of_report": "STRING",
105
+ "out_of_report": "BOOLEAN",
106
106
  "billing_info": "STRING",
107
107
  "parent_opportunity": "STRING",
108
108
  },
@@ -382,154 +382,152 @@ class TestProject(unittest.TestCase):
382
382
  self.assertEqual(len(opportunities), 1)
383
383
 
384
384
  opportunity = opportunities[0]
385
-
385
+ opportunity_result = {
386
+ "account_assigment_group": "03",
387
+ "account_billing_address": "211 Main Street, Webster, Maine, 01570, United "
388
+ "States",
389
+ "account_billing_city": "Webster",
390
+ "account_billing_country": "US",
391
+ "account_billing_postal_code": "01570",
392
+ "account_billing_state_code": "ME",
393
+ "account_billing_street": "211 Main Street",
394
+ "account_business_function": "BP03",
395
+ "account_business_name": "THE COMMERCE INSURANCE COMPANY",
396
+ "account_cif": "042495247",
397
+ "account_company_invoicing": "",
398
+ "account_created_date": "2020-03-18 15:32:15",
399
+ "account_currency_code": "EUR",
400
+ "account_customer_groupId": "1",
401
+ "account_customer_subgroupId": "5",
402
+ "account_fax": None,
403
+ "account_invoicing_email": "client1@test.com",
404
+ "account_mail_invoicing": "client1@test.com",
405
+ "account_name": "MAPFRE USA",
406
+ "account_office": "Making Science LLC",
407
+ "account_payment_terms": "T060",
408
+ "account_pec_email": None,
409
+ "account_phone": None,
410
+ "account_sap_id": "10000319",
411
+ "account_tax_category": None,
412
+ "account_tax_classification": "0",
413
+ "account_tax_id_type": "US01",
414
+ "account_tier": "T1",
415
+ "account_website": None,
416
+ "amount": 0.0,
417
+ "autorenewal": False,
418
+ "billing_lines": [
419
+ {
420
+ "billing_amount": 6708.0,
421
+ "billing_date": "2022-08-31",
422
+ "billing_period_ending_date": "2022-08-31",
423
+ "billing_period_starting_date": "2022-08-01",
424
+ "billing_plan_amount": "6708",
425
+ "billing_plan_billing_date": "2022-08-31",
426
+ "billing_plan_item": "1",
427
+ "billing_plan_service_end_date": "2022-08-31",
428
+ "billing_plan_service_start_date": "2022-08-01",
429
+ "created_date": "2022-08-09 14:56:23",
430
+ "currency": "USD",
431
+ "hourly_price": 65.0,
432
+ "id": "a0sAX000000I8lgYAC",
433
+ "last_modified_date": "2022-10-16 18:56:34",
434
+ "name": "BL-000175313",
435
+ "project_code": "",
436
+ "project_id": "a00AX000002DVi1YAG",
437
+ "revenue_dedication": 103.2,
438
+ }
439
+ ],
440
+ "comments": "",
441
+ "controller_email": "employee4@test.com",
442
+ "controller_sub_email": "employee3@test.com",
443
+ "cost_center": "",
444
+ "created_at": "2022-08-01 08:53:12",
445
+ "currency": "EUR",
446
+ "end_date": "",
447
+ "group_bqid": "1",
448
+ "group_end_date": "2100-12-12",
449
+ "group_groupid": "a0cAX000000TSWUYA4",
450
+ "group_name": "MAPFRE",
451
+ "group_owner_email": "employee1@test.com",
452
+ "group_pck_type": "Key Account",
453
+ "group_start_date": "2023-06-01",
454
+ "group_supervisor_email": "employee2@test.com",
455
+ "international_deparments": False,
456
+ "invoicing_country_code": "US",
457
+ "jira_task_url": "<a "
458
+ "href=https://makingscience.atlassian.net/browse/ESMSBD0001-7168 "
459
+ "target=_blank>View Jira Task</a>",
460
+ "last_updated_at": "2023-09-01 10:00:54",
461
+ "maintance_project": False,
462
+ "ms_project_id": False,
463
+ "operation_coordinator_email": "employee5@test.com",
464
+ "operation_coordinator_name": "",
465
+ "operation_coordinator_sub": "",
466
+ "operation_coordinator_sub_email": "employee5@test.com",
467
+ "opportunity": "",
468
+ "opportunity_extension": "",
469
+ "opportunity_name": "New Site Mapfre AAA",
470
+ "opportunity_project_code": "",
471
+ "periodicity": "",
472
+ "profit_center": "200018",
473
+ "profitcenter": "",
474
+ "project_account": "",
475
+ "project_id": "a00AX000002DVi1YAG",
476
+ "project_line_items": [
477
+ {
478
+ "country": None,
479
+ "created_date": "2022-08-02 15:44:34",
480
+ "effort": "516",
481
+ "ending_date": "2022-12-31",
482
+ "id": "a0VAX000000EE0b2AG",
483
+ "last_modified_date": "2023-06-20 22:33:36",
484
+ "ms_pli_name": "USA_UX/UI Design_USMSEX05508",
485
+ "opportunity_project_code": None,
486
+ "product_name": "UXUI Project",
487
+ "project_id": "a00AX000002DVi1YAG",
488
+ "quantity": 516.0,
489
+ "starting_date": "2022-08-01",
490
+ "total_price": 33540.0,
491
+ "unit_price": 65.0,
492
+ },
493
+ {
494
+ "country": None,
495
+ "created_date": "2022-08-09 14:54:59",
496
+ "effort": "331",
497
+ "ending_date": "2022-12-31",
498
+ "id": "a0VAX000000ELU52AO",
499
+ "last_modified_date": "2023-06-20 22:33:36",
500
+ "ms_pli_name": "ES_UX/UI Design_USMSEX05508",
501
+ "opportunity_project_code": None,
502
+ "product_name": "UXUI Project",
503
+ "project_id": "a00AX000002DVi1YAG",
504
+ "quantity": 331.0,
505
+ "starting_date": "2022-08-01",
506
+ "total_price": 21515.0,
507
+ "unit_price": 65.0,
508
+ },
509
+ ],
510
+ "project_name": "MapfreAAA",
511
+ "project_start_date": "2022-08-01",
512
+ "project_tier": "Unkown",
513
+ "projectcode": "",
514
+ "quote": "",
515
+ "revenue_details": "",
516
+ "status": "",
517
+ "subgroup_bqid": "5",
518
+ "subgroup_end_date": "2100-12-12",
519
+ "subgroup_groupid": "a0cAX000000TSWUYA4",
520
+ "subgroup_name": "MAPFRE USA",
521
+ "subgroup_owner_email": "employee1@test.com",
522
+ "subgroup_start_date": "2023-06-01",
523
+ "subgroup_subgroupid": "a19AX0000004simYAA",
524
+ }
386
525
  self.assertIsInstance(opportunity, dict)
387
526
 
388
527
  self.assertDictEqual(
389
528
  opportunity,
390
- {
391
- "account_assigment_group": "03",
392
- "account_billing_address": "211 Main Street, Webster, Maine, 01570, United "
393
- "States",
394
- "account_billing_city": "Webster",
395
- "account_billing_country": "US",
396
- "account_billing_postal_code": "01570",
397
- "account_billing_state_code": "ME",
398
- "account_billing_street": "211 Main Street",
399
- "account_business_function": "BP03",
400
- "account_business_name": "THE COMMERCE INSURANCE COMPANY",
401
- "account_cif": "042495247",
402
- "account_company_invoicing": "",
403
- "account_created_date": "2020-03-18 15:32:15",
404
- "account_currency_code": "EUR",
405
- "account_customer_groupId": "1",
406
- "account_customer_subgroupId": "5",
407
- "account_fax": None,
408
- "account_invoicing_email": "client1@test.com",
409
- "account_mail_invoicing": "client1@test.com",
410
- "account_name": "MAPFRE USA",
411
- "account_office": "Making Science LLC",
412
- "account_payment_terms": "T060",
413
- "account_pec_email": None,
414
- "account_phone": None,
415
- "account_sap_id": "10000319",
416
- "account_tax_category": None,
417
- "account_tax_classification": "0",
418
- "account_tax_id_type": "US01",
419
- "account_tier": "T1",
420
- "account_website": None,
421
- "amount": 0.0,
422
- "autorenewal": False,
423
- "billing_lines": [
424
- {
425
- "billing_amount": 6708.0,
426
- "billing_date": "2022-08-31",
427
- "billing_period_ending_date": "2022-08-31",
428
- "billing_period_starting_date": "2022-08-01",
429
- "billing_plan_amount": "6708",
430
- "billing_plan_billing_date": "2022-08-31",
431
- "billing_plan_item": "1",
432
- "billing_plan_service_end_date": "2022-08-31",
433
- "billing_plan_service_start_date": "2022-08-01",
434
- "created_date": "2022-08-09 14:56:23",
435
- "currency": "USD",
436
- "hourly_price": 65.0,
437
- "id": "a0sAX000000I8lgYAC",
438
- "last_modified_date": "2022-10-16 18:56:34",
439
- "name": "BL-000175313",
440
- "project_code": "USMSEX05508",
441
- "project_id": "a00AX000002DVi1YAG",
442
- "revenue_dedication": 103.2,
443
- }
444
- ],
445
- "comments": "",
446
- "controller_email": "employee4@test.com",
447
- "controller_sub_email": "employee3@test.com",
448
- "cost_center": "",
449
- "created_at": "2022-08-01 08:53:12",
450
- "currency": "EUR",
451
- "end_date": "",
452
- "group_bqid": "1",
453
- "group_end_date": "2100-12-12",
454
- "group_groupid": "a0cAX000000TSWUYA4",
455
- "group_name": "MAPFRE",
456
- "group_owner_email": "employee1@test.com",
457
- "group_pck_type": "Key Account",
458
- "group_start_date": "2023-06-01",
459
- "group_supervisor_email": "employee2@test.com",
460
- "international_deparments": False,
461
- "invoicing_country_code": "US",
462
- "jira_task_url": "<a "
463
- "href=https://makingscience.atlassian.net/browse/ESMSBD0001-7168 "
464
- "target=_blank>View Jira Task</a>",
465
- "last_updated_at": "2023-09-01 10:00:54",
466
- "maintance_project": False,
467
- "ms_project_id": False,
468
- "operation_coordinator_email": "employee5@test.com",
469
- "operation_coordinator_name": "",
470
- "operation_coordinator_sub": "",
471
- "operation_coordinator_sub_email": "employee5@test.com",
472
- "opportunity": "",
473
- "opportunity_extension": "",
474
- "opportunity_name": "New Site Mapfre AAA",
475
- "periodicity": "",
476
- "profit_center": "200018",
477
- "profitcenter": "",
478
- "project_account": "",
479
- "project_code": "USMSEX05508",
480
- "project_id": "a00AX000002DVi1YAG",
481
- "project_line_items": [
482
- {
483
- "country": None,
484
- "created_date": "2022-08-02 15:44:34",
485
- "effort": "516",
486
- "ending_date": "2022-12-31",
487
- "id": "a0VAX000000EE0b2AG",
488
- "last_modified_date": "2023-06-20 22:33:36",
489
- "ms_pli_name": "USA_UX/UI Design_USMSEX05508",
490
- "ms_project_code": None,
491
- "product_name": "UXUI Project",
492
- "project_id": "a00AX000002DVi1YAG",
493
- "quantity": 516.0,
494
- "starting_date": "2022-08-01",
495
- "total_price": 33540.0,
496
- "unit_price": 65.0,
497
- },
498
- {
499
- "country": None,
500
- "created_date": "2022-08-09 14:54:59",
501
- "effort": "331",
502
- "ending_date": "2022-12-31",
503
- "id": "a0VAX000000ELU52AO",
504
- "last_modified_date": "2023-06-20 22:33:36",
505
- "ms_pli_name": "ES_UX/UI Design_USMSEX05508",
506
- "ms_project_code": None,
507
- "product_name": "UXUI Project",
508
- "project_id": "a00AX000002DVi1YAG",
509
- "quantity": 331.0,
510
- "starting_date": "2022-08-01",
511
- "total_price": 21515.0,
512
- "unit_price": 65.0,
513
- },
514
- ],
515
- "project_name": "MapfreAAA",
516
- "project_start_date": "2022-08-01",
517
- "project_tier": "Unkown",
518
- "projectcode": "",
519
- "projectid": "",
520
- "quote": "",
521
- "revenue_details": "",
522
- "status": "",
523
- "subgroup_bqid": "5",
524
- "subgroup_end_date": "2100-12-12",
525
- "subgroup_groupid": "a0cAX000000TSWUYA4",
526
- "subgroup_name": "MAPFRE USA",
527
- "subgroup_owner_email": "employee1@test.com",
528
- "subgroup_start_date": "2023-06-01",
529
- "subgroup_subgroupid": "a19AX0000004simYAA",
530
- },
529
+ opportunity_result,
531
530
  )
532
-
533
531
  billing_line = opportunity["billing_lines"][0]
534
532
  self.assertDictEqual(
535
533
  billing_line,
@@ -549,7 +547,7 @@ class TestProject(unittest.TestCase):
549
547
  "id": "a0sAX000000I8lgYAC",
550
548
  "last_modified_date": "2022-10-16 18:56:34",
551
549
  "name": "BL-000175313",
552
- "project_code": "USMSEX05508",
550
+ "project_code": "",
553
551
  "project_id": "a00AX000002DVi1YAG",
554
552
  "revenue_dedication": 103.2,
555
553
  },
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: ms-salesforce-api
3
- Version: 2.24.0.dev6
3
+ Version: 3.0.1
4
4
  Summary: Python library used to extract data from Salesforce API and migrate it to Bigquery and Postgres.
5
5
  Author: Making Science
6
6
  Requires-Python: >=3.8.1,<4.0.0
@@ -27,10 +27,10 @@ ms_salesforce_api/salesforce/api/lead/dto/__init__.py,sha256=47DEQpj8HBSa-_TImW-
27
27
  ms_salesforce_api/salesforce/api/lead/export_data/Bigquery.py,sha256=rym4GJCr-8dhzZZBtmh03wD8rzgRy5AptIJ5cI9zZqY,3789
28
28
  ms_salesforce_api/salesforce/api/lead/export_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
29
  ms_salesforce_api/salesforce/api/opportunity/__init__.py,sha256=mPITW67LvqsuLBP1Mv4YCYkrKv_LiUP58PhmmojYEi0,1386
30
- ms_salesforce_api/salesforce/api/opportunity/constants.py,sha256=PvOK_Y0geTgoUB5_-kHxWxhwTfXNxDsUoMCWAj_zOVM,5815
31
- ms_salesforce_api/salesforce/api/opportunity/dto/OpportunityDTO.py,sha256=8fnthVqxIvWTSXdMt9cpNdSb_QcwuvH7u48V6hBiEbI,24465
30
+ ms_salesforce_api/salesforce/api/opportunity/constants.py,sha256=swM1lnSX5DOCFjBNkPshYqZlthFYhzgNXjAA2C_pg-E,5888
31
+ ms_salesforce_api/salesforce/api/opportunity/dto/OpportunityDTO.py,sha256=qbY4V8TktBr07Ks0k_wyXQqzUtYMHFhYKn3VdesiGfU,24845
32
32
  ms_salesforce_api/salesforce/api/opportunity/dto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
- ms_salesforce_api/salesforce/api/opportunity/export_data/Bigquery.py,sha256=NBeDf-6l_KqzdNbLpGAv4TbuKN5mTMR4zH0DjjPxNss,6887
33
+ ms_salesforce_api/salesforce/api/opportunity/export_data/Bigquery.py,sha256=ALllOqxzJU1JO0IjsmHukg1NeCpOhPMZdKyeD4GzNxc,6894
34
34
  ms_salesforce_api/salesforce/api/opportunity/export_data/CloudSQL.py,sha256=MbheXQhG9bwbW2FIA5onCum8CoDdl4eMIpUEUqCR3fE,6011
35
35
  ms_salesforce_api/salesforce/api/opportunity/export_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
36
  ms_salesforce_api/salesforce/api/opportunity/export_data/__tests__/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -66,7 +66,7 @@ ms_salesforce_api/salesforce/api/profit_center/export_data/Bigquery.py,sha256=Sb
66
66
  ms_salesforce_api/salesforce/api/profit_center/export_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
67
67
  ms_salesforce_api/salesforce/api/project/__init__.py,sha256=kCskD1tfKFNFo-vIRyo1YmFAqsL0rdgW2_WDCZL7fNY,3355
68
68
  ms_salesforce_api/salesforce/api/project/__tests__/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
69
- ms_salesforce_api/salesforce/api/project/__tests__/test_Project.py,sha256=mGSoCjfSV6XXreDF-zbk7r5vmOZfmuDfyIaBVONZ9rI,24746
69
+ ms_salesforce_api/salesforce/api/project/__tests__/test_Project.py,sha256=IFA51Q3nt7sM-28sA0YZHLs7eSQtH3pHPyHNnQB9lCI,24200
70
70
  ms_salesforce_api/salesforce/api/project/constants.py,sha256=C1MaKBZBFi97HHdnTFYBqraN2eA1DwIHhOKMfNliuuM,10907
71
71
  ms_salesforce_api/salesforce/api/project/dto/BillingLineDTO.py,sha256=ELNGoBHwy7HdVL84zTfE7EMni02RPIJ33YHRzkz-c40,4357
72
72
  ms_salesforce_api/salesforce/api/project/dto/OpportunityDTO.py,sha256=VDXO-RAxS3JQnfzJZEM3fQ61h6HptxUJFgYDw1Q_zWo,36279
@@ -79,7 +79,7 @@ ms_salesforce_api/salesforce/api/project/export_data/__tests__/__init__.py,sha25
79
79
  ms_salesforce_api/salesforce/api/project/export_data/__tests__/test_CloudSQL.py,sha256=Cn6eixLYMlAxTStG90zEvmLOYfgt3D2BSmPSUL2WKGA,13717
80
80
  ms_salesforce_api/salesforce/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
81
81
  ms_salesforce_api/salesforce/helpers/string.py,sha256=wRtMU_EFIihbZCyR_wPdQpLanPk2ejlddmiWyNwfi1Q,303
82
- ms_salesforce_api-2.24.0.dev6.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
83
- ms_salesforce_api-2.24.0.dev6.dist-info/METADATA,sha256=9-2uOGsUNx2bjPsiNP02R5oRmPwB0z8HgmdzgLB_Rmc,9210
84
- ms_salesforce_api-2.24.0.dev6.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
85
- ms_salesforce_api-2.24.0.dev6.dist-info/RECORD,,
82
+ ms_salesforce_api-3.0.1.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
83
+ ms_salesforce_api-3.0.1.dist-info/METADATA,sha256=t3ICS79ppaJ2ggFc709w4FeP4yAAkRIMV2aph9Hr1nU,9204
84
+ ms_salesforce_api-3.0.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
85
+ ms_salesforce_api-3.0.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.1
2
+ Generator: poetry-core 2.1.3
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any