Business-Mondo

 view release on metacpan or  search on metacpan

t/002_end_to_end.t  view on Meta::CPAN

		id => $Transaction->id,
		expand => 'merchant'
	),
    'Business::Mondo::Transaction'
);

isa_ok(
    $Transaction->get,
    'Business::Mondo::Transaction',
);

my $time = time;

isa_ok(
    $Transaction = $Transaction->annotate(
		testing_at => $time,
	),
    'Business::Mondo::Transaction',
);

cmp_deeply(
    my $annotations = $Transaction->annotations,
    {
        testing_at => $time,
    },
    '->annotations',
);

ok( $Account->add_feed_item(
	url => 'https://metacpan.org/release/Business-Mondo',
	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::Mondo::Webhook' );

ok( my @webhooks = $Account->webhooks,'->webhooks' );

foreach $Webhook ( @webhooks ) {
	ok( $Webhook->delete,'->delete' );
}

note( "Balance" );
isa_ok(
	my $Balance = $Mondo->balance( account_id => $Account->id ),
	'Business::Mondo::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 = $Mondo->upload_attachment(
	file_name => 'foo.png',
	file_type => 'image/png',
),'Business::Mondo::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::Mondo::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 1.192 second using v1.01-cache-2.11-cpan-b16cb0d3907 )