@@ -55,29 +55,29 @@ |
||
55 | 55 | protected static function addFromArray(array $array, StatementOfAccount $statementOfAccount) |
56 | 56 | { |
57 | 57 | foreach ($array as $statement) { |
58 | - $statementModel = new Statement(); |
|
59 | - $statementModel->setDate(new \DateTime($statement['date'])); |
|
60 | - $statementModel->setStartBalance((float) $statement['start_balance']['amount']); |
|
61 | - $statementModel->setCreditDebit($statement['start_balance']['credit_debit']); |
|
62 | - $statementOfAccount->addStatement($statementModel); |
|
58 | + $statementModel = new Statement(); |
|
59 | + $statementModel->setDate(new \DateTime($statement['date'])); |
|
60 | + $statementModel->setStartBalance((float) $statement['start_balance']['amount']); |
|
61 | + $statementModel->setCreditDebit($statement['start_balance']['credit_debit']); |
|
62 | + $statementOfAccount->addStatement($statementModel); |
|
63 | 63 | |
64 | - foreach ($statement['transactions'] as $trx) { |
|
65 | - $transaction = new Transaction(); |
|
66 | - $transaction->setBookingDate(new \DateTime($trx['booking_date'])); |
|
67 | - $transaction->setValutaDate(new \DateTime($trx['valuta_date'])); |
|
68 | - $transaction->setCreditDebit($trx['credit_debit']); |
|
69 | - $transaction->setAmount($trx['amount']); |
|
70 | - $transaction->setTransactionCode($trx['transaction_code']); |
|
71 | - $transaction->setBookingText($trx['description']['booking_text']); |
|
72 | - $transaction->setDescription1($trx['description']['description_1']); |
|
73 | - $transaction->setDescription2($trx['description']['description_2']); |
|
74 | - $transaction->setStructuredDescription($trx['description']['description']); |
|
75 | - $transaction->setBankCode($trx['description']['bank_code']); |
|
76 | - $transaction->setAccountNumber($trx['description']['account_number']); |
|
77 | - $transaction->setName($trx['description']['name']); |
|
78 | - $statementModel->addTransaction($transaction); |
|
79 | - } |
|
80 | - } |
|
64 | + foreach ($statement['transactions'] as $trx) { |
|
65 | + $transaction = new Transaction(); |
|
66 | + $transaction->setBookingDate(new \DateTime($trx['booking_date'])); |
|
67 | + $transaction->setValutaDate(new \DateTime($trx['valuta_date'])); |
|
68 | + $transaction->setCreditDebit($trx['credit_debit']); |
|
69 | + $transaction->setAmount($trx['amount']); |
|
70 | + $transaction->setTransactionCode($trx['transaction_code']); |
|
71 | + $transaction->setBookingText($trx['description']['booking_text']); |
|
72 | + $transaction->setDescription1($trx['description']['description_1']); |
|
73 | + $transaction->setDescription2($trx['description']['description_2']); |
|
74 | + $transaction->setStructuredDescription($trx['description']['description']); |
|
75 | + $transaction->setBankCode($trx['description']['bank_code']); |
|
76 | + $transaction->setAccountNumber($trx['description']['account_number']); |
|
77 | + $transaction->setName($trx['description']['name']); |
|
78 | + $statementModel->addTransaction($transaction); |
|
79 | + } |
|
80 | + } |
|
81 | 81 | |
82 | 82 | return $statementOfAccount; |
83 | 83 | } |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | public function parse($target) |
41 | 41 | { |
42 | 42 | switch ($target) { |
43 | - case static::TARGET_ARRAY: |
|
44 | - return $this->parseToArray(); |
|
45 | - break; |
|
46 | - default: |
|
47 | - throw new MT940Exception('Invalid parse type provided'); |
|
43 | + case static::TARGET_ARRAY: |
|
44 | + return $this->parseToArray(); |
|
45 | + break; |
|
46 | + default: |
|
47 | + throw new MT940Exception('Invalid parse type provided'); |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
@@ -94,20 +94,20 @@ discard block |
||
94 | 94 | preg_match('/^\d{6}(\d{4})?(C|D|RC|RD)[A-Z]?([^N]+)N/', $transaction, $matches); |
95 | 95 | |
96 | 96 | switch ($matches[2]) { |
97 | - case 'C': |
|
98 | - $currentTrx['credit_debit'] = static::CD_CREDIT; |
|
99 | - break; |
|
100 | - case 'D': |
|
101 | - $currentTrx['credit_debit'] = static::CD_DEBIT; |
|
102 | - break; |
|
103 | - case 'RC': |
|
104 | - $currentTrx['credit_debit'] = static::CD_CREDIT_CANCELLATION; |
|
105 | - break; |
|
106 | - case 'RD': |
|
107 | - $currentTrx['credit_debit'] = static::CD_DEBIT_CANCELLATION; |
|
108 | - break; |
|
109 | - default: |
|
110 | - throw new MT940Exception('c/d/rc/rd mark not found in: ' . $transaction); |
|
97 | + case 'C': |
|
98 | + $currentTrx['credit_debit'] = static::CD_CREDIT; |
|
99 | + break; |
|
100 | + case 'D': |
|
101 | + $currentTrx['credit_debit'] = static::CD_DEBIT; |
|
102 | + break; |
|
103 | + case 'RC': |
|
104 | + $currentTrx['credit_debit'] = static::CD_CREDIT_CANCELLATION; |
|
105 | + break; |
|
106 | + case 'RD': |
|
107 | + $currentTrx['credit_debit'] = static::CD_DEBIT_CANCELLATION; |
|
108 | + break; |
|
109 | + default: |
|
110 | + throw new MT940Exception('c/d/rc/rd mark not found in: ' . $transaction); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | $amount = $matches[3]; |