import BaseTransaction from '../../common/base_transaction' ; import Options from '../../common/options' ; import Oneclick from '.' ; import { DeleteRequest , FinishRequest , StartRequest } from './requests' ; import RequestService from '../../common/request_service' ; import ValidationUtil from '../../common/validation_util' ; import ApiConstants from '../../common/api_constants' ; import IntegrationCommerceCodes from '../../common/integration_commerce_codes' ; import IntegrationApiKeys from '../../common/integration_api_keys' ; import Environment from '../common/environment' ; class MallInscription extends BaseTransaction { param options constructor ( options ) { options = options || Oneclick . getDefaultOptions ( ) || new Options ( IntegrationCommerceCodes . ONECLICK_MALL , IntegrationApiKeys . WEBPAY , Environment . Integration ) ; super ( options ) ; } param username param email param responseUrl start ( username , email , responseUrl ) { ValidationUtil . hasTextTrimWithMaxLength ( username , ApiConstants . USER_NAME_LENGTH , "username" ) ; ValidationUtil . hasTextTrimWithMaxLength ( email , ApiConstants . EMAIL_LENGTH , "email" ) ; ValidationUtil . hasTextWithMaxLength ( responseUrl , ApiConstants . RETURN_URL_LENGTH , "responseUrl" ) ; let startRequest = new StartRequest ( username , email , responseUrl ) ; return RequestService . perform ( startRequest , this . options ) ; } param token finish ( token ) { ValidationUtil . hasTextWithMaxLength ( token , ApiConstants . TOKEN_LENGTH , "token" ) ; return RequestService . perform ( new FinishRequest ( token ) , this . options ) ; } param tbkUser param username delete ( tbkUser , username ) { ValidationUtil . hasTextTrimWithMaxLength ( username , ApiConstants . USER_NAME_LENGTH , "username" ) ; ValidationUtil . hasTextWithMaxLength ( tbkUser , ApiConstants . TBK_USER_LENGTH , "tbkUser" ) ; return RequestService . perform ( new DeleteRequest ( tbkUser , username ) , this . options ) ; } } ; export default MallInscription ;