コード例 #1
0
ファイル: EppAPI.cs プロジェクト: fizikci/DomainMarketing
 public ResDomainTransfer DomainTransferCancel(ReqDomainTransferCancel req)
 {
     return(Call <ResDomainTransfer, ReqDomainTransferCancel>(req, "DomainTransferCancel"));
 }
コード例 #2
0
        public static object CreateSampleRequest(EppQueueCommands command, string domainName = "DOMAIN_NAME.TLD")
        {
            switch (command)
            {
            case EppQueueCommands.Login:
            {
                return(new ReqEmpty());
            }

            case EppQueueCommands.Logout:
            {
                return(new ReqEmpty());
            }

            case EppQueueCommands.Hello:
            {
                return(new ReqEmpty());
            }

            case EppQueueCommands.DomainCheck:
            {
                var req = new ReqDomainCheck(new List <string>()
                    {
                        domainName
                    });
                req.ExtLaunch = new Protocol.Launch.checkType()
                {
                    phase = new Protocol.Launch.phaseType()
                    {
                        Value = Protocol.Launch.phaseTypeValue.claims
                    }
                };
                SetVeriSignNameStoreExtension(domainName, req);
                req.ExtPremiumDomain = new Protocol.PremiumDomain.chkType()
                {
                    flag = true
                };
                req.ExtFee05 = new fee05.checkType()
                {
                    domain = new List <fee05.domainCheckType>()
                    {
                        new fee05.domainCheckType()
                        {
                            command = new fee05.commandType()
                            {
                                phase = "sunrise", Value = "create"
                            }, currency = "USD", name = domainName, period = new fee05.periodType()
                            {
                                unit = fee05.pUnitType.y, Value = 1
                            }
                        }
                    }
                };
                req.ExtFee06 = new fee06.checkType()
                {
                    domain = new List <fee06.domainCheckType>()
                    {
                        new fee06.domainCheckType()
                        {
                            command = new fee06.commandType()
                            {
                                phase = "sunrise", Value = "create"
                            }, currency = "USD", name = domainName, period = new fee06.periodType()
                            {
                                unit = fee06.pUnitType.y, Value = 1
                            }
                        }
                    }
                };
                req.ExtFee07 = new fee07.checkType()
                {
                    domain = new List <fee07.domainCheckType>()
                    {
                        new fee07.domainCheckType()
                        {
                            command = new fee07.commandType()
                            {
                                phase = "sunrise", Value = "create"
                            }, currency = "USD", name = domainName, period = new fee07.periodType()
                            {
                                unit = fee07.pUnitType.y, Value = 1
                            }
                        }
                    }
                };
                return(req);
            }

            case EppQueueCommands.DomainDelete:
            {
                var req = new ReqDomainDelete(domainName);
                SetVeriSignNameStoreExtension(domainName, req);
                return(req);
            }

            case EppQueueCommands.DomainRenew:
            {
                var req = new ReqDomainRenew(domainName, DateTime.Now.AddMonths(1), new DomainPeriod(DomainPeriod.PeriodUnits.Year, 1));
                SetVeriSignNameStoreExtension(domainName, req);
                return(req);
            }

            case EppQueueCommands.DomainInfo:
            {
                var req = new ReqDomainInfo(domainName, new AuthInfo("PASSWORD"));
                SetVeriSignNameStoreExtension(domainName, req);
                req.ExtLaunch = new Protocol.Launch.infoType()
                {
                    phase = new Protocol.Launch.phaseType()
                    {
                        Value = Protocol.Launch.phaseTypeValue.sunrise
                    }, includeMark = false
                };
                return(req);
            }

            case EppQueueCommands.DomainUpdate:
            {
                ReqDomainUpdate hArgs = new ReqDomainUpdate(domainName);

                hArgs.Rem             = new DomainAddRemType();
                hArgs.Rem.NameServers = new NameServerList();

                foreach (string s in new[] { "ns1.isimtescil.net", "ns2.isimtescil.net" })
                {
                    hArgs.Rem.NameServers.Add(new NameServerInfo(s));
                }

                hArgs.Add             = new DomainAddRemType();
                hArgs.Add.NameServers = new NameServerList();

                foreach (string s in new[] { "ns1.isimtescil.net", "ns2.isimtescil.net" })
                {
                    hArgs.Add.NameServers.Add(new NameServerInfo(s));
                }

                List <DomainContactInfo> addContacts = new List <DomainContactInfo>();
                List <DomainContactInfo> remContacts = new List <DomainContactInfo>();

                addContacts.Add(new DomainContactInfo("ADMIN_CONTACT_ID", DomainContactInfo.ContactType.Admin));

                addContacts.Add(new DomainContactInfo("BILL_CONTACT_ID", DomainContactInfo.ContactType.Billing));

                addContacts.Add(new DomainContactInfo("TECH_CONTACT_ID", DomainContactInfo.ContactType.Tech));

                hArgs.Add.Contacts = addContacts;
                if (hArgs.Rem != null)
                {
                    hArgs.Rem.Contacts = remContacts;
                }

                hArgs.Chg = new DomainChangeType("registrantID");

                SetVeriSignNameStoreExtension(domainName, hArgs);
                hArgs.ExtLaunch = new Protocol.Launch.idContainerType()
                {
                    phase = new Protocol.Launch.phaseType()
                    {
                        Value = Protocol.Launch.phaseTypeValue.sunrise
                    }
                };
                hArgs.ExtPremiumDomain = new Protocol.PremiumDomain.reassignType()
                {
                    shortName = "shortname"
                };
                hArgs.ExtRgp = new Protocol.Rgp.updateType()
                {
                    restore = new Protocol.Rgp.restoreType()
                    {
                        op = Protocol.Rgp.rgpOpType.request
                    }
                };
                hArgs.ExtKeySys = new Protocol.KeySys.updateType()
                {
                    domain = new Protocol.KeySys.domainType()
                    {
                        renewalmode = "AUTOEXPIRE"
                    }
                };

                return(hArgs);
            }

            case EppQueueCommands.DomainCreate:
            {
                //Get ContactId's
                string adminContactId  = "ADMIN_CONTACT_ID";
                string techContacId    = "TECH_CONTACT_ID";
                string billingContacId = "BILL_CONTACT_ID";

                ReqDomainCreate dArgs = new ReqDomainCreate(domainName, new AuthInfo("AUTH_PASSWORD"))
                {
                    NameServers = new NameServerList(new List <NameServerInfo>()
                        {
                            new NameServerInfo("ns1.isimtescil.net"), new NameServerInfo("ns2.isimtescil.net")
                        }),
                    RegistrationPeriod = new DomainPeriod(DomainPeriod.PeriodUnits.Year, 1),
                    Registrant         = "OWNER_CONTACT_ID",
                    Contacts           = new List <DomainContactInfo>()
                    {
                        new DomainContactInfo(adminContactId, DomainContactInfo.ContactType.Admin),
                        new DomainContactInfo(techContacId, DomainContactInfo.ContactType.Tech),
                        new DomainContactInfo(billingContacId, DomainContactInfo.ContactType.Billing)
                    }
                };

                SetVeriSignNameStoreExtension(domainName, dArgs);
                dArgs.ExtLaunch = new Protocol.Launch.createType()
                {
                    type  = Protocol.Launch.objectType.registration,
                    phase = new Protocol.Launch.phaseType()
                    {
                        Value = Protocol.Launch.phaseTypeValue.sunrise
                    },
                    notice = new Protocol.Launch.createNoticeType()
                    {
                        acceptedDate = DateTime.Now.AddDays(-30)
                    }
                };

                return(dArgs);
            }

            case EppQueueCommands.DomainTransferRequest:
            {
                var req = new ReqDomainTransferRequest()
                {
                    AuthInfo = new AuthInfo("PASSWORD"), DomainName = domainName, Period = new DomainPeriod(DomainPeriod.PeriodUnits.Year, 1)
                };
                SetVeriSignNameStoreExtension(domainName, req);
                return(req);
            }

            case EppQueueCommands.DomainTransferQuery:
            {
                var req = new ReqDomainTransferQuery()
                {
                    AuthInfo = new AuthInfo("PASSWORD"), DomainName = domainName, Period = new DomainPeriod(DomainPeriod.PeriodUnits.Year, 1)
                };
                SetVeriSignNameStoreExtension(domainName, req);
                return(req);
            }

            case EppQueueCommands.DomainTransferCancel:
            {
                var req = new ReqDomainTransferCancel()
                {
                    AuthInfo = new AuthInfo("PASSWORD"), DomainName = domainName, Period = new DomainPeriod(DomainPeriod.PeriodUnits.Year, 1)
                };
                SetVeriSignNameStoreExtension(domainName, req);
                return(req);
            }

            case EppQueueCommands.DomainTransferApprove:
            {
                var req = new ReqDomainTransferApprove()
                {
                    AuthInfo = new AuthInfo("PASSWORD"), DomainName = domainName, Period = new DomainPeriod(DomainPeriod.PeriodUnits.Year, 1)
                };
                SetVeriSignNameStoreExtension(domainName, req);
                return(req);
            }

            case EppQueueCommands.DomainTransferReject:
            {
                var req = new ReqDomainTransferReject()
                {
                    AuthInfo = new AuthInfo("PASSWORD"), DomainName = domainName, Period = new DomainPeriod(DomainPeriod.PeriodUnits.Year, 1)
                };
                SetVeriSignNameStoreExtension(domainName, req);
                return(req);
            }

            case EppQueueCommands.ContactCheck:
            {
                return(new ReqContactCheck(new List <string>()
                    {
                        "CONTACT_ID"
                    })
                    {
                        DomainName = domainName
                    });
            }

            case EppQueueCommands.ContactCreate:
            {
                return(new ReqContactCreate("CONTACT_ID",
                                            new List <PostalInfo>()
                    {
                        new PostalInfo(
                            "NAME",
                            PostalInfo.PostalType.Int,
                            new AddressInfo("CITY", "COUNTRY_CODE")
                        {
                            PostalCode = "POSTAL_CODE", Streets = new List <string>()
                            {
                                "STREET_LINE_1", "STREET_LINE_1"
                            }
                        })
                    }
                                            ,
                                            "*****@*****.**",
                                            null)
                    {
                        Fax = "FAX",
                        Voice = new VoiceInfo("PHONE"),
                        AuthInfo = new AuthInfo("PASSWORD"),
                        DomainName = domainName
                    }
                       );
            }

            case EppQueueCommands.ContactDelete:
            {
                return(new ReqContactDelete("CONTACT_ID")
                    {
                        DomainName = domainName
                    });
            }

            case EppQueueCommands.ContactUpdate:
            {
                ReqContactUpdate h = new ReqContactUpdate("CONTACT_ID")
                {
                    DomainName = domainName
                };
                h.Chg = new ContactChangeType();

                //email degiscek mi
                h.Chg.Email = "*****@*****.**";
                h.Chg.Fax   = "FAX";
                h.Chg.Voice = new VoiceInfo("PHONE");

                h.Chg.PostalInfos = new List <PostalInfo>()
                {
                    new PostalInfo(
                        "NAME",
                        PostalInfo.PostalType.Int,
                        new AddressInfo("CITY", "COUNTRY_CODE")
                        {
                            PostalCode = "POSTAL_CODE", Streets = new List <string>()
                            {
                                "STREET_LINE_1", "STREET_LINE_1"
                            }
                        })
                };

                return(h);
            }

            case EppQueueCommands.ContactInfo:
            {
                return(new ReqContactInfo("CONTACT_ID", new AuthInfo("PASSWORD"))
                    {
                        DomainName = domainName
                    });
            }

            case EppQueueCommands.ContactTransferRequest:
            {
                return(new ReqContactTransferRequest()
                    {
                        AuthInfo = new AuthInfo("PASSWORD"), DomainName = domainName, Id = "CONTACT_ID"
                    });
            }

            case EppQueueCommands.ContactTransferQuery:
            {
                return(new ReqContactTransferQuery()
                    {
                        AuthInfo = new AuthInfo("PASSWORD"), DomainName = domainName, Id = "CONTACT_ID"
                    });
            }

            case EppQueueCommands.ContactTransferCancel:
            {
                return(new ReqContactTransferCancel()
                    {
                        AuthInfo = new AuthInfo("PASSWORD"), DomainName = domainName, Id = "CONTACT_ID"
                    });
            }

            case EppQueueCommands.ContactTransferApprove:
            {
                return(new ReqContactTransferApprove()
                    {
                        AuthInfo = new AuthInfo("PASSWORD"), DomainName = domainName, Id = "CONTACT_ID"
                    });
            }

            case EppQueueCommands.ContactTransferReject:
            {
                return(new ReqContactTransferReject()
                    {
                        AuthInfo = new AuthInfo("PASSWORD"), DomainName = domainName, Id = "CONTACT_ID"
                    });
            }

            case EppQueueCommands.HostCheck:
            {
                return(new ReqHostCheck(new List <string>()
                    {
                        "HOST_NAME"
                    })
                    {
                        DomainName = domainName
                    });
            }

            case EppQueueCommands.HostCreate:
            {
                return(new ReqHostCreate("HOST_NAME", new[] { "IP1", "IP2" }.Select(x => new IpAddress(x)).ToList())
                    {
                        DomainName = domainName
                    });
            }

            case EppQueueCommands.HostDelete:
            {
                return(new ReqHostDelete("HOST_NAME")
                    {
                        DomainName = domainName
                    });
            }

            case EppQueueCommands.HostUpdate:
            {
                List <string> addAdress = new List <string>()
                {
                    "add_IP1", "add_IP2"
                };
                List <string> remAdress = new List <string>()
                {
                    "rem_IP1", "rem_IP2"
                };

                ReqHostUpdate hArgs = new ReqHostUpdate("HOST_NAME")
                {
                    DomainName = domainName
                };

                if (addAdress.Count != 0 && !string.IsNullOrEmpty(addAdress[0]))
                {
                    hArgs.Add = new HostAddRemType(addAdress.Select(x => new IpAddress(IpAddress.IpAddressType.V4, x)).ToList());
                }

                if (remAdress.Count != 0 && !string.IsNullOrEmpty(addAdress[0]))
                {
                    hArgs.Rem = new HostAddRemType(remAdress.Select(x => new IpAddress(IpAddress.IpAddressType.V4, x)).ToList());
                }

                hArgs.Chg = "NEW_HOST_NAME";

                return(hArgs);
            }

            case EppQueueCommands.HostInfo:
            {
                return(new ReqHostInfo("HOST_NAME")
                    {
                        DomainName = domainName
                    });
            }

            case EppQueueCommands.FinanceInfo:
            {
                return(new ReqFinanceInfo()
                    {
                        DomainName = domainName
                    });
            }

            case EppQueueCommands.PollRequest:
            {
                return(new ReqPollRequest {
                        DomainName = domainName, ClientTranId = "IdontKnow"
                    });
            }

            case EppQueueCommands.PollAcknowledge:
            {
                return(new ReqPollAcknowledge {
                        DomainName = domainName, MessageId = "MESSAGE_ID"
                    });
            }
            }

            throw new Exception("No such EPP command");
        }