FE-608: added support to bank card token providers (#206)

This commit is contained in:
Alexandra Usacheva 2018-05-30 16:44:05 +03:00 committed by GitHub
parent 338d1cc883
commit ecfe966544
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 47 additions and 2 deletions

View File

@ -9,3 +9,4 @@ export * from './payment-flow';
export * from './payment-method';
export * from './payout-tool-type';
export * from './report-type';
export * from './token-provider';

View File

@ -0,0 +1,5 @@
export const TOKEN_PROVIDER = {
applepay: 'applepay',
googlepay: 'googlepay',
samsungpay: 'samsungpay'
};

View File

@ -17,4 +17,5 @@ export class SearchInvoicesParams {
public payerFingerprint?: string;
public cardNumberMask?: string;
public customerID?: string;
public bankCardTokenProvider?: string;
}

View File

@ -21,7 +21,8 @@ import { CustomerStatusPipe } from './payments/payment-details/customer-status.p
import { PaymentRefundService } from './payments/payment-refund/payment-refund.service';
import { PaymentRefundsComponent } from './payments/payment-refunds/payment-refunds.component';
import { PaymentRefundDetailsComponent } from './payments/payment-refund-details/payment-refund-details.component';
import { PaymentRefundsPipe } from 'koffing/invoice/payments/payment-refunds/payment-refunds.pipe';
import { PaymentRefundsPipe } from './payments/payment-refunds/payment-refunds.pipe';
import { PaymentToolDetailsTokenProviderPipe } from './payments/payment-details/payment-tool-details-token-provider.pipe';
@NgModule({
imports: [
@ -48,6 +49,7 @@ import { PaymentRefundsPipe } from 'koffing/invoice/payments/payment-refunds/pay
PaymentRefundDetailsComponent,
PaymentRefundsPipe,
PaymentToolDetailsTypePipe,
PaymentToolDetailsTokenProviderPipe,
ProviderNamePipe,
CustomerStatusPipe
],

View File

@ -76,7 +76,9 @@ form.form-horizontal.form-label-left.css-form
.form-group
label.col-sm-5 Метод оплаты:
.col-sm-7
div {{payment.payer?.paymentToolDetails?.detailsType | kofPaymentToolDetailsType}}
div
| {{payment.payer?.paymentToolDetails?.detailsType | kofPaymentToolDetailsType}}
span(*ngIf="payment.payer?.paymentToolDetails?.tokenProvider")  ({{payment.payer.paymentToolDetails.tokenProvider | kofPaymentToolDetailsTokenProvider}})
.row
.col-xs-12(*ngIf="payment.payer?.paymentToolDetails?.detailsType === 'PaymentToolDetailsPaymentTerminal'")

View File

@ -0,0 +1,18 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'kofPaymentToolDetailsTokenProvider'
})
export class PaymentToolDetailsTokenProviderPipe implements PipeTransform {
private names = {
applepay: 'Apple Pay',
googlepay: 'Google Pay',
samsungpay: 'Samsung Pay'
};
public transform(input: string): string {
const status = this.names[input];
return status ? status : input;
}
}

View File

@ -22,6 +22,7 @@ export class InvoicesService {
result.payerFingerprint = formParams.fingerprint;
result.cardNumberMask = formParams.cardNumberMask;
result.customerID = formParams.customerID;
result.bankCardTokenProvider = formParams.bankCardTokenProvider;
return result;
}
}

View File

@ -46,6 +46,10 @@ form([formGroup]="searchForm", novalidate)
.form-group
label Метод оплаты:
kof-select(formControlName="paymentMethod", [items]="paymentMethods", [placeholder]="'Любой метод'")
.col-sm-3.col-xs-12(*ngIf="searchForm.value.paymentMethod === 'bankCard'")
.form-group
label Провайдер токенов
kof-select(formControlName="bankCardTokenProvider", [items]="tokenProviders", [placeholder]="'Любой провайдер'")
.col-sm-3.col-xs-12
.form-group
label Тип проведения платежа:

View File

@ -9,6 +9,7 @@ import { PAYMENT_STATUS_LABEL } from '../payment-status-label';
import { PAYMENT_METHOD_LABEL } from '../payment-method-label';
import { PAYMENT_FLOW_LABEL } from '../payment-flow-label';
import { SearchFormService } from './search-form.service';
import { TOKEN_PROVIDER_LABEL } from '../token-provider-label';
@Component({
selector: 'kof-search-form',
@ -42,6 +43,7 @@ export class SearchFormComponent implements OnInit {
public invoiceStatuses: SelectItem[];
public paymentStatuses: SelectItem[];
public paymentMethods: SelectItem[];
public tokenProviders: SelectItem[];
public paymentFlows: SelectItem[];
public additionalParamsVisible: boolean;
@ -51,6 +53,7 @@ export class SearchFormComponent implements OnInit {
this.invoiceStatuses = map(INVOICE_STATUS_LABEL, (name, key) => new SelectItem(key, name));
this.paymentStatuses = map(PAYMENT_STATUS_LABEL, (name, key) => new SelectItem(key, name));
this.paymentMethods = map(PAYMENT_METHOD_LABEL, (name, key) => new SelectItem(key, name));
this.tokenProviders = map(TOKEN_PROVIDER_LABEL, (name, key) => new SelectItem(key, name));
this.paymentFlows = map(PAYMENT_FLOW_LABEL, (name, key) => new SelectItem(key, name));
this.searchForm = this.searchFormService.searchForm;

View File

@ -77,6 +77,7 @@ export class SearchFormService {
paymentFlow: '',
fingerprint: '',
customerID: '',
bankCardTokenProvider: '',
invoicesWithPayments: this.defaultValues.invoicesWithPayments
});
}

View File

@ -0,0 +1,7 @@
import { TOKEN_PROVIDER } from 'koffing/backend';
export const TOKEN_PROVIDER_LABEL = {
[TOKEN_PROVIDER.applepay]: 'Apple Pay',
[TOKEN_PROVIDER.googlepay]: 'Google Pay',
[TOKEN_PROVIDER.samsungpay]: 'Samsung Pay'
};