first version of online registration
authorHeiko Schlittermann (JUMPER) <hs@schlittermann.de>
Fri, 08 Aug 2014 11:11:02 +0200
changeset 0 9ffd8fa82345
child 1 d582082e167d
first version of online registration
joker
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/joker	Fri Aug 08 11:11:02 2014 +0200
@@ -0,0 +1,56 @@
+#! /usr/bin/perl
+
+use 5.010;
+use strict;
+use warnings;
+use if $ENV{DEBUG} => 'Smart::Comments';
+use Data::Dumper;
+use WWW::Domain::Registry::Joker;
+
+my %conf = do 'credentials.conf';
+
+my $joker = WWW::Domain::Registry::Joker->new(
+    username => $conf{username},
+    password => $conf{password},
+    debug    => $ENV{DEBUG},
+
+    #    dmapi_url => 'https://dmapi.ote.joker.com/request',
+);
+
+given (+shift) {
+    when ('request') {
+        my $domain = +shift // die "$0: need domain\n";
+        my $proc_id = $joker->do_request(
+            'domain-register',
+            domain      => $domain,
+            period      => 12,
+            status      => 'production',
+            'owner-c'   => 'CODE-1561',
+            'billing-c' => 'CODE-1561',
+            'admin-c'   => 'CODE-1561',
+            'tech-c'    => 'CODE-1561',
+            'ns-list'   => 'pu.schlittermann.de:hh.schlittermann.de',
+        );
+        say "ID: $proc_id"
+    }
+    when ('result') {
+        my $id     = shift;
+        my %result = $joker->result_list;
+        foreach (
+            map  { $result{$_} }
+            sort { $result{$a}{tstamp} <=> $result{$b}{tstamp} }
+            grep { defined $id ? ($id == $_) : 1 } keys %result
+          )
+        {
+            $_->{tstamp} =~ s/(?<y>\d{4})(?<m>\d\d)(?<d>\d\d)
+			      (?<H>\d\d)(?<M>\d\d)(?<S>\d\d)\..*
+			     /$+{y}-$+{m}-$+{d} $+{H}:$+{M}:$+{S}/x;
+            say "$_->{reqtype} $_->{tstamp} $_->{reqobject} $_->{status}";
+        }
+
+    }
+    default {
+        die "$0 [request domain|result [id]]\n"
+    }
+}
+