WebService-Braintree
view release on metacpan or search on metacpan
t/unit/webhook_notification.t view on Meta::CPAN
is $webhook_notification->dispute->id, 'my_id';
};
subtest 'sample_notification builds a sample notification for dispute won', sub {
my ($signature, $payload) = WebService::Braintree::WebhookTesting->sample_notification(
WebService::Braintree::WebhookNotification::Kind::DisputeWon,
'my_id',
);
my $webhook_notification = WebService::Braintree::WebhookNotification->parse($signature, $payload);
is $webhook_notification->kind, WebService::Braintree::WebhookNotification::Kind::DisputeWon;
is $webhook_notification->dispute->status, WebService::Braintree::Dispute::Status::Won;
is $webhook_notification->dispute->id, 'my_id';
};
subtest 'sample_notification builds a sample notification for disbursement exception', sub {
my ($signature, $payload) = WebService::Braintree::WebhookTesting->sample_notification(
WebService::Braintree::WebhookNotification::Kind::DisbursementException,
'my_id',
);
my $webhook_notification = WebService::Braintree::WebhookNotification->parse($signature, $payload);
is $webhook_notification->kind, WebService::Braintree::WebhookNotification::Kind::DisbursementException;
is $webhook_notification->disbursement->id, 'my_id';
is $webhook_notification->disbursement->exception_message, 'bank_rejected';
is $webhook_notification->disbursement->disbursement_date, '2014-02-10T00:00:00Z';
is $webhook_notification->disbursement->follow_up_action, 'update_funding_information';
is $webhook_notification->disbursement->merchant_account->id, 'merchant_account_token';
};
subtest 'sample_notification builds a sample notification for disbursement', sub {
my ($signature, $payload) = WebService::Braintree::WebhookTesting->sample_notification(
WebService::Braintree::WebhookNotification::Kind::Disbursement,
'my_id',
);
my $webhook_notification = WebService::Braintree::WebhookNotification->parse($signature, $payload);
is $webhook_notification->kind, WebService::Braintree::WebhookNotification::Kind::Disbursement;
is $webhook_notification->disbursement->id, 'my_id';
is $webhook_notification->disbursement->exception_message, undef;
is $webhook_notification->disbursement->disbursement_date, '2014-02-10T00:00:00Z';
is $webhook_notification->disbursement->follow_up_action, undef;
is $webhook_notification->disbursement->merchant_account->id, 'merchant_account_token';
};
subtest 'sample_notification builds a sample notification for partner merchant connected', sub {
my ($signature, $payload) = WebService::Braintree::WebhookTesting->sample_notification(
WebService::Braintree::WebhookNotification::Kind::PartnerMerchantConnected,
'my_id',
);
my $webhook_notification = WebService::Braintree::WebhookNotification->parse($signature, $payload);
is $webhook_notification->kind, WebService::Braintree::WebhookNotification::Kind::PartnerMerchantConnected;
is $webhook_notification->partner_merchant->partner_merchant_id, 'abc123';
is $webhook_notification->partner_merchant->merchant_public_id, 'public_id';
is $webhook_notification->partner_merchant->public_key, 'public_key';
is $webhook_notification->partner_merchant->private_key, 'private_key';
is $webhook_notification->partner_merchant->client_side_encryption_key, 'cse_key';
};
subtest 'sample_notification builds a sample notification for partner merchant disconnected', sub {
my ($signature, $payload) = WebService::Braintree::WebhookTesting->sample_notification(
WebService::Braintree::WebhookNotification::Kind::PartnerMerchantDisconnected,
'my_id',
);
my $webhook_notification = WebService::Braintree::WebhookNotification->parse($signature, $payload);
is $webhook_notification->kind, WebService::Braintree::WebhookNotification::Kind::PartnerMerchantDisconnected;
is $webhook_notification->partner_merchant->partner_merchant_id, 'abc123';
};
subtest 'sample_notification builds a sample notification for partner merchant declined', sub {
my ($signature, $payload) = WebService::Braintree::WebhookTesting->sample_notification(
WebService::Braintree::WebhookNotification::Kind::PartnerMerchantDeclined,
'my_id',
);
my $webhook_notification = WebService::Braintree::WebhookNotification->parse($signature, $payload);
is $webhook_notification->kind, WebService::Braintree::WebhookNotification::Kind::PartnerMerchantDeclined;
is $webhook_notification->partner_merchant->partner_merchant_id, 'abc123';
};
done_testing();
( run in 2.034 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )