X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDev%2FPayment.pm;h=a093ed444114ed807875e6c78b29d996488439b1;hb=08e48f66590f580cbe2c8e3df76883d88b4c0fef;hp=4e567e2ff907d8407e6b61f35ef8d29e799be4fa;hpb=d975f05c964dbc034da664b156744fdb3088c2a0;p=kivitendo-erp.git diff --git a/SL/Dev/Payment.pm b/SL/Dev/Payment.pm index 4e567e2ff..a093ed444 100644 --- a/SL/Dev/Payment.pm +++ b/SL/Dev/Payment.pm @@ -2,7 +2,8 @@ package SL::Dev::Payment; use strict; use base qw(Exporter); -our @EXPORT = qw(create_payment_terms create_bank_account create_bank_transaction); +our @EXPORT_OK = qw(create_payment_terms create_bank_account create_bank_transaction create_sepa_export create_sepa_export_item); +our %EXPORT_TAGS = (ALL => \@EXPORT_OK); use SL::DB::PaymentTerm; use SL::DB::BankAccount; @@ -39,6 +40,30 @@ sub create_bank_account { $bank_account->save; } +sub create_sepa_export { + my (%params) = @_; + my $sepa_export = SL::DB::SepaExport->new( + closed => 0, + employee_id => $params{employee_id} // SL::DB::Manager::Employee->current->id, + executed => 0, + vc => 'customer', + ); + $sepa_export->assign_attributes(%params) if %params; + $sepa_export->save; +} + +sub create_sepa_export_item { + my (%params) = @_; + my $sepa_exportitem = SL::DB::SepaExportItem->new( + chart_id => delete $params{chart_id} // $::instance_conf->get_ar_paid_accno_id, + payment_type => 'without_skonto', + our_bic => 'BANK1234', + our_iban => 'DE12500105170648489890', + ); + $sepa_exportitem->assign_attributes(%params) if %params; + $sepa_exportitem->save; +} + sub create_bank_transaction { my (%params) = @_; @@ -57,6 +82,7 @@ sub create_bank_transaction { $bank_chart = SL::DB::Manager::Chart->find_by(description => 'Bank') or die "Can't find bank chart"; } my $bank_account = SL::DB::Manager::BankAccount->find_by( chart_id => $bank_chart->id ); + die "bank account missing" unless $bank_account; my $bt = SL::DB::BankTransaction->new( local_bank_account_id => $bank_account->id, @@ -88,14 +114,14 @@ SL::Dev::Payment - create objects for payment-related testing, with minimal defa Create payment terms. Minimal example with default values (30days, 5% skonto within 5 days): - my $payment_terms = SL::Dev::Record::create_payment_terms; + my $payment_terms = SL::Dev::Payment::create_payment_terms; =head2 C Required params: chart_id Example: - my $bank_account = SL::Dev::Record::create_bank_account(chart_id => SL::DB::Manager::Chart->find_by(description => 'Bank')->id); + my $bank_account = SL::Dev::Payment::create_bank_account(chart_id => SL::DB::Manager::Chart->find_by(description => 'Bank')->id); =head2 C @@ -115,9 +141,9 @@ Param amount should always be relative to the absolute amount of the invoice, i. values for sales and purchases. Example: - my $payment_terms = SL::Dev::Record::create_payment_terms; + my $payment_terms = SL::Dev::Payment::create_payment_terms; my $bank_chart = SL::DB::Manager::Chart->find_by(description => 'Bank'); - my $bank_account = SL::Dev::Record::create_bank_account(chart_id => $bank_chart->id); + my $bank_account = SL::Dev::Payment::create_bank_account(chart_id => $bank_chart->id); my $customer = SL::Dev::CustomerVendor::create_customer(iban => 'DE12500105170648489890', bank_code => 'abc', account_number => '44444', @@ -143,8 +169,11 @@ To create a payment for 3 invoices that were all paid together, all with skonto: amount => ($ar1->amount_less_skonto + $ar2->amount_less_skonto + $ar2->amount_less_skonto), purpose => 'Rechnungen 20, 21, 22', ); + =head1 TODO +Nothing here yet. + =head1 BUGS Nothing here yet.