Renamed Output 2 Destination (#13)

* Renamed Output 2 Destination

* Renamed Output 2 Destination
This commit is contained in:
Alexandra Usacheva 2018-08-03 16:20:02 +03:00 committed by GitHub
parent 5eafb9644c
commit bb283c9af6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 2333 additions and 2338 deletions

View File

@ -9,7 +9,7 @@ declare class RbkmoneyWalletUtils {
startIdentityChallenge(params: StartIdentityChallengeParams): void;
createOutput(params: CreateOutputParams): void;
createDestination(params: CreateDestinationsParams): void;
abort(): void;
@ -19,7 +19,7 @@ declare class RbkmoneyWalletUtils {
onCancelIdentityChallenge(event: IdentityChallengeEvent) => void;
onCreateOutput(event: CreateOutputEvent) => void;
onCreateDestination(event: CreateDestinationEvent) => void;
onCancel(event: CancelEvent) => void;
}
@ -33,7 +33,7 @@ declare enum IdentityLevel {
partial = 'partial'
}
declare interface CreateOutputParams {
declare interface CreateDestinationParams {
identityID: string;
name: string;
}
@ -46,8 +46,8 @@ declare interface IdentityChallengeEvent extends WalletUtilsEvent {
identityChallenge: IdentityChallenge;
}
declare interface CreateOutputEvent extends WalletUtilsEvent {
output: Output;
declare interface CreateDestinationEvent extends WalletUtilsEvent {
destination: Destination;
}
declare interface CancelEvent extends WalletUtilsEvent {
@ -70,7 +70,7 @@ declare interface LogicError {
declare type IdentityChallenge = any; // see swagger definition
declare type Output = any; // see swagger definition
declare type Destination = any; // see swagger definition
```
### Usage

4537
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
import { AbstractAction, TypeKeys } from 'app/actions';
import { CardFormValues } from 'app/state';
import { LogicError, Output, TokenizedCard } from 'app/backend';
import { LogicError, Destination, TokenizedCard } from 'app/backend';
export interface CardSavingRequestedPayload {
values: CardFormValues;
@ -28,9 +28,9 @@ export interface CardBindingRequested extends AbstractAction<CardFormValues> {
payload: CardFormValues;
}
export interface CardBindingCompleted extends AbstractAction<Output> {
export interface CardBindingCompleted extends AbstractAction<Destination> {
type: TypeKeys.CARD_BINDING_COMPLETED;
payload: Output;
payload: Destination;
}
export interface CardBindingFailed extends AbstractAction<LogicError> {

View File

@ -1,11 +1,11 @@
import { TokenizedCard } from './tokenized-card';
enum OutputStatusEnum {
enum DestinationStatusEnum {
Unauthorized = 'Unauthorized',
Authorized = 'Authorized'
}
export class Output {
export class Destination {
id: string;
name: string;
createdAt: string;
@ -14,6 +14,6 @@ export class Output {
currency: string;
resource: TokenizedCard;
metadata: {};
status: OutputStatusEnum;
status: DestinationStatusEnum;
validUntil?: string;
}

View File

@ -5,5 +5,5 @@ export * from './tokenized-card';
export * from './tokenized-passport';
export * from './tokenized-insurance';
export * from './event';
export * from './output';
export * from './destination';
export * from './identity-challenge';

View File

@ -37,7 +37,7 @@ interface FooterDef {
export const FooterDef: React.SFC<FooterDef> = (props) => (
<footer className={footer}>
{props.actionType === ActionType.createOutput ?
{props.actionType === ActionType.createDestination ?
cardIcons()
: null
}

View File

@ -6,7 +6,7 @@ const getDescription = (type: ActionType): string => {
switch (type) {
case ActionType.userIdentity:
return 'Идентификация прошла успешно.';
case ActionType.createOutput:
case ActionType.createDestination:
return 'Привязка карты вывода прошла успешно.';
}
};

View File

@ -1,3 +1,3 @@
export * from './result-form-content';
export * from './make-content-from-user-identity';
export * from './make-content-from-create-output';
export * from './make-content-from-create-destination';

View File

@ -10,7 +10,7 @@ const success = (): ResultFormContent => ({
hasActions: false,
hasDone: true,
header: 'Успешная привязка',
description: getSuccessDescription(ActionType.createOutput),
description: getSuccessDescription(ActionType.createDestination),
icon: <Checkmark/>
});
@ -22,6 +22,6 @@ const failed = (msg: string): ResultFormContent => ({
icon: <Cross/>
});
export const makeContentFromCreateOutput = (error: ErrorState) => {
export const makeContentFromCreateDestination = (error: ErrorState) => {
return error ? failed(error.error.message) : success();
};

View File

@ -6,7 +6,7 @@ import { setViewInfoHeight } from 'app/actions';
import { ErrorState
, State } from 'app/state';
import { ActionType } from '../../../../../../../communication/model';
import { makeContentFromUserIdentity, makeContentFromCreateOutput, ResultFormContent } from './make-content';
import { makeContentFromUserIdentity, makeContentFromCreateDestination, ResultFormContent } from './make-content';
interface ResultFormDefProps {
actionType: ActionType;
@ -36,8 +36,8 @@ export class ResultFormDef extends React.Component<ResultFormDefProps> {
switch (this.props.actionType) {
case ActionType.userIdentity:
return makeContentFromUserIdentity(this.props.error);
case ActionType.createOutput:
return makeContentFromCreateOutput(this.props.error);
case ActionType.createDestination:
return makeContentFromCreateDestination(this.props.error);
}
}
}

View File

@ -16,7 +16,7 @@ const getInfoContent = (type: ActionType): InfoContent => {
title: 'Процедура идентификации',
description: 'Необходимо ввести паспортные данные и номер СНИЛС'
};
case ActionType.createOutput:
case ActionType.createDestination:
return {
title: 'Заведение инструмента вывода средств',
description: 'Необходимо ввести реквизиты карты на которую будут производиться выплаты'

View File

@ -1,4 +1,4 @@
export enum ActionType {
userIdentity = 'userIdentity',
createOutput = 'createOutput'
createDestination = 'createDestination'
}

View File

@ -37,8 +37,8 @@ export function finalize(state: State, transport: Transport, walletUtilsEl: HTML
transport.emit(PossibleEvents.onCompleteIdentityChallenge, { data: state.model.identityChallenge });
finalizer.done(state.config.inFrame);
break;
case ResultState.onCreateOutput:
transport.emit(PossibleEvents.onCreateOutput, { data: state.model.output });
case ResultState.onCreateDestination:
transport.emit(PossibleEvents.onCreateDestination, { data: state.model.destination });
finalizer.done(state.config.inFrame);
break;
case ResultState.identityChallengeFailed:

View File

@ -51,7 +51,7 @@ export function modelReducer(s: ModelState = null, action: ModelReducerAction):
case TypeKeys.CARD_BINDING_COMPLETED:
return {
...s,
output: action.payload
destination: action.payload
};
case TypeKeys.EVENTS_POLLED:
return {

View File

@ -34,10 +34,10 @@ function* start(action: CardBindingRequested): Iterable<BindEffect | FinishEffec
name: s.config.initConfig.params.name
}));
const tokenizedCard = yield call(tokenizeCard, action.payload, wapiEndpoint, accessToken);
const output = yield call(bind, tokenizedCard, name, wapiEndpoint, accessToken, identityID);
const destination = yield call(bind, tokenizedCard, name, wapiEndpoint, accessToken, identityID);
yield put({
type: TypeKeys.CARD_BINDING_COMPLETED,
payload: output
payload: destination
} as CardBindingCompleted);
yield put({
type: TypeKeys.SET_VIEW_INFO_PROCESS,
@ -49,7 +49,7 @@ function* start(action: CardBindingRequested): Iterable<BindEffect | FinishEffec
} as GoToFormInfo);
yield put({
type: TypeKeys.SET_RESULT,
payload: ResultState.onCreateOutput
payload: ResultState.onCreateDestination
} as ResultAction);
} catch (e) {
yield put({
@ -63,6 +63,6 @@ function* start(action: CardBindingRequested): Iterable<BindEffect | FinishEffec
}
}
export function* watchCreateOutput(): Iterator<ForkEffect> {
export function* watchCreateDestination(): Iterator<ForkEffect> {
yield takeLatest(TypeKeys.CARD_BINDING_REQUESTED, start);
}

View File

@ -0,0 +1 @@
export * from './create-destination';

View File

@ -1 +0,0 @@
export * from './create-output';

View File

@ -19,7 +19,7 @@ const resolveActionType = (config: InitConfig, identityChallengeEvents?: Event[]
return new ModalForms([new PassportFormInfo()], true);
}
case ActionType.createOutput:
case ActionType.createDestination:
return new ModalForms([new CardFormInfo()], true);
}
};

View File

@ -1,12 +1,12 @@
import { all } from 'redux-saga/effects';
import { watchInitializeApp } from './initialize-app';
import { watchStartIdentityChallenge } from './identity-challenge';
import { watchCreateOutput } from './create-output';
import { watchCreateDestination } from './create-destination';
export default function* rootSaga(): any {
yield all([
watchInitializeApp(),
watchStartIdentityChallenge(),
watchCreateOutput()
watchCreateDestination()
]);
}

View File

@ -2,7 +2,7 @@ import {
Event,
Identity,
IdentityChallenge,
Output,
Destination,
TokenizedCard,
TokenizedInsurance,
TokenizedPassport
@ -14,6 +14,6 @@ export class ModelState {
tokenizedInsurance?: TokenizedInsurance;
tokenizedPassport?: TokenizedPassport;
tokenizedCard?: TokenizedCard;
output?: Output;
destination?: Destination;
identityChallenge?: IdentityChallenge;
}

View File

@ -2,5 +2,5 @@ export enum ResultState {
close = 'close',
identityChallengeCompleted = 'identityChallengeCompleted',
identityChallengeFailed = 'identityChallengeFailed',
onCreateOutput = 'onCreateOutput'
onCreateDestination = 'onCreateDestination'
}

View File

@ -1,4 +1,4 @@
export enum ActionType {
userIdentity = 'userIdentity',
createOutput = 'createOutput'
createDestination = 'createDestination'
}

View File

@ -0,0 +1,6 @@
import { InitializerData } from '.';
import { CreateDestinationParams } from '../../initializer/model';
export interface CreateDestinationInitializerData extends InitializerData {
params: CreateDestinationParams;
}

View File

@ -1,6 +0,0 @@
import { InitializerData } from '.';
import { CreateOutputParams } from '../../initializer/model';
export interface CreateOutputInitializerData extends InitializerData {
params: CreateOutputParams;
}

View File

@ -4,4 +4,4 @@ export * from './transport-message';
export * from './action-type';
export * from './user-identity-initializer-data';
export * from './initializer-data';
export * from './create-output-initializer-data';
export * from './create-destination-initializer-data';

View File

@ -4,7 +4,7 @@ export enum PossibleEvents {
onCompleteIdentityChallenge = 'onCompleteIdentityChallenge',
onFailIdentityChallenge = 'onFailIdentityChallenge',
onCancelIdentityChallenge = 'onCancelIdentityChallenge',
onCreateOutput = 'onCreateOutput',
onCreateDestination = 'onCreateDestination',
close = 'close',
done = 'done'
}

View File

@ -6,15 +6,15 @@ import { PopupInitializer } from './popup-initializer';
import { IframeInitializer } from './iframe-initializer';
import {
CancelEvent,
CreateOutputEvent,
CreateOutputParams,
CreateDestinationEvent,
CreateDestinationParams,
IdentityChallengeEvent,
StartIdentityChallengeParams,
WalletUtilsEvent
} from './model';
import { getOrigin } from '../get-origin';
import { PossibleEvents, Transport } from '../communication';
import { ActionType, CreateOutputInitializerData, UserIdentityInitializerData } from '../communication/model';
import { ActionType, CreateDestinationInitializerData, UserIdentityInitializerData } from '../communication/model';
const logPrefix = '[RBKmoney wallet utils]';
@ -39,9 +39,9 @@ const toIdentityInitializerData = (token: string, params: StartIdentityChallenge
};
};
const toOutputInitializerData = (token: string, params: CreateOutputParams): CreateOutputInitializerData => {
const toDestinationInitializerData = (token: string, params: CreateDestinationParams): CreateDestinationInitializerData => {
if (!params) {
throw new Error(`${logPrefix}: Missing CreateOutputParams`);
throw new Error(`${logPrefix}: Missing CreateDestinationParams`);
}
if (!isString(params.identityID)) {
throw new Error(`${logPrefix}: Wrong identityID`);
@ -52,7 +52,7 @@ const toOutputInitializerData = (token: string, params: CreateOutputParams): Cre
return {
token,
params,
type: ActionType.createOutput
type: ActionType.createDestination
};
};
@ -61,7 +61,7 @@ export class RbkmoneyWalletUtils {
onCompleteIdentityChallenge: (event: IdentityChallengeEvent) => void;
onFailIdentityChallenge: (event: IdentityChallengeEvent) => void;
onCancelIdentityChallenge: (event: IdentityChallengeEvent) => void;
onCreateOutput: (event: CreateOutputEvent) => void;
onCreateDestination: (event: CreateDestinationEvent) => void;
onCancel: (event: CancelEvent) => void;
private initializer: Initializer;
@ -95,12 +95,12 @@ export class RbkmoneyWalletUtils {
.catch((e) => this.provideCallback(this.onCancel, { error: e }));
}
createOutput(params: CreateOutputParams): void {
const data = toOutputInitializerData(this.token, params);
createDestination(params: CreateDestinationParams): void {
const data = toDestinationInitializerData(this.token, params);
this.initializer.open(data)
.then((transport: Transport) => {
transport.on(PossibleEvents.onCreateOutput, (e) =>
this.provideCallback(this.onCreateOutput, {
transport.on(PossibleEvents.onCreateDestination, (e) =>
this.provideCallback(this.onCreateDestination, {
data: e.data
}));
this.activateCancelEvent(transport);

View File

@ -0,0 +1,5 @@
import { Destination, WalletUtilsEvent } from '.';
export interface CreateDestinationEvent extends WalletUtilsEvent {
destination: Destination;
}

View File

@ -1,4 +1,4 @@
export interface CreateOutputParams {
export interface CreateDestinationParams {
identityID: string;
name: string;
}

View File

@ -1,5 +0,0 @@
import { Output, WalletUtilsEvent } from '.';
export interface CreateOutputEvent extends WalletUtilsEvent {
output: Output;
}

View File

@ -0,0 +1 @@
export type Destination = any;

View File

@ -1,9 +1,9 @@
export * from './cancel-event';
export * from './create-output-event';
export * from './create-output-params';
export * from './create-destination-event';
export * from './create-destination-params';
export * from './identity-challenge';
export * from './identity-challenge-event';
export * from './start-identity-challenge-params';
export * from './wallet-utils-event';
export * from './output';
export * from './destination';
export * from './error-cancel-event';

View File

@ -1 +0,0 @@
export type Output = any;