package II8721cc6465d134809ce288833c808242::mod_fusemail; use strict; use base qw/II720d6e18aa34327713eb014408fc9144/; sub init { my $class = shift; my $apipost = shift; $apipost->{title} = 'Fusemail.com integration'; $apipost->{url} = 'http://www.fusemail.com/api/request.html'; $apipost->{params} = <<END_PARAMS;
PlatformUser=<YOUR API USERNAME HERE>
PlatformPassword=<YOUR API PASSWORD HERE>
user=#{value1}
password=#{User.passwd}
first_name=#{User.fname}
last_name=#{User.lname}
email=#{User.email}
account_type=personal_basic
END_PARAMS
$apipost->{method} = 'POST'; $apipost->{events} = 'create,suspend,reinstate,delete'; $apipost; } sub onProcessForm { my $class = shift; my $form = shift; my $apipost = $form->getDecorated; return qq(You need to set your API username and Your API password in the Parameters) if $apipost->{params} =~ /PlatformUser\=<YOUR API USERNAME HERE>/ || $apipost->{params} =~ /PlatformPassword\=<YOUR API PASSWORD HERE>/; return; } sub post { my $class = shift; my ($apipost, $ctx, $event) = @_; if ($event eq 'create') { $apipost->{params} .= "\nrequest=order"; } elsif ($event eq 'suspend') { $apipost->{params} .= "\nrequest=suspend"; } elsif ($event eq 'reinstate') { $apipost->{params} .= "\nrequest=enable"; } elsif ($event eq 'delete') { $apipost->{params} .= "\nrequest=terminate\npurge=yes"; } my ($post_success, $post_message) = $apipost->post($ctx); if ($post_success) { my ($code, $detail) = split(/\|\|/, $post_message); if ($code == 1) { $post_message = ''; } else { $post_success = 0; $post_message = $detail; } } ($post_success, $post_message); } 1; 