-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2577 from Shopify/vic/transaction-complete-types
Add transaction complete event types
- Loading branch information
Showing
9 changed files
with
110 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@shopify/ui-extensions': minor | ||
'@shopify/ui-extensions-react': minor | ||
--- | ||
|
||
Adds POS UI Extension: TransactionCompleteInput property typing and payment interfaces |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
packages/ui-extensions/src/surfaces/point-of-sale/event/input/PurchaseCompleteInput.ts
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
packages/ui-extensions/src/surfaces/point-of-sale/event/input/TransactionCompleteInput.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { | ||
Discount, | ||
LineItem, | ||
PaymentMethod, | ||
ShippingLine, | ||
TaxLine, | ||
} from '../../api'; | ||
import {BaseInput} from './BaseInput'; | ||
|
||
export interface TransactionCompleteInput extends BaseInput { | ||
transactionComplete: { | ||
discounts: Discount[]; | ||
draftCheckoutId: number; | ||
lineItems: LineItem[]; | ||
orderId?: number; | ||
paymentMethods: PaymentMethod[]; | ||
shippingLines?: ShippingLine; | ||
taxLines?: TaxLine[]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export type {BaseInput} from './event/input/BaseInput'; | ||
export type {PurchaseCompleteInput} from './event/input/PurchaseCompleteInput'; | ||
export type {TransactionCompleteInput} from './event/input/TransactionCompleteInput'; | ||
|
||
export type {Device} from './types/device'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
packages/ui-extensions/src/surfaces/point-of-sale/types/payment.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
export type PaymentMethod = | ||
| CashPayment | ||
| CreditPayment | ||
| GiftCardPayment | ||
| ShopPayPayment | ||
| CustomPayment | ||
| UnknownPayment; | ||
|
||
export type CardSource = 'manual' | 'swiped' | 'emv'; | ||
|
||
interface BasePayment { | ||
amount: string; | ||
} | ||
|
||
interface CreditPayment extends BasePayment { | ||
type: 'CreditCard'; | ||
brand: string; | ||
tipAmount: string; | ||
cardSource?: CardSource; | ||
hasPendingOfflineTransactions: boolean; | ||
} | ||
|
||
interface CashPayment extends BasePayment { | ||
type: 'Cash'; | ||
changeAmount: string; | ||
roundedAmount?: string; | ||
} | ||
|
||
interface GiftCardPayment extends BasePayment { | ||
type: 'GiftCard'; | ||
lastCharacters: string; | ||
balance?: string; | ||
} | ||
|
||
interface ShopPayPayment extends BasePayment { | ||
type: 'ShopPay'; | ||
isInstallmentsPayment: boolean; | ||
orderTransactionId?: string; | ||
} | ||
|
||
interface CustomPayment extends BasePayment { | ||
type: 'Custom'; | ||
name: string; | ||
} | ||
|
||
interface UnknownPayment extends BasePayment { | ||
type: 'Unknown'; | ||
} |