|
| 1 | +package issues |
| 2 | + |
| 3 | +import ( |
| 4 | + "testing" |
| 5 | + |
| 6 | + "github.com/moov-io/ach" |
| 7 | +) |
| 8 | + |
| 9 | +func TestIssue1735_ValidateOptsNotPropagated(t *testing.T) { |
| 10 | +// Test that ValidateOpts are propagated when creating a file from JSON. |
| 11 | + jsonData := []byte(`{ |
| 12 | + "fileHeader": { |
| 13 | + "immediateOrigin": "022083649", |
| 14 | + "immediateDestination": "011000015", |
| 15 | + "fileCreationDate": "260120", |
| 16 | + "fileCreationTime": "1030", |
| 17 | + "fileIDModifier": "A" |
| 18 | + }, |
| 19 | + "batches": [{ |
| 20 | + "batchHeader": { |
| 21 | + "serviceClassCode": 220, |
| 22 | + "companyName": "Test Company ©", |
| 23 | + "companyIdentification": "54321", |
| 24 | + "standardEntryClassCode": "WEB", |
| 25 | + "companyEntryDescription": "Payment", |
| 26 | + "effectiveEntryDate": "260127", |
| 27 | + "originatorStatusCode": 1, |
| 28 | + "ODFIIdentification": "123456780", |
| 29 | + "batchNumber": 1 |
| 30 | + }, |
| 31 | + "entryDetails": [{ |
| 32 | + "transactionCode": 21, |
| 33 | + "RDFIIdentification": "98765432", |
| 34 | + "checkDigit": "0", |
| 35 | + "DFIAccountNumber": "665544", |
| 36 | + "amount": 111111, |
| 37 | + "identificationNumber": "Test", |
| 38 | + "individualName": "John Doe", |
| 39 | + "traceNumber": "12345678123456" |
| 40 | + }] |
| 41 | + }] |
| 42 | + }`) |
| 43 | + |
| 44 | + // Create ValidateOpts with AllowSpecialCharacters |
| 45 | + validateOpts := &ach.ValidateOpts{ |
| 46 | + AllowSpecialCharacters: true, |
| 47 | + } |
| 48 | + |
| 49 | + // This should succeed but fails |
| 50 | + _, err := ach.FileFromJSONWith(jsonData, validateOpts) |
| 51 | + if err != nil { |
| 52 | + t.Fatalf("Expected success, got error: %v", err) |
| 53 | + } |
| 54 | +} |
0 commit comments