Skip to content

Commit

Permalink
Merge pull request #27 from XYOracleNetwork/feature/payment-card-auth…
Browse files Browse the repository at this point in the history
…-sentinel

Payment Card Auth Sentinel
  • Loading branch information
JoelBCarter authored Apr 26, 2024
2 parents 3a26850 + 5f92acc commit c05cbc6
Show file tree
Hide file tree
Showing 52 changed files with 1,162 additions and 13 deletions.
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"quadkey",
"quicktime",
"realvideo",
"rebilly",
"replicaset",
"satoshi",
"scrollback",
Expand Down
47 changes: 47 additions & 0 deletions packages/payload/packages/payments/src/Billing/Address/Address.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, isPayloadOfSchemaTypeWithSources, Payload } from '@xyo-network/payload-model'

import { BillingAddressSchema } from './Schema'

/**
* The fields describing a billing address.
*/
export interface BillingAddressFields {
/** Street address line 1. */
address: string
/** Street address line 2. */
address2?: string | null
/** City of the billing address. */
city?: string
/** Country code of the billing address, ISO 3166-1 alpha-2 code. */
country?: string
/** First name */
firstName: string
/** Last name */
lastName: string
/** Organization or company name associated with the billing address. */
organization?: string | null
/** Postal or ZIP code of the billing address. */
postalCode?: string
/** State or region of the billing address. */
region?: string
}

/**
* A BillingAddress Payload
*/
export type BillingAddress = Payload<BillingAddressFields, BillingAddressSchema>

/**
* Identity function for determine if an object is a BillingAddress
*/
export const isBillingAddress = isPayloadOfSchemaType<BillingAddress>(BillingAddressSchema)

/**
* Identity function for determine if an object is a BillingAddress with sources
*/
export const isBillingAddressWithSources = isPayloadOfSchemaTypeWithSources<BillingAddress>(BillingAddressSchema)

/**
* Identity function for determine if an object is a BillingAddress with meta
*/
export const isBillingAddressWithMeta = isPayloadOfSchemaTypeWithMeta<BillingAddress>(BillingAddressSchema)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { BillingSchema } from '../Schema'

export const BillingAddressSchema = `${BillingSchema}.address`
export type BillingAddressSchema = typeof BillingAddressSchema
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './Address'
export * from './Schema'
4 changes: 4 additions & 0 deletions packages/payload/packages/payments/src/Billing/Schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { PaymentsSchema } from '../Schema'

export const BillingSchema = `${PaymentsSchema}.billing`
export type BillingSchema = typeof BillingSchema
2 changes: 2 additions & 0 deletions packages/payload/packages/payments/src/Billing/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './Address'
export * from './Schema'
4 changes: 2 additions & 2 deletions packages/payload/packages/payments/src/Escrow/Schema.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export type EscrowSchema = 'network.xyo.escrow'
export const EscrowSchema: EscrowSchema = 'network.xyo.escrow'
export const EscrowSchema = 'network.xyo.escrow'
export type EscrowSchema = typeof EscrowSchema
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { isPayloadOfSchemaType, isPayloadOfSchemaTypeWithMeta, isPayloadOfSchemaTypeWithSources, Payload } from '@xyo-network/payload-model'

import { PaymentCardSchema } from './Schema'

/**
* The fields describing a payment card.
*/
export interface PaymentCardFields {
/**
* Card Number (PAN) of the payment card. This value is required to perform a payment.
*/
cardNumber: string
/**
* The name as it appears on the payment card.
*/
cardholderName?: string
/**
* Card Verification Value (CVV/CVC) of the payment card.
*/
cvv: string
/**
* Expiration month of the payment card.
*/
expMonth: number
/**
* Expiration year of the payment card.
*/
expYear: number
}

/**
* A PaymentCard Payload
*/
export type PaymentCard = Payload<PaymentCardFields, PaymentCardSchema>

/**
* Identity function for determine if an object is a PaymentCard
*/
export const isPaymentCard = isPayloadOfSchemaType<PaymentCard>(PaymentCardSchema)

