Orders-orderId-account-paymentInfo:PUT

(Difference between revisions)
Jump to: navigation, search
m (1 revision: Release 98)
Line 53: Line 53:
  
 
; creditCardType - ''string''
 
; creditCardType - ''string''
: The type of credit card - '''visa''', '''mastercard''', '''discover''', '''amex''', '''discover''', '''switch''', '''solo''', '''delta''', '''korean''', '''jcb'''. Required if paymentInfoType is set to '''credit_card'''.
+
: The type of credit card - '''visa''', '''mastercard''', '''discover''', '''amex'''. Required if paymentInfoType is set to '''credit_card'''.
  
 
; expirationDate - ''string''
 
; expirationDate - ''string''
Line 63: Line 63:
 
; billingAddress - ''dictionary''
 
; billingAddress - ''dictionary''
 
: Contains the credit card's billing address. Required if paymentInfoType is set to '''credit_card'''.
 
: Contains the credit card's billing address. Required if paymentInfoType is set to '''credit_card'''.
 
  
 
== Response ==
 
== Response ==
Line 77: Line 76:
 
| The operation was successfully completed.
 
| The operation was successfully completed.
 
|-
 
|-
| rowspan="9" | 400 Bad Request
+
| rowspan="10" | 400 Bad Request
 
| rowspan="2" | POST data error
 
| rowspan="2" | POST data error
 
| A required attribute for the payment info type is missing.  
 
| A required attribute for the payment info type is missing.  
 
|-
 
|-
 
| paymentInfoType can only be credit_card.
 
| paymentInfoType can only be credit_card.
 +
|-
 +
| declined
 +
| Invalid verificationNumber
 
|-
 
|-
 
| Invalid date format
 
| Invalid date format
 
| Wrong expirationDate format
 
| Wrong expirationDate format
 
|-
 
|-
! colspan="2" | Validation Error
+
| rowspan="4" | invalid number or type
|-
+
| rowspan="4" | ... Code: cc_auth_failed, invalid number or type
+
 
| creditCardType can be only one of visa, mastercard, amex, discover.
 
| creditCardType can be only one of visa, mastercard, amex, discover.
 
|-
 
|-
| cc number with wrong length
+
| Credit card number with wrong length
 
|-
 
|-
| cc number does not comply with visa rules
+
| Credit card number does not comply with visa rules
 
|-
 
|-
 
| expirationDate set in past
 
| expirationDate set in past
 
|-
 
|-
| ...: Input strings must be a multiple of 16 in length
+
| Incorrect padding
| hyphens or spaces in cc number are not allowed
+
| Hyphens or spaces in credit card number are not allowed
 +
|-
 +
| Input strings must be a multiple of 16 in length
 +
| Credit card number length should be 16.
 
|-
 
|-
 
| 401 Unauthorized
 
| 401 Unauthorized
 
| align="center" | -
 
| align="center" | -
 
| No owner Id specified or the specified owner is not authorized to add payment info.
 
| No owner Id specified or the specified owner is not authorized to add payment info.
 +
|-
 +
| 403 Forbidden
 +
| Unauthorized: PaymentInfo failed permission check
 +
| An unauthorized user cannot set or get payment info.
 
|-
 
|-
 
| 404 Not Found
 
| 404 Not Found
Line 108: Line 115:
 
| The specified order does not exist.
 
| The specified order does not exist.
 
|-
 
|-
| 502 Bad Gateway
+
| rowspan="2" | 502 Bad Gateway
| align="center" | -
+
| rowspan="2" align="center" | -
 
| An account has not been added to the given order.
 
| An account has not been added to the given order.
 +
|-
 +
| Unexpected backend error.
 
|}
 
|}
  
Line 226: Line 235:
 
}</nowiki>
 
}</nowiki>
  
=== Credit card number with hyphens ===
+
=== Credit card number length exceeds 16 characters ===
 
'''Request'''
 
'''Request'''
 
  <nowiki>
 
  <nowiki>
Line 238: Line 247:
 
   "creditCardType": "visa",
 
   "creditCardType": "visa",
 
   "expirationDate": "2012-08",
 
   "expirationDate": "2012-08",
 +
  "verificationNumber": "505",
 
   "billingAddress": {
 
   "billingAddress": {
 
     "city": "Chicago",
 
     "city": "Chicago",
Line 256: Line 266:
 
   "badRequest": {
 
   "badRequest": {
 
     "guid": "f5ed5738-086d-4751-8ad5-0dfead39ea3a",
 
     "guid": "f5ed5738-086d-4751-8ad5-0dfead39ea3a",
     "message": "<class 'order_builder.bl.validation.ValidationError.ValidationError'>: Code: cc_auth_failed,
+
     "message": "Input strings must be a multiple of 16 in length",
traceBack:   File \"/var/lib/python-support/python2.5/hwm/encryption/encryptDecrypt.py\", line 106, in decrypt\n   
+
    "code": 400,
dtext = self.encryptor.decrypt(cc)\n   File \"build/bdist.linux-x86_64/egg/Crypto/Cipher/blockalgo.py\", line 295, in decrypt\n   
+
    "details": ""
return self._cipher.decrypt(ciphertext)\nValueError'>: Input strings must be a multiple of 16 in length\n",
+
  }
 +
}</nowiki>
 +
 
 +
=== Credit card number cannot contain hyphens ===
 +
'''Request'''
 +
<nowiki>
 +
PUT /orders/{orderId}/account/paymentInfo
 +
Cookie: OwnerId={owner_id}; Path=/
 +
 
 +
{
 +
  "paymentInfoType": "credit_card",
 +
  "accountNumber": "4111-111-111-111",
 +
   "cardHolderName": "John Smith",
 +
  "creditCardType": "visa",
 +
  "expirationDate": "2012-08",
 +
  "verificationNumber": "505",
 +
  "billingAddress": {
 +
    "city": "Chicago",
 +
    "countryCode": "US",
 +
    "postalCode": "60606",
 +
    "stateOrProvince": "IL",
 +
    "street1": "100 N Riverside",
 +
    "street2": ""
 +
  }
 +
}</nowiki>
 +
 
 +
'''Response'''
 +
<nowiki>
 +
400 Bad Request
 +
Content-Type : application/json; charset=UTF-8
 +
 
 +
{
 +
  "computeFault": {
 +
    "guid": "5a757a5a-870e-4d4f-acdf-aed95e066b3d",
 +
    "message": "Incorrect padding",
 
     "code": 400,
 
     "code": 400,
 
     "details": ""
 
     "details": ""
Line 277: Line 321:
 
   "creditCardType": "visa",
 
   "creditCardType": "visa",
 
   "expirationDate": "2012-08",
 
   "expirationDate": "2012-08",
 +
  "verificationNumber": "505",
 
   "billingAddress": {
 
   "billingAddress": {
 
     "city": "Chicago",
 
     "city": "Chicago",
Line 295: Line 340:
 
   "badRequest": {
 
   "badRequest": {
 
     "guid": "ced1a8a8-21dc-4a10-9d36-5a201214a5ce",
 
     "guid": "ced1a8a8-21dc-4a10-9d36-5a201214a5ce",
     "message": "<class 'order_builder.bl.validation.ValidationError.ValidationError'>: Code: cc_auth_failed, invalid number or type",
+
     "message": "invalid number or type",
 
     "code": 400,
 
     "code": 400,
 
     "details": ""
 
     "details": ""
 +
  }
 +
}</nowiki>
 +
 +
=== Invalid verification number ===
 +
'''Request'''
 +
<nowiki>
 +
PUT /orders/{orderId}/account/paymentInfo
 +
Cookie: OwnerId={owner_id}; Path=/
 +
 +
{
 +
  "paymentInfoType": "credit_card",
 +
  "creditCardType": "visa",
 +
  "accountNumber": "4111111111111111",
 +
  "cardHolderName": "John Jello",
 +
  "expirationDate": "2015-06",
 +
  "verificationNumber": "0000",
 +
  "billingAddress": {"street1": "100 n riverside",
 +
    "street2": "ste 800",
 +
    "city": "Chicago",
 +
    "stateOrProvince": "IL",
 +
    "postalCode": "60606",
 +
    "countryCode": "US"
 +
  }
 +
}</nowiki>
 +
 +
'''Response'''
 +
<nowiki>
 +
400 Bad Request
 +
Content-Type : application/json; charset=UTF-8
 +
 +
{
 +
  "computeFault" : {
 +
    "guid" : "031b8bc2-8da3-41c7-860c-ca3743cef135",
 +
    "message" : "declined",
 +
    "code" : 400,
 +
    "details" : ""
 
   }
 
   }
 
}</nowiki>
 
}</nowiki>
Line 313: Line 394:
 
   "creditCardType": "visa",
 
   "creditCardType": "visa",
 
   "expirationDate": "15-06",
 
   "expirationDate": "15-06",
 +
  "verificationNumber": "505",
 
   "billingAddress": {
 
   "billingAddress": {
 
     "city": "Chicago",
 
     "city": "Chicago",
Line 333: Line 415:
 
     "message": "Invalid date format",
 
     "message": "Invalid date format",
 
     "code": 400,
 
     "code": 400,
 +
    "details": ""
 +
  }
 +
}</nowiki>
 +
 +
=== No authorization ===
 +
'''Request'''
 +
<nowiki>
 +
PUT /orders/{orderId}/account/paymentInfo
 +
Cookie: OwnerId={wrong_owner_id}; Path=/
 +
 +
{
 +
  "paymentInfoType": "credit_card",
 +
  "creditCardType": "visa",
 +
  "accountNumber": "4111111111111111",
 +
  "cardHolderName":
 +
  "John Jello",
 +
  "expirationDate":
 +
  "2015-06",
 +
  "verificationNumber": "505",
 +
  "billingAddress": {
 +
    "street1": "100 n riverside",
 +
    "street2": "ste 800",
 +
    "city": "Chicago",
 +
    "stateOrProvince": "IL",
 +
    "postalCode": "60606",
 +
    "countryCode": "US"
 +
  }
 +
}</nowiki>
 +
 +
'''Response'''
 +
<nowiki>
 +
401 Unauthorized
 +
Content-Type : text/plain; charset=UTF-8
 +
 +
401 Unauthorized
 +
 +
This server could not verify that you are authorized to access the document you requested.
 +
Either you supplied the wrong credentials (e.g., bad password),
 +
or your browser does not understand how to supply the credentials required.</nowiki>
 +
 +
=== Unauthorized user ===
 +
'''Request'''
 +
<nowiki>
 +
PUT /orders/{orderId}/account/paymentInfo
 +
Authorization: Basic {wrong_user_authorization}
 +
 +
{
 +
  "paymentInfoType": "credit_card",
 +
  "creditCardType": "visa",
 +
  "accountNumber": "4111111111111111",
 +
  "cardHolderName":
 +
  "John Jello",
 +
  "expirationDate":
 +
  "2015-06",
 +
  "verificationNumber": "505",
 +
  "billingAddress": {
 +
    "street1": "100 n riverside",
 +
    "street2": "ste 800",
 +
    "city": "Chicago",
 +
    "stateOrProvince": "IL",
 +
    "postalCode": "60606",
 +
    "countryCode": "US"
 +
  }
 +
}</nowiki>
 +
 +
'''Response'''
 +
<nowiki>
 +
403 Forbidden
 +
Content-Type : application/json; charset=UTF-8
 +
 +
{
 +
  "forbidden": {
 +
    "guid": "5a199170-843a-44fc-bbb0-87155eb15fc6",
 +
    "message": "Unauthorized: PaymentInfo failed permission check",
 +
    "code": 403,
 
     "details": ""
 
     "details": ""
 
   }
 
   }

Revision as of 08:25, 1 October 2014

PUT /orders/{orderId}/account/paymentInfo

Set the account's payment information for a given order.

Contents


Request

PUT /orders/{orderId}/account/paymentInfo

Request Parameters

orderId - string
The unique order Id. The URI of the order is returned by the POST /orders call.
contact_type - string
Contact Type (regular, billing, administrator or technical)

URI Parameters

None.

Request Headers

Content-Type
Required. Set this header to application/json; charset=UTF-8
Cookie
A cookie named OwnerId to identify the client (for most browser clients, the browser will do this automatically, depending on the browser configuration). The value of the cookie would come from the response to the create order request in the Set-Cookie response header.

Request Body

The request format depends on the type of payment method that is added. The following format is required for credit cards.

{
  "paymentInfoType": "credit_card",
  "accountNumber": "4111111111111111",
  "cardHolderName": "John Smith",
  "creditCardType": "visa",
  "expirationDate": "2012-08",
  "verificationNumber": "123",
  "billingAddress": {
    "city": "Chicago",
    "countryCode": "US",
    "postalCode": "60606",
    "stateOrProvince": "IL",
    "street1": "100 N Riverside",
    "street2": ""
  } 
}

Parameters

paymentInfoType - string
The type of payment method that will be used. Allowed value(s) are:
credit_card
accountNumber - string
Credit card number. Must consist of numbers only. Required if paymentInfoType is set to credit_card.
cardHolderName - string
The owner name as it appears on the card. Required if paymentInfoType is set to credit_card.
creditCardType - string
The type of credit card - visa, mastercard, discover, amex. Required if paymentInfoType is set to credit_card.
expirationDate - string
The credit card expiration date in YYYY-MM format. Should exceed the current date. Required if paymentInfoType is set to credit_card.
verificationNumber - string
The credit card security code. This is only used to validate the credit card and will not be stored. Required if paymentInfoType is set to credit_card.
billingAddress - dictionary
Contains the credit card's billing address. Required if paymentInfoType is set to credit_card.

Response

Status Code

Status Code Error Message Description
204 No Content - The operation was successfully completed.
400 Bad Request POST data error A required attribute for the payment info type is missing.
paymentInfoType can only be credit_card.
declined Invalid verificationNumber
Invalid date format Wrong expirationDate format
invalid number or type creditCardType can be only one of visa, mastercard, amex, discover.
Credit card number with wrong length
Credit card number does not comply with visa rules
expirationDate set in past
Incorrect padding Hyphens or spaces in credit card number are not allowed
Input strings must be a multiple of 16 in length Credit card number length should be 16.
401 Unauthorized - No owner Id specified or the specified owner is not authorized to add payment info.
403 Forbidden Unauthorized: PaymentInfo failed permission check An unauthorized user cannot set or get payment info.
404 Not Found Resource not found The specified order does not exist.
502 Bad Gateway - An account has not been added to the given order.
Unexpected backend error.

Response Body

None.


Example

Success

Request

PUT /orders/{orderId}/account/paymentInfo
Cookie: OwnerId={owner_id}; Path=/

{
  "paymentInfoType": "credit_card",
  "creditCardType": "visa",
  "accountNumber": "4111111111111111",
  "cardHolderName":
  "John Jello",
  "expirationDate":
  "2015-06",
  "verificationNumber": "505",
  "billingAddress": {
    "street1": "100 n riverside",
    "street2": "ste 800",
    "city": "Chicago",
    "stateOrProvince": "IL",
    "postalCode": "60606",
    "countryCode": "US"
  }
}

Response

204 No Content

Invalid payment info type

Request

PUT /orders/{orderId}/account/paymentInfo
Cookie: OwnerId={owner_id}; Path=/

{
  "paymentInfoType": "direct_debit",
  "creditCardType": "visa",
  "accountNumber": "4111111111111111",
  "cardHolderName":
  "John Jello",
  "expirationDate":
  "2015-06",
  "verificationNumber": "505",
  "billingAddress": {
    "street1": "100 n riverside",
    "street2": "ste 800",
    "city": "Chicago",
    "stateOrProvince": "IL",
    "postalCode": "60606",
    "countryCode": "US"
  }
}

Response

400 Bad Request
Content-Type : application/json; charset=UTF-8

{
  "badRequest": {
    "guid": "7ca8b2cc-88d5-4e5b-aab8-e4015a5b3ad8",
    "message": "POST data error",
    "code": 400,
    "details": {
      "paymentInfoType": "\"direct_debit\" is not one of credit_card, vz_payment"
    }
  }
}

Missing attribute for paymentInfoType credit_card

Request

PUT /orders/{orderId}/account/paymentInfo
Cookie: OwnerId={owner_id}; Path=/

{
  "paymentInfoType": "credit_card",
  "accountNumber": "4111111111111111",
  "cardHolderName": "John Smith",
  "creditCardType": "visa",
  "expirationDate": "2012-08",
  "billingAddress": {
    "city": "Chicago",
    "countryCode": "US",
    "postalCode": "60606",
    "stateOrProvince": "IL",
    "street1": "100 N Riverside",
    "street2": ""
  }
}

Response

400 Bad Request
Content-Type : application/json; charset=UTF-8

{
  "badRequest": {
    "guid": "2829e9e2-04e1-4fe2-8e05-be738b4c467c",
    "message": "POST data error",
    "code": 400,
    "details": {
      "verificationNumber": "Required"
    }
  }
}

Credit card number length exceeds 16 characters

Request

PUT /orders/{orderId}/account/paymentInfo
Cookie: OwnerId={owner_id}; Path=/

{
  "paymentInfoType": "credit_card",
  "accountNumber": "4111-1111-1111-1111",
  "cardHolderName": "John Smith",
  "creditCardType": "visa",
  "expirationDate": "2012-08",
  "verificationNumber": "505",
  "billingAddress": {
    "city": "Chicago",
    "countryCode": "US",
    "postalCode": "60606",
    "stateOrProvince": "IL",
    "street1": "100 N Riverside",
    "street2": ""
  }
}

Response

400 Bad Request
Content-Type : application/json; charset=UTF-8

{
  "badRequest": {
    "guid": "f5ed5738-086d-4751-8ad5-0dfead39ea3a",
    "message": "Input strings must be a multiple of 16 in length",
    "code": 400,
    "details": ""
  }
}

Credit card number cannot contain hyphens

Request

PUT /orders/{orderId}/account/paymentInfo
Cookie: OwnerId={owner_id}; Path=/

{
  "paymentInfoType": "credit_card",
  "accountNumber": "4111-111-111-111",
  "cardHolderName": "John Smith",
  "creditCardType": "visa",
  "expirationDate": "2012-08",
  "verificationNumber": "505",
  "billingAddress": {
    "city": "Chicago",
    "countryCode": "US",
    "postalCode": "60606",
    "stateOrProvince": "IL",
    "street1": "100 N Riverside",
    "street2": ""
  }
}

Response

400 Bad Request
Content-Type : application/json; charset=UTF-8

{
  "computeFault": {
    "guid": "5a757a5a-870e-4d4f-acdf-aed95e066b3d",
    "message": "Incorrect padding",
    "code": 400,
    "details": ""
  }
}

Credit card number with wrong length

Request

PUT /orders/{orderId}/account/paymentInfo
Cookie: OwnerId={owner_id}; Path=/

{
  "paymentInfoType": "credit_card",
  "accountNumber": "411111111111111122",
  "cardHolderName": "John Smith",
  "creditCardType": "visa",
  "expirationDate": "2012-08",
  "verificationNumber": "505",
  "billingAddress": {
    "city": "Chicago",
    "countryCode": "US",
    "postalCode": "60606",
    "stateOrProvince": "IL",
    "street1": "100 N Riverside",
    "street2": ""
  }
}

Response

400 Bad Request
Content-Type : application/json; charset=UTF-8

{
  "badRequest": {
    "guid": "ced1a8a8-21dc-4a10-9d36-5a201214a5ce",
    "message": "invalid number or type",
    "code": 400,
    "details": ""
  }
}

Invalid verification number

Request

PUT /orders/{orderId}/account/paymentInfo
Cookie: OwnerId={owner_id}; Path=/

{
  "paymentInfoType": "credit_card",
  "creditCardType": "visa",
  "accountNumber": "4111111111111111",
  "cardHolderName": "John Jello",
  "expirationDate": "2015-06",
  "verificationNumber": "0000",
  "billingAddress": {"street1": "100 n riverside",
    "street2": "ste 800",
    "city": "Chicago",
    "stateOrProvince": "IL",
    "postalCode": "60606",
    "countryCode": "US"
  }
}

Response

400 Bad Request
Content-Type : application/json; charset=UTF-8

{
  "computeFault" : {
    "guid" : "031b8bc2-8da3-41c7-860c-ca3743cef135",
    "message" : "declined",
    "code" : 400,
    "details" : ""
  }
}

Invalid date format

Request

PUT /orders/{orderId}/account/paymentInfo
Cookie: OwnerId={owner_id}; Path=/

{
  "paymentInfoType": "credit_card",
  "accountNumber": "4111111111111111",
  "cardHolderName": "John Smith",
  "creditCardType": "visa",
  "expirationDate": "15-06",
  "verificationNumber": "505",
  "billingAddress": {
    "city": "Chicago",
    "countryCode": "US",
    "postalCode": "60606",
    "stateOrProvince": "IL",
    "street1": "100 N Riverside",
    "street2": ""
  }
}

Response

400 Bad Request
Content-Type : application/json; charset=UTF-8

{
  "badRequest": {
    "guid": "30e66cfe-649c-4b1c-bfaf-c65caf47b99d",
    "message": "Invalid date format",
    "code": 400,
    "details": ""
  }
}

No authorization

Request

PUT /orders/{orderId}/account/paymentInfo
Cookie: OwnerId={wrong_owner_id}; Path=/

{
  "paymentInfoType": "credit_card",
  "creditCardType": "visa",
  "accountNumber": "4111111111111111",
  "cardHolderName":
  "John Jello",
  "expirationDate":
  "2015-06",
  "verificationNumber": "505",
  "billingAddress": {
    "street1": "100 n riverside",
    "street2": "ste 800",
    "city": "Chicago",
    "stateOrProvince": "IL",
    "postalCode": "60606",
    "countryCode": "US"
  }
}

Response

401 Unauthorized
Content-Type : text/plain; charset=UTF-8

401 Unauthorized

This server could not verify that you are authorized to access the document you requested.
Either you supplied the wrong credentials (e.g., bad password),
or your browser does not understand how to supply the credentials required.

Unauthorized user

Request

PUT /orders/{orderId}/account/paymentInfo
Authorization: Basic {wrong_user_authorization}

{
  "paymentInfoType": "credit_card",
  "creditCardType": "visa",
  "accountNumber": "4111111111111111",
  "cardHolderName":
  "John Jello",
  "expirationDate":
  "2015-06",
  "verificationNumber": "505",
  "billingAddress": {
    "street1": "100 n riverside",
    "street2": "ste 800",
    "city": "Chicago",
    "stateOrProvince": "IL",
    "postalCode": "60606",
    "countryCode": "US"
  }
}

Response

403 Forbidden
Content-Type : application/json; charset=UTF-8

{
  "forbidden": {
    "guid": "5a199170-843a-44fc-bbb0-87155eb15fc6",
    "message": "Unauthorized: PaymentInfo failed permission check",
    "code": 403,
    "details": ""
  }
}

Unset account for the order

Request

PUT /orders/{orderId}/account/paymentInfo
Cookie: OwnerId={owner_id}; Path=/

{
  "paymentInfoType": "credit_card",
  "creditCardType": "visa",
  "accountNumber": "4111111111111111",
  "cardHolderName":
  "John Jello",
  "expirationDate":
  "2015-06",
  "verificationNumber": "505",
  "billingAddress": {
    "street1": "100 n riverside",
    "street2": "ste 800",
    "city": "Chicago",
    "stateOrProvince": "IL",
    "postalCode": "60606",
    "countryCode": "US"
  }
}

Response

502 Bad Gateway
Content-Type : application/json; charset=UTF-8

{
  "computeFault": {
    "guid": "a4f6b310-11d9-4263-8482-81bccf261df7",
    "timestamp": "2014-09-08 08:34:20",
    "code": 502,
    "errorRefId":
    "a4f6b310-11d9-4263-8482-81bccf261df7"
  }
}

See also


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox