Branch Coverage

blib/lib/Mojolicious/Plugin/NetsPayment.pm
Criterion Covered Total %
branch 20 40 50.0


line true false branch
227 0 1 unless ref $args
229 0 1 unless $$args{'transaction_id'} ||= $c->param('transactionId')
248 0 1 unless $res->code
255 1 0 if ($code eq 'OK') { }
262 0 0 if $res->code == 200
268 0 1 unless (eval { do { my $body = $res->dom->ProcessResponse; my $code = $body->ResponseCode->text; if ($code eq 'OK') { $res->code(200); $res->param('authorization_id', $body->AuthorizationId->text); $res->param('operation', $body->Operation->text); $res->param('transaction_id', $body->TransactionId->text); } else { $res->code(500) if $res->code == 200; $res->param('message', $body->ResponseText->text); $res->param('source', $body->ResponseSource->text); } ; $res->param('code', $code) } })
388 0 1 unless ref $args
389 0 1 unless $$args{'transaction_id'}
406 0 1 unless $res->code
415 0 1 $body->Summary->Annuled->text eq 'true' ? :
416 1 0 $body->Summary->Authorized->text eq 'true' ? :
437 0 1 unless (eval { do { my $body = $res->dom->PaymentInfo; $res->param('amount', $body->OrderInformation->Amount->text / 100); $res->param('amount_captured', $body->Summary->AmountCaptured->text / 100); $res->param('amount_credited', $body->Summary->AmountCredited->text / 100); $res->param('annuled', $body->Summary->Annuled->text eq 'true' ? 1 : 0); $res->param('authorized', $body->Summary->Authorized->text eq 'true' ? 1 : 0); $res->param('currency_code', $body->OrderInformation->Currency->text); $res->param('order_description', $body->OrderInformation->OrderDescription->text); $res->param('order_number', $body->OrderInformation->OrderNumber->text); $res->param('authorization_id', eval { do { $body->Summary->AuthorizationId->text } }); $res->param('customer_address1', eval { do { $body->CustomerInformation->Address1->text } }); $res->param('customer_address2', eval { do { $body->CustomerInformation->Address2->text } }); $res->param('customer_country', eval { do { $body->iCustomerInformation->Country->text } }); $res->param('customer_email', eval { do { $body->CustomerInformation->Email->text } }); $res->param('customer_first_name', eval { do { $body->CustomerInformation->FirstName->text } }); $res->param('customer_ip', eval { do { $body->CustomerInformation->IP->text } }); $res->param('customer_last_name', eval { do { $body->CustomerInformation->LastName->text } }); $res->param('customer_number', eval { do { $body->CustomerInformation->CustomerNumber->text } }); $res->param('customer_phone_number', eval { do { $body->CustomerInformation->PhoneNumber->text } }); $res->param('customer_postcode', eval { do { $body->CustomerInformation->Postcode->text } }); $res->param('expiry_date', eval { do { $body->CardInformation->ExpiryDate->text } }); $res->param('issuer_country', eval { do { $body->CardInformation->IssuerCountry->text } }); $res->param('masked_pan', eval { do { $body->CardInformation->MaskedPAN->text } }); $res->param('payment_method', eval { do { $body->CardInformation->PaymentMethod->text } }); 1 } })
509 1 2 unless $$args{'amount'}
510 1 1 unless $$args{'order_number'}
532 0 1 unless $res->code
543 0 1 unless (eval { do { my $id = $res->dom->RegisterResponse->TransactionId->text; my $terminal_url = $self->_url('/Terminal/default.aspx')->query({'merchantId', $self->merchant_id, 'transactionId', $id}); $res->headers->location($terminal_url); $res->param('transaction_id', $id); $res->code(302); 1 } })
567 2 0 if (ref $$config{'token'})
581 1 5 unless @_
636 0 0 unless $res->param('code')
638 0 0 $err ? :