Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision f4153b01

Von Jan Büren vor 12 Tagen hinzugefügt

  • ID f4153b01184517a7f46082f314665121ca4abf48
  • Vorgänger 7b166f80

positiver Testfall für End-To-End SEPA ID und keine Warnung beim Check

Unterschiede anzeigen:

t/bank/bank_transactions.t
1
use Test::More tests => 433;
1
use Test::More tests => 449;
2 2

  
3 3
use strict;
4 4

  
......
119 119
test_closedto();
120 120
test_fuzzy_skonto_pt();
121 121
test_fuzzy_skonto_pt_not_in_range();
122
reset_state();
123
test_sepa_export_endtoend();
122 124
# remove all created data at end of test
123 125
clear_up();
124 126

  
......
1230 1232
     "remote_account_number(3) exact_amount(4) own_invoice_in_purpose(5) depositor_matches(2) remote_name(2) payment_within_30_days(1) datebonus0(3) sepa_export_item(5) ",
1231 1233
     "$testname: rule_matches ok");
1232 1234
};
1235
sub test_sepa_export_endtoend {
1236

  
1237
  my $testname = 'test_sepa_export_endtoend';
1238

  
1239
  $ar_transaction = test_ar_transaction(invnumber => 'sepa1', transdate => $dt);
1240

  
1241
  my $bt  = create_bank_transaction(record => $ar_transaction, transdate => $dt,
1242
                                    end_to_end_id => "KIVITENDO202412101212"     )
1243
    or die "Couldn't create bank_transaction";
1244

  
1245
  my $se  = create_sepa_export();
1246
  my $sei = create_sepa_export_item(
1247
    chart_id       => $bank->id,
1248
    ar_id          => $ar_transaction->id,
1249
    sepa_export_id => $se->id,
1250
    end_to_end_id  => "KIVITENDO202412101212",
1251
    vc_iban        => $customer->iban,
1252
    vc_bic         => $customer->bic,
1253
    vc_mandator_id => $customer->mandator_id,
1254
    vc_depositor   => $customer->depositor,
1255
    amount         => $ar_transaction->amount,
1256
  );
1257
  require SL::SEPA::XML;
1258
  my $sepa_xml   = SL::SEPA::XML->new('company'     => $customer->name,
1259
                                      'creditor_id' => "id",
1260
                                      'src_charset' => 'UTF-8',
1261
                                      'message_id'  => "test",
1262
                                      'grouped'     => 1,
1263
                                      'collection'  => 1,
1264
                                     );
1265
  is($sepa_xml->{company}    , 'Test Customer OLE S.L. Ardbaerg AB');
1266

  
1267
  $ar_transaction->load;
1268
  $bt->load;
1269
  $sei->load;
1270
  is($ar_transaction->paid   , '0.00000' , "$testname: sepa1 not paid");
1271
  is($bt->invoice_amount     , '0.00000' , "$testname: bt invoice amount was not assigned");
1272
  is($bt->amount             , '119.00000' , "$testname: bt amount ok");
1273
  is($sei->amount            , '119.00000' , "$testname: sepa export amount ok");
1274

  
1275
  my $bt_controller = SL::Controller::BankTransaction->new;
1276
  my ( $bt_transactions, $proposals ) = $bt_controller->gather_bank_transactions_and_proposals(bank_account => $bank_account);
1277

  
1278
  is(scalar(@$bt_transactions)         , 1  , "$testname: one bank_transaction");
1279
  is($bt_transactions->[0]->{agreement}, 33 , "$testname: agreement == 33");
1280
  my $match = join ( ' ',@{$bt_transactions->[0]->{rule_matches}});
1281
  is($match,
1282
     "remote_account_number(3) exact_amount(4) own_invoice_in_purpose(5) depositor_matches(2) remote_name(2) payment_within_30_days(1) datebonus0(3) end_to_end_id(8) sepa_export_item(5) ",
1283
     "$testname: rule_matches ok");
1284
}
1285

  
1233 1286

  
1234 1287
sub test_two_banktransactions {
1235 1288

  

Auch abrufbar als: Unified diff