@oneblink/apps-react 10.1.2 → 10.2.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { FormsAppsTypes, EnvironmentTypes } from '@oneblink/types';
1
+ import { FormsAppsTypes, EnvironmentTypes, SubmissionTypes } from '@oneblink/types';
2
2
  export type FormsAppConfigurationResponse = FormsAppsTypes.FormsAppConfiguration<EnvironmentTypes.FormsAppEnvironmentStyles>;
3
3
  /**
4
4
  * Get configuration for a OneBlink Forms App.
@@ -16,3 +16,31 @@ export type FormsAppConfigurationResponse = FormsAppsTypes.FormsAppConfiguration
16
16
  * @returns
17
17
  */
18
18
  export declare function getFormsAppConfiguration(formsAppId: number, abortSignal?: AbortSignal): Promise<FormsAppConfigurationResponse>;
19
+ /** Query parameters for `GET /forms-apps/:formsAppId/form-submission-meta` */
20
+ export type GetFormSubmissionMetaQuery = {
21
+ formId?: number;
22
+ submissionDateFrom?: string;
23
+ submissionDateTo?: string;
24
+ submissionId?: string;
25
+ externalId?: string;
26
+ submissionTitle?: string;
27
+ limit?: number;
28
+ offset?: number;
29
+ };
30
+ export type FormSubmissionMetaListResponse = {
31
+ meta: {
32
+ limit: number | undefined;
33
+ offset: number | undefined;
34
+ /** `undefined` means there are no results left to fetch */
35
+ nextOffset: number | undefined;
36
+ };
37
+ formSubmissionMeta: SubmissionTypes.FormSubmissionMeta[];
38
+ };
39
+ /**
40
+ * List form submission metadata for a Forms App for the current user.
41
+ *
42
+ * @param formsAppId
43
+ * @param query
44
+ * @param abortSignal
45
+ */
46
+ export declare function getFormSubmissionMetaList(formsAppId: number, query?: GetFormSubmissionMetaQuery, abortSignal?: AbortSignal): Promise<FormSubmissionMetaListResponse>;
@@ -1,5 +1,5 @@
1
1
  import tenants from './tenants';
2
- import { getRequest } from './services/fetch';
2
+ import { getRequest, searchRequest } from './services/fetch';
3
3
  import { isOffline } from './offline-service';
4
4
  import OneBlinkAppsError from './services/errors/oneBlinkAppsError';
5
5
  import Sentry from './Sentry';
@@ -50,4 +50,48 @@ export async function getFormsAppConfiguration(formsAppId, abortSignal) {
50
50
  }
51
51
  }
52
52
  }
53
+ /**
54
+ * List form submission metadata for a Forms App for the current user.
55
+ *
56
+ * @param formsAppId
57
+ * @param query
58
+ * @param abortSignal
59
+ */
60
+ export async function getFormSubmissionMetaList(formsAppId, query = {}, abortSignal) {
61
+ var _a;
62
+ const url = `${tenants.current.apiOrigin}/forms-apps/${formsAppId}/form-submission-meta`;
63
+ const searchParameters = {
64
+ ...query,
65
+ offset: (_a = query.offset) !== null && _a !== void 0 ? _a : 0,
66
+ };
67
+ try {
68
+ return await searchRequest(url, searchParameters, abortSignal);
69
+ }
70
+ catch (err) {
71
+ Sentry.captureException(err);
72
+ const error = err;
73
+ if (isOffline()) {
74
+ throw new OneBlinkAppsError('You are currently offline, please connect to the internet and try again', {
75
+ originalError: error,
76
+ isOffline: true,
77
+ });
78
+ }
79
+ switch (error.status) {
80
+ case 400:
81
+ case 404: {
82
+ throw new OneBlinkAppsError('We could not find the forms app you are looking for. Please contact support if the problem persists.', {
83
+ originalError: error,
84
+ title: 'Invalid Request',
85
+ httpStatusCode: error.status,
86
+ });
87
+ }
88
+ default: {
89
+ throw new OneBlinkAppsError('An unknown error has occurred. Please contact support if the problem persists.', {
90
+ originalError: error,
91
+ httpStatusCode: error.status,
92
+ });
93
+ }
94
+ }
95
+ }
96
+ }
53
97
  //# sourceMappingURL=forms-app-service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"forms-app-service.js","sourceRoot":"","sources":["../../src/apps/forms-app-service.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,WAAW,CAAA;AAC/B,OAAO,EAAa,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,iBAAiB,MAAM,qCAAqC,CAAA;AACnE,OAAO,MAAM,MAAM,UAAU,CAAA;AAK7B;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,UAAkB,EAClB,WAAyB;IAEzB,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,eAAe,UAAU,yBAAyB,CAAA;IAE1F,IAAI,CAAC;QACH,OAAO,MAAM,UAAU,CAAgC,GAAG,EAAE,WAAW,CAAC,CAAA;IAC1E,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAA;QAE5B,MAAM,KAAK,GAAG,GAAgB,CAAA;QAE9B,IAAI,SAAS,EAAE,EAAE,CAAC;YAChB,MAAM,IAAI,iBAAiB,CACzB,4HAA4H,EAC5H;gBACE,aAAa,EAAE,KAAK;gBACpB,SAAS,EAAE,IAAI;aAChB,CACF,CAAA;QACH,CAAC;QAED,QAAQ,KAAK,CAAC,MAAM,EAAE,CAAC;YACrB,KAAK,GAAG,CAAC;YACT,KAAK,GAAG,CAAC,CAAC,CAAC;gBACT,MAAM,IAAI,iBAAiB,CACzB,sGAAsG,EACtG;oBACE,aAAa,EAAE,KAAK;oBACpB,KAAK,EAAE,cAAc;oBACrB,cAAc,EAAE,KAAK,CAAC,MAAM;iBAC7B,CACF,CAAA;YACH,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACR,MAAM,IAAI,iBAAiB,CACzB,gFAAgF,EAChF;oBACE,aAAa,EAAE,KAAK;oBACpB,cAAc,EAAE,KAAK,CAAC,MAAM;iBAC7B,CACF,CAAA;YACH,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import { FormsAppsTypes, EnvironmentTypes } from '@oneblink/types'\nimport tenants from './tenants'\nimport { HTTPError, getRequest } from './services/fetch'\nimport { isOffline } from './offline-service'\nimport OneBlinkAppsError from './services/errors/oneBlinkAppsError'\nimport Sentry from './Sentry'\n\nexport type FormsAppConfigurationResponse =\n FormsAppsTypes.FormsAppConfiguration<EnvironmentTypes.FormsAppEnvironmentStyles>\n\n/**\n * Get configuration for a OneBlink Forms App.\n *\n * #### Example\n *\n * ```js\n * const formsAppId = 1\n * const formsApp =\n * await formsAppService.getFormsAppConfiguration(formAppId)\n * ```\n *\n * @param formsAppId\n * @param abortSignal\n * @returns\n */\nexport async function getFormsAppConfiguration(\n formsAppId: number,\n abortSignal?: AbortSignal,\n): Promise<FormsAppConfigurationResponse> {\n const url = `${tenants.current.apiOrigin}/forms-apps/${formsAppId}/hostname-configuration`\n\n try {\n return await getRequest<FormsAppConfigurationResponse>(url, abortSignal)\n } catch (err) {\n Sentry.captureException(err)\n\n const error = err as HTTPError\n\n if (isOffline()) {\n throw new OneBlinkAppsError(\n 'You are currently offline and do not have a local copy of this app available, please connect to the internet and try again',\n {\n originalError: error,\n isOffline: true,\n },\n )\n }\n\n switch (error.status) {\n case 400:\n case 404: {\n throw new OneBlinkAppsError(\n 'We could not find the forms app you are looking for. Please contact support if the problem persists.',\n {\n originalError: error,\n title: 'Unknown Form',\n httpStatusCode: error.status,\n },\n )\n }\n default: {\n throw new OneBlinkAppsError(\n 'An unknown error has occurred. Please contact support if the problem persists.',\n {\n originalError: error,\n httpStatusCode: error.status,\n },\n )\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"forms-app-service.js","sourceRoot":"","sources":["../../src/apps/forms-app-service.ts"],"names":[],"mappings":"AAKA,OAAO,OAAO,MAAM,WAAW,CAAA;AAC/B,OAAO,EAAa,UAAU,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,iBAAiB,MAAM,qCAAqC,CAAA;AACnE,OAAO,MAAM,MAAM,UAAU,CAAA;AAK7B;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,UAAkB,EAClB,WAAyB;IAEzB,MAAM,GAAG,GAAG,GAAG,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,aAAa,CACxB,GAAG,EACH,gBAAgB,EAChB,WAAW,CACZ,CAAA;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAA;QAE5B,MAAM,KAAK,GAAG,GAAgB,CAAA;QAE9B,IAAI,SAAS,EAAE,EAAE,CAAC;YAChB,MAAM,IAAI,iBAAiB,CACzB,yEAAyE,EACzE;gBACE,aAAa,EAAE,KAAK;gBACpB,SAAS,EAAE,IAAI;aAChB,CACF,CAAA;QACH,CAAC;QAED,QAAQ,KAAK,CAAC,MAAM,EAAE,CAAC;YACrB,KAAK,GAAG,CAAC;YACT,KAAK,GAAG,CAAC,CAAC,CAAC;gBACT,MAAM,IAAI,iBAAiB,CACzB,sGAAsG,EACtG;oBACE,aAAa,EAAE,KAAK;oBACpB,KAAK,EAAE,iBAAiB;oBACxB,cAAc,EAAE,KAAK,CAAC,MAAM;iBAC7B,CACF,CAAA;YACH,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACR,MAAM,IAAI,iBAAiB,CACzB,gFAAgF,EAChF;oBACE,aAAa,EAAE,KAAK;oBACpB,cAAc,EAAE,KAAK,CAAC,MAAM;iBAC7B,CACF,CAAA;YACH,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import {\n FormsAppsTypes,\n EnvironmentTypes,\n SubmissionTypes,\n} from '@oneblink/types'\nimport tenants from './tenants'\nimport { HTTPError, getRequest, searchRequest } from './services/fetch'\nimport { isOffline } from './offline-service'\nimport OneBlinkAppsError from './services/errors/oneBlinkAppsError'\nimport Sentry from './Sentry'\n\nexport type FormsAppConfigurationResponse =\n FormsAppsTypes.FormsAppConfiguration<EnvironmentTypes.FormsAppEnvironmentStyles>\n\n/**\n * Get configuration for a OneBlink Forms App.\n *\n * #### Example\n *\n * ```js\n * const formsAppId = 1\n * const formsApp =\n * await formsAppService.getFormsAppConfiguration(formAppId)\n * ```\n *\n * @param formsAppId\n * @param abortSignal\n * @returns\n */\nexport async function getFormsAppConfiguration(\n formsAppId: number,\n abortSignal?: AbortSignal,\n): Promise<FormsAppConfigurationResponse> {\n const url = `${tenants.current.apiOrigin}/forms-apps/${formsAppId}/hostname-configuration`\n\n try {\n return await getRequest<FormsAppConfigurationResponse>(url, abortSignal)\n } catch (err) {\n Sentry.captureException(err)\n\n const error = err as HTTPError\n\n if (isOffline()) {\n throw new OneBlinkAppsError(\n 'You are currently offline and do not have a local copy of this app available, please connect to the internet and try again',\n {\n originalError: error,\n isOffline: true,\n },\n )\n }\n\n switch (error.status) {\n case 400:\n case 404: {\n throw new OneBlinkAppsError(\n 'We could not find the forms app you are looking for. Please contact support if the problem persists.',\n {\n originalError: error,\n title: 'Unknown Form',\n httpStatusCode: error.status,\n },\n )\n }\n default: {\n throw new OneBlinkAppsError(\n 'An unknown error has occurred. Please contact support if the problem persists.',\n {\n originalError: error,\n httpStatusCode: error.status,\n },\n )\n }\n }\n }\n}\n\n/** Query parameters for `GET /forms-apps/:formsAppId/form-submission-meta` */\nexport type GetFormSubmissionMetaQuery = {\n formId?: number\n submissionDateFrom?: string\n submissionDateTo?: string\n submissionId?: string\n externalId?: string\n submissionTitle?: string\n limit?: number\n offset?: number\n}\n\nexport type FormSubmissionMetaListResponse = {\n meta: {\n limit: number | undefined\n offset: number | undefined\n /** `undefined` means there are no results left to fetch */\n nextOffset: number | undefined\n }\n formSubmissionMeta: SubmissionTypes.FormSubmissionMeta[]\n}\n\n/**\n * List form submission metadata for a Forms App for the current user.\n *\n * @param formsAppId\n * @param query\n * @param abortSignal\n */\nexport async function getFormSubmissionMetaList(\n formsAppId: number,\n query: GetFormSubmissionMetaQuery = {},\n abortSignal?: AbortSignal,\n): Promise<FormSubmissionMetaListResponse> {\n const url = `${tenants.current.apiOrigin}/forms-apps/${formsAppId}/form-submission-meta`\n const searchParameters: Record<string, unknown> = {\n ...query,\n offset: query.offset ?? 0,\n }\n\n try {\n return await searchRequest<FormSubmissionMetaListResponse>(\n url,\n searchParameters,\n abortSignal,\n )\n } catch (err) {\n Sentry.captureException(err)\n\n const error = err as HTTPError\n\n if (isOffline()) {\n throw new OneBlinkAppsError(\n 'You are currently offline, please connect to the internet and try again',\n {\n originalError: error,\n isOffline: true,\n },\n )\n }\n\n switch (error.status) {\n case 400:\n case 404: {\n throw new OneBlinkAppsError(\n 'We could not find the forms app you are looking for. Please contact support if the problem persists.',\n {\n originalError: error,\n title: 'Invalid Request',\n httpStatusCode: error.status,\n },\n )\n }\n default: {\n throw new OneBlinkAppsError(\n 'An unknown error has occurred. Please contact support if the problem persists.',\n {\n originalError: error,\n httpStatusCode: error.status,\n },\n )\n }\n }\n }\n}\n"]}
