Branch Coverage

blib/lib/Mojolicious/Plugin/NetsPayment.pm
Criterion Covered Total %
branch 22 42 52.3


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->at('ProcessResponse'); my $code = $body->at('ResponseCode')->text; if ($code eq 'OK') { $res->code(200); $res->param('authorization_id', $body->at('AuthorizationId')->text); $res->param('operation', $body->at('Operation')->text); $res->param('transaction_id', $body->at('TransactionId')->text); } else { $res->code(500) if $res->code == 200; $res->param('message', $body->at('ResponseText')->text); $res->param('source', $body->at('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->at('Summary > Annuled')->text eq 'true' ? :
416 1 0 $body->at('Summary > Authorized')->text eq 'true' ? :
437 0 1 unless (eval { do { my $body = $res->dom->at('PaymentInfo'); $res->param('amount', $body->at('OrderInformation > Amount')->text / 100); $res->param('amount_captured', $body->at('Summary > AmountCaptured')->text / 100); $res->param('amount_credited', $body->at('Summary > AmountCredited')->text / 100); $res->param('annuled', $body->at('Summary > Annuled')->text eq 'true' ? 1 : 0); $res->param('authorized', $body->at('Summary > Authorized')->text eq 'true' ? 1 : 0); $res->param('currency_code', $body->at('OrderInformation > Currency')->text); $res->param('order_description', $body->at('OrderInformation > OrderDescription')->text); $res->param('order_number', $body->at('OrderInformation > OrderNumber')->text); $res->param('authorization_id', eval { do { $body->at('Summary > AuthorizationId')->text } }); $res->param('customer_address1', eval { do { $body->at('CustomerInformation > Address1')->text } }); $res->param('customer_address2', eval { do { $body->at('CustomerInformation > Address2')->text } }); $res->param('customer_country', eval { do { $body->at('iCustomerInformation > Country')->text } }); $res->param('customer_email', eval { do { $body->at('CustomerInformation > Email')->text } }); $res->param('customer_first_name', eval { do { $body->at('CustomerInformation > FirstName')->text } }); $res->param('customer_ip', eval { do { $body->at('CustomerInformation > IP')->text } }); $res->param('customer_last_name', eval { do { $body->at('CustomerInformation > LastName')->text } }); $res->param('customer_number', eval { do { $body->at('CustomerInformation > CustomerNumber')->text } }); $res->param('customer_phone_number', eval { do { $body->at('CustomerInformation > PhoneNumber')->text } }); $res->param('customer_postcode', eval { do { $body->at('CustomerInformation > Postcode')->text } }); $res->param('expiry_date', eval { do { $body->at('CardInformation > ExpiryDate')->text } }); $res->param('issuer_country', eval { do { $body->at('CardInformation > IssuerCountry')->text } }); $res->param('masked_pan', eval { do { $body->at('CardInformation > MaskedPAN')->text } }); $res->param('payment_method', eval { do { $body->at('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->at('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 1 if (ref $$config{'token'}) { }
1 0 elsif ($app->mode eq 'production') { }
584 2 5 unless @_
638 0 0 unless $res->param('code')
640 0 0 $err ? :