Business-Monzo
view release on metacpan or search on metacpan
t/002_end_to_end.t view on Meta::CPAN
id => $Transaction->id,
expand => 'merchant'
),
'Business::Monzo::Transaction'
);
isa_ok(
$Transaction->get,
'Business::Monzo::Transaction',
);
my $time = time;
isa_ok(
$Transaction = $Transaction->annotate(
testing_at => $time,
),
'Business::Monzo::Transaction',
);
cmp_deeply(
my $annotations = $Transaction->annotations,
{
testing_at => $time,
},
'->annotations',
);
ok( $Account->add_feed_item(
url => 'https://metacpan.org/release/Business-Monzo',
params => {
title => 'Hello from the perl API client',
image_url => 'http://pix.iemoji.com/images/emoji/apple/ios-9/256/dromedary-camel.png',
body => 'ðª',
}
),'->add_feed_item' );
note( "Webhook" );
isa_ok( my $Webhook = $Account->register_webhook(
callback_url => 'http://www.foo.com',
),'Business::Monzo::Webhook' );
ok( my @webhooks = $Account->webhooks,'->webhooks' );
foreach $Webhook ( @webhooks ) {
ok( $Webhook->delete,'->delete' );
}
note( "Balance" );
isa_ok(
my $Balance = $Monzo->balance( account_id => $Account->id ),
'Business::Monzo::Balance'
);
like( $Balance->account_id,qr/acc_0000/,'->account_id' );
ok( $Balance->balance,'->balance' );
isa_ok( $Balance->currency,'Data::Currency','->currency' );
is( $Balance->spend_today,0,'->spend_today' );
note( "Attachment" );
isa_ok( my $Attachment = $Monzo->upload_attachment(
file_name => 'foo.png',
file_type => 'image/png',
),'Business::Monzo::Attachment' );
is( $Attachment->file_name,'foo.png','->file_name' );
is( $Attachment->file_type,'image/png','->file_type' );
like( $Attachment->file_url,qr/^http/,'->file_url' );
like( $Attachment->upload_url,qr/^http/,'->upload_url' );
isa_ok( $Attachment = $Attachment->register(
external_id => $Transaction->id,
file_url => 'http://www.nyan.cat/cats/original.gif',
file_type => 'image/gif',
),'Business::Monzo::Attachment' );
like( $Attachment->user_id,qr/user_/,'->user_id' );
isa_ok( $Attachment->created,'DateTime' );
is( $Attachment->external_id,$Transaction->id,'->id' );
like( $Attachment->id,qr/attach_/,'->id' );
ok( $Attachment->file_name,'->file_name' );
is( $Attachment->file_type,'image/gif','->file_type' );
like( $Attachment->file_url,qr/^http/,'->file_url' );
like( $Attachment->upload_url,qr/^http/,'->upload_url' );
ok( $Attachment->deregister,'->deregister' );
done_testing();
( run in 0.682 second using v1.01-cache-2.11-cpan-b16cb0d3907 )