developer:soap-1.6:methods:converttrantocust

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

developer:soap-1.6:methods:converttrantocust [2012/08/04 10:09] (current)
tem created
Line 1: Line 1:
 +<embed ..:​contents/>​
 +====== convertTranToCust ======
 +
 +Convert existing transaction to stored customer.
 +
 +
 +
 +===== Description =====
 +
 +This method copies the credit card/check data, card holder name and address information from an existing transaction and uses it to create a new customer record to be stored in the Customer Database. By default, the customer will be created with recurring billing disabled. ​
 +
 +The method returns the new CustNum (customer number). Optional customer fields can be created using the UpdateData parameter. See the [[quickUpdateCustomer]] method for details on what fields may be set.
 +
 +Only information entered in the original transaction will be saved. To input additional data, use the [[updateCustomer]] or [[quickUpdateCustomer]] methods. [[updateCustomer]] will replace all existing customer data, while [[quickUpdateCustomer]] allows you to update selected fields only.
 +
 +Possible fields are:
 +
 +  * FirstName ​
 +  * LastName ​
 +  * CustomerID ​
 +  * Company ​
 +  * Address ​
 +  * Address2 ​
 +  * City 
 +  * State 
 +  * Zip 
 +  * Country ​
 +  * Phone 
 +  * Fax 
 +  * Email 
 +  * URL 
 +  * ReceiptNote ​
 +  * SendReceipt ​
 +  * Notes 
 +  * Description
 +  * OrderID
 +  * Enabled
 +  * Schedule ​
 +  * Next 
 +  * NumLeft ​
 +  * Amount ​
 +  * CustomData ​
 +  * Source
 +  * User
 +  * Card Number
 +  * Card Expiration
 +  * Account Number
 +  * Routing Number
 +
 +===== Syntax =====
 +
 +string **convertTranToCust** ( [[developer:​soap:​objects:​ueSecurityToken]] Token, integer RefNum, [[developer:​soap:​objects:​FieldValue]] UpdateData )
 +
 +===== Arguments =====
 +
 +^Type    ^Name    ^Description ​   ^
 +|[[developer:​soap:​objects:​ueSecurityToken]] |Token |Merchant security token: used to identify merchant and validate transaction.|
 +|integer |RefNum |Transaction Reference number assigned by the gateway.|
 +|[[developer:​soap:​objects:​FieldValue]] |UpdateData |Recurring| ​
 +
 +===== Return Value =====
 +
 +|string |Returns the CustNum of the new customer. |
 +
 +===== Examples =====
 +
 +==== PHP ====
 +
 +
 +For directions on how to set up the WSDL link, create "​$token"​ and "​$client",​ go to [[..:​howto:​php|PHP Soap How-to]].
 +
 +
 +<code php>
 +  ​
 +try {
 +  // Set RefNum to the Reffernce Num of the 
 +  //​transaction you want to convert to a customer
 +  $RefNum="​123456789";​
 +
 +  // Creating customer, saving exact time and verifying customer was created.
 +  $RecurringBillData = array(
 +    array('​Field'​=>'​NumLeft',​ '​Value'​=>'​10'​),​
 + array('​Field'​=>'​Amount',​ '​Value'​=>'​7.40'​),​
 + array('​Field'​=>'​Description',​ '​Value'​=>'​Monthly Bill'​),​
 + array('​Field'​=>'​Schedule',​ '​Value'​=>'​Monthly'​),​
 + array('​Field'​=>'​Enabled',​ '​Value'​=>'​Yes'​),​
 +  );
 +
 +  $custnum = $client->​convertTranToCust($token,​ $RefNum, $RecurringBillData);​
 +}  catch(Exception $e) { 
 +  echo '​Error:​ ' . $e->​getMessage(); ​
 +
 +
 +</​code>​
 +
 +==== Java ====
 +
 +This example uses the [[developer/​javalibrary|USAePay Java library]]. ​ For directions on how to install the library and create the token/​client objects, go to either the [[..:​howto:​javajaxrpc|Java JAX-RPC Howto]] or the [[..:​howto:​javajaxws|Java JAX-WS Howto]].
 +
 +
 +<code java>
 +try {
 +
 +//​Transaction Reffernce Number to convert to a customer
 +BigInteger RefNum = new BigInteger('​123456'​);​
 +
 +//Setting up the Field Value array for updated data specific to the customer
 +FieldValueArray UpdateData = new FieldValueArray();​
 +UpdateData.add(new FieldValue("​Schedule",​ "​weekly"​));​
 +UpdateData.add(new FieldValue("​NumLeft",​ "​7"​));​
 +
 +//​Converting to a customer
 +BigInteger CustNum = client.convertTranToCust(token,​ RefNum,​UpdateData);​
 +
 +} catch (Exception e) {
 + System.out.println("​Soap Exception: " + e.getMessage());​
 +}
 +</​code>​
 +
 +==== .NET VB ====
 +<code vb>
 +Dim refnum As String
 +        refnum = "​46978031"​
 +        Dim update(0 To 1) As usaepay.FieldValue
 +        For i As Integer = 0 To 1
 +            update(i) = New usaepay.FieldValue
 +        Next
 +
 +        update(0).Field = "​Schedule"​
 +        update(0).Value = "​weekly"​
 +        update(1).Field = "​NumLeft"​
 +        update(1).Value = "​7"​
 +
 +        Dim response As String
 +        response = client.convertTranToCust(token,​ refnum, update)
 +        MsgBox(response)
 +</​code>​
 +
 +==== .NET C# ====
 +For directions on how to set up the WSDL link and create the "​token"​ and "​client"​ variables, go to the [[..:​howto:​csharp|C Sharp .Net Soap How-to]].
 +<code c>
 +            string refnum = "​46978031";​
 +            usaepay.FieldValue[] update = new usaepay.FieldValue[2];​
 +            for (int i = 0; i < 2; i++) {
 +
 +                update[i] = new usaepay.FieldValue();​
 +
 +            }
 +
 +            update[0].Field = "​Schedule";​ update[0].Value = "​weekly";​
 +            update[1].Field = "​NumLeft";​ update[1].Value = "​7";​
 +
 +            string response;
 +
 +            try
 +            {
 +                response = client.convertTranToCust(token,​ refnum, update);
 +
 +                MessageBox.Show(string.Concat("​Customer Number: ",
 +                            response));
 +              ​
 +            }
 +
 +
 +            catch (Exception err)
 +            {
 +                MessageBox.Show(err.Message);​
 +            }
 +</​code>​
 +
 +===== Change History =====
 +
 +^ Version ^ Change ^
 +| 1.0 | Method added in soap v1.0 |
  
developer/soap-1.6/methods/converttrantocust.txt ยท Last modified: 2012/08/04 10:09 by tem

Page Tools