Finance-PremiumBonds

 view release on metacpan or  search on metacpan

lib/Finance/PremiumBonds.pm  view on Meta::CPAN

            field_premium_bond_number => $holdernum,
            field_premium_bond_period => $period || 'this_month',
        }
    );

    if (!$resp->is_success) {
        warn "Request failed - " . $resp->status_line;
        return;
    }

    my $resp_data = JSON::from_json($resp->decoded_content);

    if ($resp_data->{holder_number} eq 'is_invalid') {
        carp "Holder number not recognised by NS+I";
        return;
    }

    # TODO: it'd be nice to know what the status is for a win (just 'win'?) but
    # I've never won, so I don't know - so for now, just treat the absence of
    # 'no_win' as a win.
    return $resp_data->{status} eq 'no_win' ? 0 : 1;



( run in 0.269 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )