refactor(paytabs): run prettier

This commit is contained in:
Daniel Sogl 2021-06-29 15:19:01 +02:00
parent f64b67310a
commit 83cb98f115

View File

@ -2,393 +2,393 @@ import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
/** /**
* PaymentSDKConfiguration: payment request configuration * PaymentSDKConfiguration: payment request configuration
*/ */
export interface PaymentSDKConfiguration { export interface PaymentSDKConfiguration {
/** /**
* merchant profile id * merchant profile id
*/ */
profileID: string; profileID: string;
/** /**
* merchant server key * merchant server key
*/ */
serverKey: string; serverKey: string;
/** /**
* merchant client key * merchant client key
*/ */
clientKey: string; clientKey: string;
/** /**
* transaction type: refer to TransactionType enum * transaction type: refer to TransactionType enum
*/ */
transactionType?: string; transactionType?: string;
/** /**
* transaction class: refer to TransactionClass enum * transaction class: refer to TransactionClass enum
*/ */
transactionClass?: string; transactionClass?: string;
/** /**
* order or cart id * order or cart id
*/ */
cartID: string; cartID: string;
/** /**
* payment currency * payment currency
*/ */
currency: string; currency: string;
/** /**
* amount * amount
*/ */
amount: number; amount: number;
/** /**
* order or cart description * order or cart description
*/ */
cartDescription: string; cartDescription: string;
/** /**
* user interface language code(en, ar, ..) * user interface language code(en, ar, ..)
*/ */
languageCode?: string; languageCode?: string;
/** /**
* validate shipping info * validate shipping info
*/ */
forceShippingInfo?: boolean; forceShippingInfo?: boolean;
/** /**
* validate billing info * validate billing info
*/ */
showBillingInfo?: boolean; showBillingInfo?: boolean;
/** /**
* handle missing shipping info by showing shipping info section * handle missing shipping info by showing shipping info section
*/ */
showShippingInfo?: boolean; showShippingInfo?: boolean;
/** /**
* configured billing details * configured billing details
*/ */
billingDetails?: PaymentSDKBillingDetails; billingDetails?: PaymentSDKBillingDetails;
/** /**
* configured shipping details * configured shipping details
*/ */
shippingDetails?: PaymentSDKShippingDetails; shippingDetails?: PaymentSDKShippingDetails;
/** /**
* merchant country code * merchant country code
*/ */
merchantCountryCode: string; merchantCountryCode: string;
/** /**
* title of the screen * title of the screen
*/ */
screenTitle?: string; screenTitle?: string;
/** /**
* merchant name * merchant name
*/ */
merchantName?: string; merchantName?: string;
/** /**
* server ip * server ip
*/ */
serverIP?: string; serverIP?: string;
/** /**
* tokenise type: refer to TokeiseType enum * tokenise type: refer to TokeiseType enum
*/ */
tokeniseType?: string; tokeniseType?: string;
/** /**
* token format: refer to TokeiseFormat enum * token format: refer to TokeiseFormat enum
*/ */
tokenFormat?: string; tokenFormat?: string;
/** /**
* option to hide or show card scanner button * option to hide or show card scanner button
*/ */
hideCardScanner?: string; hideCardScanner?: string;
/** /**
* merchant apple pay bundle id * merchant apple pay bundle id
*/ */
merchantApplePayIdentifier?: string; merchantApplePayIdentifier?: string;
/** /**
* minize the vlaidation on apple pay billing and shipping info * minize the vlaidation on apple pay billing and shipping info
*/ */
simplifyApplePayValidation?: string; simplifyApplePayValidation?: string;
/** /**
* supported apple pay networks * supported apple pay networks
*/ */
supportedApplePayNetworks?: [string]; supportedApplePayNetworks?: [string];
/** /**
* returned token * returned token
*/ */
token?: string; token?: string;
/** /**
* returned transaction reference * returned transaction reference
*/ */
transactionReference?: string; transactionReference?: string;
/** /**
* samsung Token * samsung Token
*/ */
samsungToken?: string; samsungToken?: string;
/** /**
* customized theme * customized theme
*/ */
theme?: PaymentSDKTheme; theme?: PaymentSDKTheme;
/** /**
* list of alternative payment methods * list of alternative payment methods
*/ */
alternativePaymentMethods?: [string]; alternativePaymentMethods?: [string];
} }
/** /**
* PaymentSDKBillingDetails * PaymentSDKBillingDetails
*/ */
export interface PaymentSDKBillingDetails { export interface PaymentSDKBillingDetails {
/** /**
* billing: customer name * billing: customer name
*/ */
name?: string; name?: string;
/** /**
* billing: customer email * billing: customer email
*/ */
email?: string; email?: string;
/** /**
* billing: customer phone * billing: customer phone
*/ */
phone?: string; phone?: string;
/** /**
* billing: customer address line * billing: customer address line
*/ */
addressLine?: string; addressLine?: string;
/** /**
* billing: customer city * billing: customer city
*/ */
city?: string; city?: string;
/** /**
* billing: customer state * billing: customer state
*/ */
state?: string; state?: string;
/** /**
* billing: customer country code * billing: customer country code
*/ */
countryCode?: string; countryCode?: string;
/** /**
* billing: customer zip code * billing: customer zip code
*/ */
zip?: string; zip?: string;
} }
/** /**
* PaymentSDKShippingDetails * PaymentSDKShippingDetails
*/ */
export interface PaymentSDKShippingDetails { export interface PaymentSDKShippingDetails {
/** /**
* shipping: customer name * shipping: customer name
*/ */
name?: string; name?: string;
/** /**
* shipping: customer email * shipping: customer email
*/ */
email?: string; email?: string;
/** /**
* shipping: customer phone * shipping: customer phone
*/ */
phone?: string; phone?: string;
/** /**
* shipping: customer address line * shipping: customer address line
*/ */
addressLine?: string; addressLine?: string;
/** /**
* shipping: customer city * shipping: customer city
*/ */
city?: string; city?: string;
/** /**
* shipping: customer state * shipping: customer state
*/ */
state?: string; state?: string;
/** /**
* shipping: customer country code * shipping: customer country code
*/ */
countryCode?: string; countryCode?: string;
/** /**
* shipping: customer zip code * shipping: customer zip code
*/ */
zip?: string; zip?: string;
} }
/** /**
* PaymentSDKTheme * PaymentSDKTheme
*/ */
export interface PaymentSDKTheme { export interface PaymentSDKTheme {
/** /**
* theme: primary color * theme: primary color
*/ */
primaryColor?: string; primaryColor?: string;
/** /**
* theme: primary font color * theme: primary font color
*/ */
primaryFontColor?: string; primaryFontColor?: string;
/** /**
* theme: primary font * theme: primary font
*/ */
primaryFont?: string; primaryFont?: string;
/** /**
* theme: secondary color * theme: secondary color
*/ */
secondaryColor?: string; secondaryColor?: string;
/** /**
* theme: secondary font color * theme: secondary font color
*/ */
secondaryFontColor?: string; secondaryFontColor?: string;
/** /**
* theme: secondary font * theme: secondary font
*/ */
secondaryFont?: string; secondaryFont?: string;
/** /**
* theme: stroke color * theme: stroke color
*/ */
strokeColor?: string; strokeColor?: string;
/** /**
* theme: primary color * theme: primary color
*/ */
strokeThinckness?: number; strokeThinckness?: number;
/** /**
* theme: input corner radius * theme: input corner radius
*/ */
inputsCornerRadius?: number; inputsCornerRadius?: number;
/** /**
* theme: button color * theme: button color
*/ */
buttonColor?: string; buttonColor?: string;
/** /**
* theme: button font color * theme: button font color
*/ */
buttonFontColor?: string; buttonFontColor?: string;
/** /**
* theme: button font * theme: button font
*/ */
buttonFont?: string; buttonFont?: string;
/** /**
* theme: title font color * theme: title font color
*/ */
titleFontColor?: string; titleFontColor?: string;
/** /**
* theme: title font * theme: title font
*/ */
titleFont?: string; titleFont?: string;
/** /**
* theme: background color * theme: background color
*/ */
backgroundColor?: string; backgroundColor?: string;
/** /**
* theme: placeholder color * theme: placeholder color
*/ */
placeholderColor?: string; placeholderColor?: string;
} }
/** /**
* TokeniseType: define the behaviour of of saving card option inside the SDKs. * TokeniseType: define the behaviour of of saving card option inside the SDKs.
*/ */
export enum TokeniseType { export enum TokeniseType {
/** /**
* none: tokenise is off * none: tokenise is off
*/ */
none = "none", none = 'none',
/** /**
* merchantMandatory: tokenise is forced * merchantMandatory: tokenise is forced
*/ */
merchantMandatory = "merchantMandatory", merchantMandatory = 'merchantMandatory',
/** /**
* userMandatory: tokenise is forced as per user approval * userMandatory: tokenise is forced as per user approval
*/ */
userMandatory = "userMandatory", userMandatory = 'userMandatory',
/** /**
* userOptinoal: tokenise if optional as per user approval * userOptinoal: tokenise if optional as per user approval
*/ */
userOptinoal = "userOptinoal", userOptinoal = 'userOptinoal',
} }
/** /**
* TokeniseFromat: the returned token format * TokeniseFromat: the returned token format
*/ */
export enum TokeniseFromat { export enum TokeniseFromat {
/** /**
* none: no format * none: no format
*/ */
none = "1", none = '1',
/** /**
* hex32: Hex with 32 length * hex32: Hex with 32 length
*/ */
hex32 = "2", hex32 = '2',
/** /**
* alphaNum20: alpha numeric 20 length * alphaNum20: alpha numeric 20 length
*/ */
alphaNum20 = "3", alphaNum20 = '3',
/** /**
* digit22: digits with 22 length * digit22: digits with 22 length
*/ */
digit22 = "3", digit22 = '3',
/** /**
* digit16: digits with 16 length * digit16: digits with 16 length
*/ */
digit16 = "5", digit16 = '5',
/** /**
* alphaNum32: alpha numeric 32 length * alphaNum32: alpha numeric 32 length
*/ */
alphaNum32 = "6" alphaNum32 = '6',
} }
/** /**
* TransactionType * TransactionType
*/ */
export enum TransactionType { export enum TransactionType {
/** /**
* sale * sale
*/ */
sale = "sale", sale = 'sale',
/** /**
* authorize / capture option * authorize / capture option
*/ */
authorize = "auth" authorize = 'auth',
} }
/** /**
* TransactionClass * TransactionClass
*/ */
export enum TransactionClass { export enum TransactionClass {
/** /**
* ecom: default transaction * ecom: default transaction
*/ */
ecom = "ecom", ecom = 'ecom',
/** /**
* recurring: recurring transaction * recurring: recurring transaction
*/ */
recurring = "recur" recurring = 'recur',
} }
/** /**
* AlternativePaymentMethod * AlternativePaymentMethod
*/ */
export enum AlternativePaymentMethod { export enum AlternativePaymentMethod {
/** /**
* unionpay: for supporting payment with unionpay * unionpay: for supporting payment with unionpay
*/ */
unionPay = "unionpay", unionPay = 'unionpay',
/** /**
* stcpay: for supporting payment with stcpay * stcpay: for supporting payment with stcpay
*/ */
stcPay = "stcpay", stcPay = 'stcpay',
/** /**
* valu: for supporting payment with valu * valu: for supporting payment with valu
*/ */
valu = "valu", valu = 'valu',
/** /**
* meezaqr: for supporting payment with meezaqr * meezaqr: for supporting payment with meezaqr
*/ */
meezaQR = "meezaqr", meezaQR = 'meezaqr',
/** /**
* omannet: for supporting payment with omannet * omannet: for supporting payment with omannet
*/ */
omannet = "omannet", omannet = 'omannet',
/** /**
* knetcredit: for supporting payment with knetcredit * knetcredit: for supporting payment with knetcredit
*/ */
knetCredit = "knetcredit", knetCredit = 'knetcredit',
/** /**
* knetdebit: for supporting payment with knetdebit * knetdebit: for supporting payment with knetdebit
*/ */
knetDebit = "knetdebit", knetDebit = 'knetdebit',
/** /**
* fawry: for supporting payment with fawry * fawry: for supporting payment with fawry
*/ */
fawry = "fawry" fawry = 'fawry',
} }
/** /**
@ -413,7 +413,7 @@ export enum AlternativePaymentMethod {
* countryCode: "AE", * countryCode: "AE",
* zip: "1234" * zip: "1234"
* }; * };
* *
* var configuration: PaymentSDKConfiguration = { * var configuration: PaymentSDKConfiguration = {
* profileID: "*profile id*", * profileID: "*profile id*",
* serverKey: "*server key*", * serverKey: "*server key*",
@ -427,11 +427,11 @@ export enum AlternativePaymentMethod {
* screenTitle:"Pay with Card", * screenTitle:"Pay with Card",
* billingDetails: billingDetails * billingDetails: billingDetails
* } * }
* *
* this.paytabs.startCardPayment(configuration) * this.paytabs.startCardPayment(configuration)
* .then(result => console.log(result)) * .then(result => console.log(result))
* .catch(error => console.error(error)); * .catch(error => console.error(error));
* *
* this.paytabs.startApplePayPayment(configuration) * this.paytabs.startApplePayPayment(configuration)
* .then(result => console.log(result)) * .then(result => console.log(result))
* .catch(error => console.error(error)); * .catch(error => console.error(error));
@ -441,7 +441,7 @@ export enum AlternativePaymentMethod {
* .catch(error => console.error(error)); * .catch(error => console.error(error));
* *
* ``` * ```
*/ */
@Plugin({ @Plugin({
pluginName: 'PayTabs', pluginName: 'PayTabs',
plugin: 'com.paytabs.cordova.plugin', plugin: 'com.paytabs.cordova.plugin',
@ -449,34 +449,33 @@ export enum AlternativePaymentMethod {
repo: 'https://github.com/paytabscom/paytabs-cordova', repo: 'https://github.com/paytabscom/paytabs-cordova',
platforms: ['Android', 'iOS'], platforms: ['Android', 'iOS'],
}) })
@Injectable() @Injectable()
export class PayTabs extends IonicNativePlugin { export class PayTabs extends IonicNativePlugin {
/** /**
* Start Card Payment * Start Card Payment
* @param params {PaymentSDKConfiguration} payment request configuration * @param params {PaymentSDKConfiguration} payment request configuration
* @return {Promise<any>} returns a promise that resolves with transaction details, or rejects with an error * @return {Promise<any>} returns a promise that resolves with transaction details, or rejects with an error
*/ */
@Cordova() @Cordova()
startCardPayment(configuration: PaymentSDKConfiguration): Promise<any> { startCardPayment(configuration: PaymentSDKConfiguration): Promise<any> {
return; return;
} }
/** /**
* Start ApplePay Payment * Start ApplePay Payment
* @param params {PaymentSDKConfiguration} payment request configuration * @param params {PaymentSDKConfiguration} payment request configuration
* @return {Promise<any>} returns a promise that resolves with transaction details, or rejects with an error * @return {Promise<any>} returns a promise that resolves with transaction details, or rejects with an error
*/ */
@Cordova() @Cordova()
startApplePayPayment(configuration: PaymentSDKConfiguration): Promise<any> { startApplePayPayment(configuration: PaymentSDKConfiguration): Promise<any> {
return; return;
} }
/** /**
* Start Alternative Payment Method * Start Alternative Payment Method
* @param params {PaymentSDKConfiguration} payment request configuration * @param params {PaymentSDKConfiguration} payment request configuration
* @return {Promise<any>} returns a promise that resolves with transaction details, or rejects with an error * @return {Promise<any>} returns a promise that resolves with transaction details, or rejects with an error
*/ */
@Cordova() @Cordova()
startAlternativePaymentMethod(configuration: PaymentSDKConfiguration): Promise<any> { startAlternativePaymentMethod(configuration: PaymentSDKConfiguration): Promise<any> {
return; return;
} }
} }