Trendsic Platform Service

<back to all web services

CustomerPaymentsRequest

Requires Authentication
Requires any of the roles:Agent, Administrator, Agent, Administrator, Agent, Administrator
The following routes are available for this service:
GET/v1/CustomerPayments/{OrderID}
POST,PUT,OPTIONS/v1/CustomerPayments
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomerPayment:
    id: int = 0
    customer_i_d: int = 0
    order_header_i_d: int = 0
    amount: Optional[str] = None
    approved: bool = False
    auth_code: Optional[str] = None
    card_number: Optional[str] = None
    message: Optional[str] = None
    response_code: int = 0
    transaction_id: Optional[str] = None
    transaction_date: datetime.datetime = datetime.datetime(1, 1, 1)
    full_response: Optional[str] = None
    payment_status: int = 0
    payment_type: int = 0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomerPaymentsResponse:
    response_status: Optional[ResponseStatus] = None
    payment_intent_success: bool = False
    payment_success: bool = False
    subscription_success: bool = False
    message: Optional[str] = None
    receipt_url: Optional[str] = None
    agent_number: Optional[str] = None
    client_secret: Optional[str] = None
    customer_payment: Optional[CustomerPayment] = None
    public_order_i_d: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Customer:
    id: int = 0
    customer_code: Optional[str] = None
    business_name: Optional[str] = None
    first_name: Optional[str] = None
    last_name: Optional[str] = None
    email: Optional[str] = None
    uid: Optional[str] = None
    agent_id: int = 0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PaymentInfo:
    payment_type: Optional[str] = None
    card_number: Optional[str] = None
    exp_date: Optional[str] = None
    ccv: Optional[str] = None
    stripe_token: Optional[str] = None
    agent_id: int = 0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomerPaymentsRequest:
    customer: Optional[Customer] = None
    order_i_d: Optional[str] = None
    payment_info: Optional[PaymentInfo] = None

Python CustomerPaymentsRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /v1/CustomerPayments HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	Customer: 
	{
		ID: 0,
		CustomerCode: String,
		BusinessName: String,
		FirstName: String,
		LastName: String,
		Email: String,
		UID: 00000000000000000000000000000000,
		AgentId: 0
	},
	OrderID: 00000000000000000000000000000000,
	PaymentInfo: 
	{
		PaymentType: String,
		CardNumber: String,
		ExpDate: String,
		CCV: String,
		StripeToken: String,
		AgentId: 0
	}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	},
	PaymentIntentSuccess: False,
	PaymentSuccess: False,
	SubscriptionSuccess: False,
	Message: String,
	ReceiptUrl: String,
	AgentNumber: String,
	ClientSecret: String,
	CustomerPayment: 
	{
		ID: 0,
		CustomerID: 0,
		OrderHeaderID: 0,
		Amount: String,
		Approved: False,
		AuthCode: String,
		CardNumber: String,
		Message: String,
		ResponseCode: 0,
		TransactionId: String,
		TransactionDate: 0001-01-01,
		FullResponse: String,
		PaymentStatus: 0,
		PaymentType: 0
	},
	PublicOrderID: String
}