/**
* Identity function for determine if an object is a PaymentCard with sources
*/
export const isPaymentCardWithSources = isPayloadOfSchemaTypeWithSources<PaymentCard>(PaymentCardSchema)

/**
* Identity function for determine if an object is a PaymentCard with meta
*/
export const isPaymentCardWithMeta = isPayloadOfSchemaTypeWithMeta<PaymentCard>(PaymentCardSchema)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { PaymentInstrumentSchema } from '../Schema'

export const PaymentCardSchema = `${PaymentInstrumentSchema}.card`
export type PaymentCardSchema = typeof PaymentCardSchema
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './Payload'
export * from './Schema'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { PaymentSchema } from '../Schema'

export const PaymentInstrumentSchema = `${PaymentSchema}.instrument`
export type PaymentInstrumentSchema = typeof PaymentInstrumentSchema
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './Card'
export * from './Schema'
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ import {
PayloadWithSources,
} from '@xyo-network/payload-model'

import { SupportedCurrency } from './Currency'

export type PaymentSchema = 'network.xyo.payments.payment'
export const PaymentSchema: PaymentSchema = 'network.xyo.payments.payment'
import { SupportedCurrency } from '../Currency'
import { PaymentSchema } from './Schema'

export interface PaymentFields {
/**
Expand Down
4 changes: 4 additions & 0 deletions packages/payload/packages/payments/src/Payment/Schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { PaymentsSchema } from '../Schema'

export const PaymentSchema = `${PaymentsSchema}.payment`
export type PaymentSchema = typeof PaymentSchema
3 changes: 3 additions & 0 deletions packages/payload/packages/payments/src/Payment/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './Instrument'
export * from './Payload'
export * from './Schema'
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import {
PayloadWithSources,
} from '@xyo-network/payload-model'

export type PurchaseSchema = 'network.xyo.payments.purchase'
export const PurchaseSchema: PurchaseSchema = 'network.xyo.payments.purchase'
import { PurchaseSchema } from './Schema'

export interface PurchaseFields {
/**
Expand Down
4 changes: 4 additions & 0 deletions packages/payload/packages/payments/src/Purchase/Schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { PaymentsSchema } from '../Schema'

export const PurchaseSchema = `${PaymentsSchema}.purchase`
export type PurchaseSchema = typeof PurchaseSchema
2 changes: 2 additions & 0 deletions packages/payload/packages/payments/src/Purchase/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './Payload'
export * from './Schema'
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ import {
PayloadWithSources,
} from '@xyo-network/payload-model'

import { SupportedCurrency } from './Currency'

export type ReceiptSchema = 'network.xyo.payments.receipt'
export const ReceiptSchema: ReceiptSchema = 'network.xyo.payments.receipt'
import { SupportedCurrency } from '../Currency'
import { ReceiptSchema } from './Schema'

export interface ReceiptFields {
/**
Expand Down
4 changes: 4 additions & 0 deletions packages/payload/packages/payments/src/Receipt/Schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { PaymentsSchema } from '../Schema'

export const ReceiptSchema = `${PaymentsSchema}.receipt`
export type ReceiptSchema = typeof ReceiptSchema
2 changes: 2 additions & 0 deletions packages/payload/packages/payments/src/Receipt/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './Payload'
export * from './Schema'
2 changes: 2 additions & 0 deletions packages/payload/packages/payments/src/Schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const PaymentsSchema = 'network.xyo.payments'
export type PaymentsSchema = typeof PaymentsSchema
1 change: 1 addition & 0 deletions packages/payload/packages/payments/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './Billing'
export * from './Currency'
export * from './Escrow'
export * from './Payment'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.*
.env
.eslintcache
.example.env
tsconfig*
jest.config.js
rollup.config.ts
yarn.lock
**/*.spec.ts
**/*.snap

.github
docs
.pnp.*
.vscode
.yarn/*
coverage
cspell.json
node_modules
swagger.json
packages
Loading

0 comments on commit c05cbc6

Please sign in to comment.