@@ -22,7 +22,7 @@ class NSWGovPayPaymentProvider {
22
22
  };
23
23
  }
24
24
  async verifyPaymentTransaction(query) {
25
- const { submissionId, isSuccess, errorMessage, paymentReference, completionReference, bankReference, paymentMethod, cardLast4Digits, amount, surcharge, surchargeGst, } = query;
25
+ const { submissionId, isSuccess, errorMessage, paymentReference, completionReference, bankReference, paymentMethod, cardLast4Digits, bPayBillerCode, bPayCrn, bPayProcessingDate, amount, surcharge, surchargeGst, } = query;
26
26
  if (!submissionId || !isSuccess || !paymentReference) {
27
27
  throw new OneBlinkAppsError('Transactions can not be verified unless navigating here directly after a payment.');
28
28
  }
@@ -65,6 +65,30 @@ class NSWGovPayPaymentProvider {
65
65
  allowCopyToClipboard: false,
66
66
  }),
67
67
  generateCreditCardMaskReceiptItem(cardLast4Digits ? `xxxx xxxx xxxx ${cardLast4Digits}` : null),
68
+ generateReceiptItem({
69
+ className: 'ob-payment-receipt__bpay-biller-code',
70
+ valueClassName: 'cypress-payment-receipt-bpay-biller-code',
71
+ icon: 'account_balance',
72
+ label: 'BPay Biller Code',
73
+ value: bPayBillerCode,
74
+ allowCopyToClipboard: true,
75
+ }),
76
+ generateReceiptItem({
77
+ className: 'ob-payment-receipt__bpay-crn',
78
+ valueClassName: 'cypress-payment-receipt-bpay-crn',
79
+ icon: 'account_balance',
80
+ label: 'BPay Reference',
81
+ value: bPayCrn,
82
+ allowCopyToClipboard: true,
83
+ }),
84
+ generateReceiptItem({
85
+ className: 'ob-payment-receipt__bpay-processing-date',
86
+ valueClassName: 'cypress-payment-receipt-bpay-processing-date',
87
+ icon: 'account_balance',
88
+ label: 'BPay Processing Date',
89
+ value: formatBPayProcessingDate(bPayProcessingDate),
90
+ allowCopyToClipboard: false,
91
+ }),
68
92
  generateAmountReceiptItem(typeof amount === 'string' ? parseFloat(amount) : undefined),
