Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property 'deserialize' does not exist on type 'MerchantBlockEntity' #24

Open
Vidhyadar opened this issue May 18, 2017 · 0 comments
Open

Comments

@Vidhyadar
Copy link

I am facing this issue:

Here is my entity:

import { JsonProperty } from 'json-typescript-mapper';

export class BlockedMerchant {
    @JsonProperty('name')
    name: string =  undefined;
    @JsonProperty('rawnames')
    rawnames: string[] = undefined;

    constructor() {
    this.name = undefined;
    this.rawnames = undefined;
}
}

export class SecurityFraudUnlock {
   
}

export class Preferences {
    @JsonProperty('allowAuthorizations')
    allowAuthorizations: boolean;

    @JsonProperty('allowAuthorizations')
    allowOverLimit: boolean;


    @JsonProperty('allowAuthorizations')
    blockedMerchants: BlockedMerchant[];

    @JsonProperty('allowAuthorizations')
    securityFraudUnlock: SecurityFraudUnlock;

    constructor() {
    this.securityFraudUnlock = undefined;
    this.blockedMerchants = undefined;
    this.allowAuthorizations = undefined;
    this.allowOverLimit = undefined;
}
}

export class CreditCardsList {
    @JsonProperty('allowAuthorizations')
    cardLastFour: string;

    @JsonProperty('allowAuthorizations')
    cardReferenceId: string;

    @JsonProperty('allowAuthorizations')
    preferences: Preferences;

    constructor() {
    this.cardReferenceId = undefined;
    this.preferences = undefined;
    this.cardLastFour = undefined;
}
}

export class MerchantBlockEntity {
    @JsonProperty('allowAuthorizations')
    creditCardsList: CreditCardsList[];
    constructor()
    {
       this.creditCardsList = undefined; 
    }
}

Component.Ts:

import { Component, OnInit } from '@angular/core';
import {MerchantBlockEntity} from './MerchantBlockEntity';
import {MerchantControlService} from './merchant-control-service';
import {deserialize} from 'json-typescript-mapper';

@component({
selector: 'my-app',
templateUrl: ./merchantcontrol.html,
styleUrls: ['./app.Component.css']
})
export class AppComponent implements OnInit{
constructor (private merchantControlService: MerchantControlService) {}
name = 'Angular';
users : Users[];
errorMessage: string;
blockedMerchants : MerchantBlockEntity;
filteredBlockedMerchant : MerchantBlockEntity;
jsonData:any;
ngOnInit():void {
this.users = accountUsers;
this.merchantControlService.getBlockedMerchants()
.subscribe(
blockedMerchants => this.jsonData = blockedMerchants,
error => this.errorMessage = error);;
this.blockedMerchants = deserialize(MerchantBlockEntity,this.jsonData);
this.filteredBlockedMerchant = this.blockedMerchants;
console.log('block merchant is',this.blockedMerchants);
console.log('Error message is ', this.errorMessage);
};
selectedUserChange(selectedUser:Users) :void
{
if(selectedUser.name != 'All')
{
this.filteredBlockedMerchant =new MerchantBlockEntity;
this.filteredBlockedMerchant.creditCardsList = this.blockedMerchants.creditCardsList.filter(
book => book.cardReferenceId === selectedUser.cardRefId);
}
else
{
this.filteredBlockedMerchant = this.blockedMerchants;
}
}
}
export class Users
{
name: string;
cardRefId:string;
}

const accountUsers: Users[] = [
{ name: 'All' , cardRefId: ''},
{ name: 'Mr. Nice' , cardRefId: 'hfffhghgg'},
{ name: 'Mr. Tony' , cardRefId: 'iyuyuyy'},
{ name: 'Mr. Watson' , cardRefId: 'bhghgj'},
];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant