- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.5k
[Components] opensrs - new components #15454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
      
        
          +1,636
        
        
          −9
        
        
          
        
      
    
  
  
     Merged
                    Changes from all commits
      Commits
    
    
  File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
        
          
          
            157 changes: 157 additions & 0 deletions
          
          157 
        
  components/opensrs/actions/initiate-domain-transfer/initiate-domain-transfer.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,157 @@ | ||
| import app from "../../opensrs.app.mjs"; | ||
| import utils from "../../common/utils.mjs"; | ||
| import constants from "../../common/constants.mjs"; | ||
|  | ||
| export default { | ||
| key: "opensrs-initiate-domain-transfer", | ||
| name: "Initiate Domain Transfer", | ||
| description: "Initiate a domain transfer to OpenSRS. [See the documentation](https://domains.opensrs.guide/docs/trade_domain).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| domain: { | ||
| propDefinition: [ | ||
| app, | ||
| "domain", | ||
| ], | ||
| }, | ||
| email: { | ||
| type: "string", | ||
| label: "Email", | ||
| description: "The email address of the new owner of the domain.", | ||
| }, | ||
| firstName: { | ||
| type: "string", | ||
| label: "First Name", | ||
| description: "The first name of the new owner of the domain.", | ||
| }, | ||
| lastName: { | ||
| type: "string", | ||
| label: "Last Name", | ||
| description: "The last name of the new owner of the domain.", | ||
| }, | ||
| orgName: { | ||
| type: "string", | ||
| label: "Organization Name", | ||
| description: "The organization name of the new owner of the domain.", | ||
| }, | ||
| phone: { | ||
| type: "string", | ||
| label: "Phone", | ||
| description: "The phone number of the new owner of the domain. Required for all except `.BE`.", | ||
| optional: true, | ||
| }, | ||
| address1: { | ||
| type: "string", | ||
| label: "Address 1", | ||
| description: "The first line of the address of the new owner of the domain. Required for all except `.BE`.", | ||
| optional: true, | ||
| }, | ||
| city: { | ||
| type: "string", | ||
| label: "City", | ||
| description: "The city of the new owner of the domain. Required for all except `.BE`.", | ||
| optional: true, | ||
| }, | ||
| country: { | ||
| type: "string", | ||
| label: "Country", | ||
| description: "The country of the new owner of the domain. Required for all except `.BE`.", | ||
| optional: true, | ||
| }, | ||
| state: { | ||
| type: "string", | ||
| label: "State", | ||
| description: "The state of the new owner of the domain. Required for all except `.BE`.", | ||
| optional: true, | ||
| }, | ||
| postalCode: { | ||
| type: "string", | ||
| label: "Postal Code", | ||
| description: "The postal code of the new owner of the domain. Required for all except `.BE`.", | ||
| optional: true, | ||
| }, | ||
| domainAuthInfo: { | ||
| type: "string", | ||
| label: "Domain Authorization Info", | ||
| description: "The authorization code required for domain transfer. Required for `.BE`.", | ||
| optional: true, | ||
| }, | ||
| jsonOutput: { | ||
| type: "boolean", | ||
| label: "JSON Output", | ||
| description: "Whether to output the response in JSON format.", | ||
| optional: true, | ||
| default: true, | ||
| }, | ||
| }, | ||
| methods: { | ||
| getJsonBody() { | ||
| const { | ||
| domain, | ||
| email, | ||
| firstName, | ||
| lastName, | ||
| orgName, | ||
| phone, | ||
| address1, | ||
| city, | ||
| country, | ||
| state, | ||
| postalCode, | ||
| domainAuthInfo, | ||
| } = this; | ||
|  | ||
| return { | ||
| data_block: { | ||
| dt_assoc: { | ||
| item: [ | ||
| ...utils.addItem("protocol", constants.PROTOCOL.XCP), | ||
| ...utils.addItem("object", constants.OBJECT_TYPE.DOMAIN), | ||
| ...utils.addItem("action", constants.ACTION_TYPE.TRADE_DOMAIN), | ||
| { | ||
| "@_key": "attributes", | ||
| "dt_assoc": { | ||
| item: [ | ||
| ...utils.addItem("domain", domain), | ||
| ...utils.addItem("email", email), | ||
| ...utils.addItem("first_name", firstName), | ||
| ...utils.addItem("last_name", lastName), | ||
| ...utils.addItem("org_name", orgName), | ||
| ...utils.addItem("phone", phone), | ||
| ...utils.addItem("address1", address1), | ||
| ...utils.addItem("city", city), | ||
| ...utils.addItem("country", country), | ||
| ...utils.addItem("state", state), | ||
| ...utils.addItem("postal_code", postalCode), | ||
| ...utils.addItem("domain_auth_info", domainAuthInfo), | ||
| ], | ||
| }, | ||
| }, | ||
| ], | ||
| }, | ||
| }, | ||
| }; | ||
| }, | ||
| initiateDomainTransfer(args = {}) { | ||
| return this.app.post(args); | ||
| }, | ||
|         
                  jcortes marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| initiateDomainTransfer, | ||
| getJsonBody, | ||
| jsonOutput, | ||
| } = this; | ||
|  | ||
| const response = await initiateDomainTransfer({ | ||
| $, | ||
| jsonBody: getJsonBody(), | ||
| jsonOutput, | ||
| }); | ||
|  | ||
| $.export("$summary", "Successfully initiated domain transfer."); | ||
| return response; | ||
| }, | ||
|         
                  jcortes marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| }; | ||
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.