69
93
  generateReceiptItem({
70
94
  className: 'ob-payment-receipt__surcharge',
@@ -106,11 +130,24 @@ function getPaymentMethodLabel(paymentMethod) {
106
130
  case 'PAYPAL': {
107
131
  return 'PayPal';
108
132
  }
109
- case 'BPAY':
133
+ case 'BPAY': {
134
+ return 'BPay';
135
+ }
110
136
  default: {
111
137
  return paymentMethod;
112
138
  }
113
139
  }
114
140
  }
141
+ function formatBPayProcessingDate(bPayProcessingDate) {
142
+ if (bPayProcessingDate) {
143
+ const date = localisationService.generateDate({
144
+ daysOffset: undefined,
145
+ value: bPayProcessingDate,
146
+ });
147
+ if (date) {
148
+ return localisationService.formatDate(date);
149
+ }
150
+ }
151
+ }
115
152
  export default NSWGovPayPaymentProvider;
116
153
  //# sourceMappingURL=NSWGovPayPaymentProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NSWGovPayPaymentProvider.js","sourceRoot":"","sources":["../../../../src/apps/services/payment-providers/NSWGovPayPaymentProvider.ts"],"names":[],"mappings":"AAMA,OAAO,sCAAsC,MAAM,2CAA2C,CAAA;AAC9F,OAAO,iBAAiB,MAAM,6BAA6B,CAAA;AAC3D,OAAO,EACL,yBAAyB,EACzB,iCAAiC,EACjC,mBAAmB,EACnB,+BAA+B,EAC/B,mBAAmB,GACpB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAA;AAE3C,MAAM,wBAAwB;IAG5B,YACE,sBAAq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\nimport {\n BasePaymentConfigurationPayload,\n PaymentProvider,\n} from '../../types/payments'\nimport { FormSubmissionResult } from '../../types/submissions'\nimport replaceInjectablesWithSubmissionValues from '../replaceInjectablesWithSubmissionValues'\nimport OneBlinkAppsError from '../errors/oneBlinkAppsError'\nimport {\n generateAmountReceiptItem,\n generateCreditCardMaskReceiptItem,\n generateReceiptItem,\n generateSubmissionIdReceiptItem,\n prepareReceiptItems,\n} from './receipt-items'\nimport { localisationService } from '../..'\n\nclass NSWGovPayPaymentProvider\n implements PaymentProvider<SubmissionEventTypes.NSWGovPaySubmissionEvent>\n{\n constructor(\n paymentSubmissionEvent: SubmissionEventTypes.NSWGovPaySubmissionEvent,\n formSubmissionResult: FormSubmissionResult,\n ) {\n this.paymentSubmissionEvent = paymentSubmissionEvent\n this.formSubmissionResult = formSubmissionResult\n }\n\n paymentSubmissionEvent: SubmissionEventTypes.NSWGovPaySubmissionEvent\n formSubmissionResult: FormSubmissionResult\n\n preparePaymentConfiguration(basePayload: BasePaymentConfigurationPayload) {\n return {\n path: `/forms/${this.formSubmissionResult.definition.id}/nsw-gov-pay-payment`,\n payload: {\n ...basePayload,\n integrationPrimaryAgencyId:\n this.paymentSubmissionEvent.configuration.primaryAgencyId,\n productDescription: replaceInjectablesWithSubmissionValues(\n this.paymentSubmissionEvent.configuration.productDescription,\n this.formSubmissionResult,\n ).text,\n customerReference:\n this.paymentSubmissionEvent.configuration.customerReference &&\n replaceInjectablesWithSubmissionValues(\n this.paymentSubmissionEvent.configuration.customerReference,\n this.formSubmissionResult,\n ).text,\n subAgencyCode:\n this.paymentSubmissionEvent.configuration.subAgencyCode &&\n replaceInjectablesWithSubmissionValues(\n this.paymentSubmissionEvent.configuration.subAgencyCode,\n this.formSubmissionResult,\n ).text,\n },\n }\n }\n\n async verifyPaymentTransaction(query: Record<string, unknown>) {\n const {\n submissionId,\n isSuccess,\n errorMessage,\n paymentReference,\n completionReference,\n bankReference,\n paymentMethod,\n cardLast4Digits,\n amount,\n surcharge,\n surchargeGst,\n } = query as {\n submissionId?: string\n isSuccess?: string\n errorMessage?: string\n paymentReference?: string\n completionReference?: string\n bankReference?: string\n paymentMethod?: string\n cardLast4Digits?: string\n amount?: string\n surcharge?: string\n surchargeGst?: string\n }\n\n if (!submissionId || !isSuccess || !paymentReference) {\n throw new OneBlinkAppsError(\n 'Transactions can not be verified unless navigating here directly after a payment.',\n )\n }\n\n if (this.formSubmissionResult.submissionId !== submissionId) {\n throw new OneBlinkAppsError(\n 'It looks like you are attempting to view a receipt for the incorrect payment.',\n )\n }\n\n return {\n receiptItems: prepareReceiptItems([\n generateSubmissionIdReceiptItem(this.formSubmissionResult.submissionId),\n generateReceiptItem({\n className: 'ob-payment-receipt__completion-reference',\n valueClassName: 'cypress-payment-receipt-completion-reference',\n icon: 'check_circle',\n label: 'Completion Reference',\n value: completionReference,\n allowCopyToClipboard: true,\n }),\n {\n className: 'ob-payment-receipt__payment-reference',\n valueClassName: 'cypress-payment-receipt-payment-reference',\n icon: 'shopping_cart',\n label: 'Payment Reference',\n value: paymentReference,\n allowCopyToClipboard: true,\n },\n generateReceiptItem({\n className: 'ob-payment-receipt__bank-reference',\n valueClassName: 'cypress-payment-receipt-bank-reference',\n icon: 'account_balance',\n label: 'Bank Reference',\n value: bankReference,\n allowCopyToClipboard: true,\n }),\n generateReceiptItem({\n className: 'ob-payment-payment-method',\n valueClassName: 'cypress-payment-receipt-payment-method',\n icon: 'account_balance_wallet',\n label: 'Payment Method',\n value: getPaymentMethodLabel(paymentMethod),\n allowCopyToClipboard: false,\n }),\n generateCreditCardMaskReceiptItem(\n cardLast4Digits ? `xxxx xxxx xxxx ${cardLast4Digits}` : null,\n ),\n generateAmountReceiptItem(\n typeof amount === 'string' ? parseFloat(amount) : undefined,\n ),\n generateReceiptItem({\n className: 'ob-payment-receipt__surcharge',\n valueClassName: 'cypress-payment-receipt-surcharge',\n icon: 'price_check',\n label: 'Surcharge Amount',\n value:\n typeof surcharge === 'string'\n ? localisationService.formatCurrency(parseFloat(surcharge))\n : undefined,\n allowCopyToClipboard: false,\n }),\n generateReceiptItem({\n className: 'ob-payment-receipt__surcharge-gst',\n valueClassName: 'cypress-payment-receipt-surcharge-gst',\n icon: 'price_check',\n label: 'Surcharge GST',\n value:\n typeof surchargeGst === 'string'\n ? localisationService.formatCurrency(parseFloat(surchargeGst))\n : undefined,\n allowCopyToClipboard: false,\n }),\n ]),\n transaction: {\n isSuccess: isSuccess === 'true',\n errorMessage,\n },\n submissionResult: this.formSubmissionResult,\n }\n }\n}\n\nfunction getPaymentMethodLabel(paymentMethod: string | undefined) {\n switch (\n paymentMethod as NonNullable<\n NonNullable<\n SubmissionTypes.NSWGovPayPayment['paymentTransaction']\n >['agencyCompletionPayment']\n >['paymentMethod']\n ) {\n case 'PAYID': {\n return 'PayID'\n }\n case 'CARD': {\n return 'Credit Card'\n }\n case 'PAYPAL': {\n return 'PayPal'\n }\n case 'BPAY':\n default: {\n return paymentMethod\n }\n }\n}\n\nexport default NSWGovPayPaymentProvider\n"]}
1
+ {"version":3,"file":"NSWGovPayPaymentProvider.js","sourceRoot":"","sources":["../../../../src/apps/services/payment-providers/NSWGovPayPaymentProvider.ts"],"names":[],"mappings":"AAMA,OAAO,sCAAsC,MAAM,2CAA2C,CAAA;AAC9F,OAAO,iBAAiB,MAAM,6BAA6B,CAAA;AAC3D,OAAO,EACL,yBAAyB,EACzB,iCAAiC,EACjC,mBAAmB,EACnB,+BAA+B,EAC/B,mBAAmB,GACpB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAA;AAE3C,MAAM,wBAAwB;IAC5B,YACE,sBAAqE,EACrE,oBAA0C;QAE1C,IAAI,CAAC,sBAAsB,GAAG,sBAAsB,CAAA;QACpD,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAA;IAClD,CAAC;IAKD,2BAA2B,CAAC,WAA4C;QACtE,OAAO;YACL,IAAI,EAAE,UAAU,IAAI,CAAC,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AED,SAAS,qBAAqB,CAAC,aAAiC;IAC9D,QACE,aAIkB,EAClB,CAAC;QACD,KAAK,OAAO,CAAC,CAAC,CAAC;YACb,OAAO,OAAO,CAAA;QAChB,CAAC;QACD,KAAK,MAAM,CAAC,CAAC,CAAC;YACZ,OAAO,aAAa,CAAA;QACtB,CAAC;QACD,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,OAAO,QAAQ,CAAA;QACjB,CAAC;QACD,KAAK,MAAM,CAAC,CAAC,CAAC;YACZ,OAAO,MAAM,CAAA;QACf,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACR,OAAO,aAAa,CAAA;QACtB,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,wBAAwB,CAAC,kBAAsC;IACtE,IAAI,kBAAkB,EAAE,CAAC;QACvB,MAAM,IAAI,GAAG,mBAAmB,CAAC,YAAY,CAAC;YAC5C,UAAU,EAAE,SAAS;YACrB,KAAK,EAAE,kBAAkB;SAC1B,CAAC,CAAA;QACF,IAAI,IAAI,EAAE,CAAC;YACT,OAAO,mBAAmB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;QAC7C,CAAC;IACH,CAAC;AACH,CAAC;AAED,eAAe,wBAAwB,CAAA","sourcesContent":["import { SubmissionEventTypes, SubmissionTypes } from '@oneblink/types'\nimport {\n BasePaymentConfigurationPayload,\n PaymentProvider,\n} from '../../types/payments'\nimport { FormSubmissionResult } from '../../types/submissions'\nimport replaceInjectablesWithSubmissionValues from '../replaceInjectablesWithSubmissionValues'\nimport OneBlinkAppsError from '../errors/oneBlinkAppsError'\nimport {\n generateAmountReceiptItem,\n generateCreditCardMaskReceiptItem,\n generateReceiptItem,\n generateSubmissionIdReceiptItem,\n prepareReceiptItems,\n} from './receipt-items'\nimport { localisationService } from '../..'\n\nclass NSWGovPayPaymentProvider implements PaymentProvider<SubmissionEventTypes.NSWGovPaySubmissionEvent> {\n constructor(\n paymentSubmissionEvent: SubmissionEventTypes.NSWGovPaySubmissionEvent,\n formSubmissionResult: FormSubmissionResult,\n ) {\n this.paymentSubmissionEvent = paymentSubmissionEvent\n this.formSubmissionResult = formSubmissionResult\n }\n\n paymentSubmissionEvent: SubmissionEventTypes.NSWGovPaySubmissionEvent\n formSubmissionResult: FormSubmissionResult\n\n preparePaymentConfiguration(basePayload: BasePaymentConfigurationPayload) {\n return {\n path: `/forms/${this.formSubmissionResult.definition.id}/nsw-gov-pay-payment`,\n payload: {\n ...basePayload,\n integrationPrimaryAgencyId:\n this.paymentSubmissionEvent.configuration.primaryAgencyId,\n productDescription: replaceInjectablesWithSubmissionValues(\n this.paymentSubmissionEvent.configuration.productDescription,\n this.formSubmissionResult,\n ).text,\n customerReference:\n this.paymentSubmissionEvent.configuration.customerReference &&\n replaceInjectablesWithSubmissionValues(\n this.paymentSubmissionEvent.configuration.customerReference,\n this.formSubmissionResult,\n ).text,\n subAgencyCode:\n this.paymentSubmissionEvent.configuration.subAgencyCode &&\n replaceInjectablesWithSubmissionValues(\n this.paymentSubmissionEvent.configuration.subAgencyCode,\n this.formSubmissionResult,\n ).text,\n },\n }\n }\n\n async verifyPaymentTransaction(query: Record<string, unknown>) {\n const {\n submissionId,\n isSuccess,\n errorMessage,\n paymentReference,\n completionReference,\n bankReference,\n paymentMethod,\n cardLast4Digits,\n bPayBillerCode,\n bPayCrn,\n bPayProcessingDate,\n amount,\n surcharge,\n surchargeGst,\n } = query as {\n submissionId?: string\n isSuccess?: string\n errorMessage?: string\n paymentReference?: string\n completionReference?: string\n bankReference?: string\n paymentMethod?: string\n bPayBillerCode?: string\n bPayCrn?: string\n bPayProcessingDate?: string\n cardLast4Digits?: string\n amount?: string\n surcharge?: string\n surchargeGst?: string\n }\n\n if (!submissionId || !isSuccess || !paymentReference) {\n throw new OneBlinkAppsError(\n 'Transactions can not be verified unless navigating here directly after a payment.',\n )\n }\n\n if (this.formSubmissionResult.submissionId !== submissionId) {\n throw new OneBlinkAppsError(\n 'It looks like you are attempting to view a receipt for the incorrect payment.',\n )\n }\n\n return {\n receiptItems: prepareReceiptItems([\n generateSubmissionIdReceiptItem(this.formSubmissionResult.submissionId),\n generateReceiptItem({\n className: 'ob-payment-receipt__completion-reference',\n valueClassName: 'cypress-payment-receipt-completion-reference',\n icon: 'check_circle',\n label: 'Completion Reference',\n value: completionReference,\n allowCopyToClipboard: true,\n }),\n {\n className: 'ob-payment-receipt__payment-reference',\n valueClassName: 'cypress-payment-receipt-payment-reference',\n icon: 'shopping_cart',\n label: 'Payment Reference',\n value: paymentReference,\n allowCopyToClipboard: true,\n },\n generateReceiptItem({\n className: 'ob-payment-receipt__bank-reference',\n valueClassName: 'cypress-payment-receipt-bank-reference',\n icon: 'account_balance',\n label: 'Bank Reference',\n value: bankReference,\n allowCopyToClipboard: true,\n }),\n generateReceiptItem({\n className: 'ob-payment-payment-method',\n valueClassName: 'cypress-payment-receipt-payment-method',\n icon: 'account_balance_wallet',\n label: 'Payment Method',\n value: getPaymentMethodLabel(paymentMethod),\n allowCopyToClipboard: false,\n }),\n generateCreditCardMaskReceiptItem(\n cardLast4Digits ? `xxxx xxxx xxxx ${cardLast4Digits}` : null,\n ),\n generateReceiptItem({\n className: 'ob-payment-receipt__bpay-biller-code',\n valueClassName: 'cypress-payment-receipt-bpay-biller-code',\n icon: 'account_balance',\n label: 'BPay Biller Code',\n value: bPayBillerCode,\n allowCopyToClipboard: true,\n }),\n generateReceiptItem({\n className: 'ob-payment-receipt__bpay-crn',\n valueClassName: 'cypress-payment-receipt-bpay-crn',\n icon: 'account_balance',\n label: 'BPay Reference',\n value: bPayCrn,\n allowCopyToClipboard: true,\n }),\n generateReceiptItem({\n className: 'ob-payment-receipt__bpay-processing-date',\n valueClassName: 'cypress-payment-receipt-bpay-processing-date',\n icon: 'account_balance',\n label: 'BPay Processing Date',\n value: formatBPayProcessingDate(bPayProcessingDate),\n allowCopyToClipboard: false,\n }),\n generateAmountReceiptItem(\n typeof amount === 'string' ? parseFloat(amount) : undefined,\n ),\n generateReceiptItem({\n className: 'ob-payment-receipt__surcharge',\n valueClassName: 'cypress-payment-receipt-surcharge',\n icon: 'price_check',\n label: 'Surcharge Amount',\n value:\n typeof surcharge === 'string'\n ? localisationService.formatCurrency(parseFloat(surcharge))\n : undefined,\n allowCopyToClipboard: false,\n }),\n generateReceiptItem({\n className: 'ob-payment-receipt__surcharge-gst',\n valueClassName: 'cypress-payment-receipt-surcharge-gst',\n icon: 'price_check',\n label: 'Surcharge GST',\n value:\n typeof surchargeGst === 'string'\n ? localisationService.formatCurrency(parseFloat(surchargeGst))\n : undefined,\n allowCopyToClipboard: false,\n }),\n ]),\n transaction: {\n isSuccess: isSuccess === 'true',\n errorMessage,\n },\n submissionResult: this.formSubmissionResult,\n }\n }\n}\n\nfunction getPaymentMethodLabel(paymentMethod: string | undefined) {\n switch (\n paymentMethod as NonNullable<\n NonNullable<\n SubmissionTypes.NSWGovPayPayment['paymentTransaction']\n >['agencyCompletionPayment']\n >['paymentMethod']\n ) {\n case 'PAYID': {\n return 'PayID'\n }\n case 'CARD': {\n return 'Credit Card'\n }\n case 'PAYPAL': {\n return 'PayPal'\n }\n case 'BPAY': {\n return 'BPay'\n }\n default: {\n return paymentMethod\n }\n }\n}\n\nfunction formatBPayProcessingDate(bPayProcessingDate: string | undefined) {\n if (bPayProcessingDate) {\n const date = localisationService.generateDate({\n daysOffset: undefined,\n value: bPayProcessingDate,\n })\n if (date) {\n return localisationService.formatDate(date)\n }\n }\n}\n\nexport default NSWGovPayPaymentProvider\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oneblink/apps-react",
3
3
  "description": "Helper functions for OneBlink apps in ReactJS.",
4
- "version": "10.1.2",
4
+ "version": "10.2.0-beta.2",
5
5
  "author": "OneBlink <developers@oneblink.io> (https://oneblink.io)",
6
6
  "bugs": {
7
7
  "url": "https://github.com/oneblink/apps-react/issues"