Lines 908-914
subtest "Koha::Account::Line::void tests" => sub {
Link Here
|
908 |
|
908 |
|
909 |
subtest "Payment notice tests" => sub { |
909 |
subtest "Payment notice tests" => sub { |
910 |
|
910 |
|
911 |
plan tests => 6; |
911 |
plan tests => 8; |
912 |
|
912 |
|
913 |
Koha::Account::Lines->delete(); |
913 |
Koha::Account::Lines->delete(); |
914 |
Koha::Patrons->delete(); |
914 |
Koha::Patrons->delete(); |
Lines 936-957
subtest "Payment notice tests" => sub {
Link Here
|
936 |
$letter->content('[%- USE Price -%]A payment of [% credit.amount * -1 | $Price %] has been applied to your account.'); |
936 |
$letter->content('[%- USE Price -%]A payment of [% credit.amount * -1 | $Price %] has been applied to your account.'); |
937 |
$letter->store(); |
937 |
$letter->store(); |
938 |
|
938 |
|
939 |
my $id = $account->pay( { amount => 13 } ); |
939 |
t::lib::Mocks::mock_preference('UseEmailReceipts', '0'); |
|
|
940 |
|
941 |
my $id = $account->pay( { amount => 1 } ); |
942 |
is( Koha::Notice::Messages->search()->count(), 0, 'Notice for payment not sent if UseEmailReceipts is disabled' ); |
943 |
|
944 |
$id = $account->pay( { amount => 1, type => 'writeoff' } ); |
945 |
is( Koha::Notice::Messages->search()->count(), 0, 'Notice for writeoff not sent if UseEmailReceipts is disabled' ); |
946 |
|
947 |
t::lib::Mocks::mock_preference('UseEmailReceipts', '1'); |
948 |
|
949 |
$id = $account->pay( { amount => 12 } ); |
940 |
my $notice = Koha::Notice::Messages->search()->next(); |
950 |
my $notice = Koha::Notice::Messages->search()->next(); |
941 |
is( $notice->subject, 'Account Payment', 'Notice subject is correct for payment' ); |
951 |
is( $notice->subject, 'Account payment', 'Notice subject is correct for payment' ); |
942 |
is( $notice->letter_code, 'ACCOUNT_PAYMENT', 'Notice letter code is correct for payment' ); |
952 |
is( $notice->letter_code, 'ACCOUNT_PAYMENT', 'Notice letter code is correct for payment' ); |
943 |
is( $notice->content, 'A payment of 13.00 has been applied to your account.', 'Notice content is correct for payment' ); |
953 |
is( $notice->content, 'A payment of 12.00 has been applied to your account.', 'Notice content is correct for payment' ); |
944 |
$notice->delete(); |
954 |
$notice->delete(); |
945 |
|
955 |
|
946 |
$letter = Koha::Notice::Templates->find( { code => 'ACCOUNT_WRITEOFF' } ); |
956 |
$letter = Koha::Notice::Templates->find( { code => 'ACCOUNT_WRITEOFF' } ); |
947 |
$letter->content('[%- USE Price -%]A writeoff of [% credit.amount * -1 | $Price %] has been applied to your account.'); |
957 |
$letter->content('[%- USE Price -%]A writeoff of [% credit.amount * -1 | $Price %] has been applied to your account.'); |
948 |
$letter->store(); |
958 |
$letter->store(); |
949 |
|
959 |
|
950 |
$id = $account->pay( { amount => 14, type => 'writeoff' } ); |
960 |
$id = $account->pay( { amount => 13, type => 'writeoff' } ); |
951 |
$notice = Koha::Notice::Messages->search()->next(); |
961 |
$notice = Koha::Notice::Messages->search()->next(); |
952 |
is( $notice->subject, 'Account Writeoff', 'Notice subject is correct for payment' ); |
962 |
is( $notice->subject, 'Account writeoff', 'Notice subject is correct for payment' ); |
953 |
is( $notice->letter_code, 'ACCOUNT_WRITEOFF', 'Notice letter code is correct for writeoff' ); |
963 |
is( $notice->letter_code, 'ACCOUNT_WRITEOFF', 'Notice letter code is correct for writeoff' ); |
954 |
is( $notice->content, 'A writeoff of 14.00 has been applied to your account.', 'Notice content is correct for writeoff' ); |
964 |
is( $notice->content, 'A writeoff of 13.00 has been applied to your account.', 'Notice content is correct for writeoff' ); |
955 |
}; |
965 |
}; |
956 |
|
966 |
|
957 |
1; |
967 |
1; |
958 |
- |
|
|