importers.patreon: Handle commas in large amounts.
This commit is contained in:
		
							parent
							
								
									a2120805ab
								
							
						
					
					
						commit
						4796932cb7
					
				
					 3 changed files with 6 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -8,11 +8,9 @@ class IncomeImporter(_csv.CSVImporterBase):
 | 
			
		|||
    NEEDED_FIELDS = frozenset([
 | 
			
		||||
        'FirstName',
 | 
			
		||||
        'LastName',
 | 
			
		||||
        'Pledge',
 | 
			
		||||
        'Status',
 | 
			
		||||
    ])
 | 
			
		||||
    COPIED_FIELDS = {
 | 
			
		||||
        'Pledge': 'amount',
 | 
			
		||||
    }
 | 
			
		||||
    ENTRY_SEED = {
 | 
			
		||||
        'currency': 'USD',
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -30,6 +28,7 @@ class IncomeImporter(_csv.CSVImporterBase):
 | 
			
		|||
            return None
 | 
			
		||||
        else:
 | 
			
		||||
            return {
 | 
			
		||||
                'amount': row['Pledge'].replace(',', ''),
 | 
			
		||||
                'payee': '{0[FirstName]} {0[LastName]}'.format(row),
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
FirstName,LastName,Email,Pledge,Lifetime,Status,Twitter,Street,City,State,Zip,Country,Start,MaxAmount,Complete
 | 
			
		||||
100 + Reward,Description You donate a lot of money!,,,,,,,,,,,,,
 | 
			
		||||
Alex,Jones,alex@example.org,150,300,Processed,,,,,,,2017-08-11 11:28:06.166065,200,0
 | 
			
		||||
Alex,Jones,alex@example.org,"1,500.00","3,000.00",Processed,,,,,,,2017-08-11 11:28:06.166065,"2,000.00",0
 | 
			
		||||
5 + Reward,Description You’re nice!,,,,,,,,,,,,,
 | 
			
		||||
Brett,Smith,brett@example.org,10,30,Declined,Brett20XX,,,,,,2017-08-10 13:24:15.955782,10,0
 | 
			
		||||
Dakota,Doe,ddoe@example.org,12,48,Processed,,,,,,,2017-08-10 12:58:31.919341,12,0
 | 
			
		||||
Brett,Smith,brett@example.org,10.00,30.00,Declined,Brett20XX,,,,,,2017-08-10 13:24:15.955782,10.00,0
 | 
			
		||||
Dakota,Doe,ddoe@example.org,12.00,48.00,Processed,,,,,,,2017-08-10 12:58:31.919341,12.00,0
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		
		
			
  | 
| 
						 | 
				
			
			@ -3,7 +3,7 @@
 | 
			
		|||
  expect:
 | 
			
		||||
    - payee: Alex Jones
 | 
			
		||||
      date: !!python/object/apply:datetime.date [2017, 9, 1]
 | 
			
		||||
      amount: !!python/object/apply:decimal.Decimal ["150.00"]
 | 
			
		||||
      amount: !!python/object/apply:decimal.Decimal ["1500.00"]
 | 
			
		||||
      currency: USD
 | 
			
		||||
    - payee: Dakota Doe
 | 
			
		||||
      date: !!python/object/apply:datetime.date [2017, 9, 1]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue