Skip to content

PaymentMethod Authorisation response not mapping correctly in Automapper #33

@attomman

Description

@attomman

When authorising a payment the TransactionStatus is not mapped in the response. This is critical to get the status and the transactionID to Capture or Cancel the Authorisation later.

When the automapper maps DirectAuthorisationResponse to CreateTransactionResponse the TransactionID and status are lost becuase the TransactionStatus object is not mapped from the source.

To fix this I change the ResponseMapProfile.cs

FROM

        CreateMap<DirectAuthorisationResponse, CreateTransactionResponse>(MemberList.Destination)
            .IncludeBase<BaseResponse, Rapid.Models.BaseResponse>();

TO

        CreateMap<DirectAuthorisationResponse, CreateTransactionResponse>(MemberList.Destination)
            .IncludeBase<BaseResponse, Rapid.Models.BaseResponse>()
            .ForMember(dest => dest.TransactionStatus, opt => opt.MapFrom(src => src));

Now the TransactionID information is returned by the Client when trying the authorise a payment. Can you please add the additional line to the mapper so the TransactionID can be used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions