Drop deprecated field in transactionsAPI (#3873)
This commit is contained in:
parent
74e5e07466
commit
3093be1b7d
20 changed files with 4484 additions and 1672 deletions
5
.changeset/fast-apes-draw.md
Normal file
5
.changeset/fast-apes-draw.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"saleor-dashboard": minor
|
||||
---
|
||||
|
||||
Drop deprecated fields in transactionsAPI
|
3389
introspection.json
3389
introspection.json
File diff suppressed because it is too large
Load diff
|
@ -2120,10 +2120,6 @@
|
|||
"DRMMDs": {
|
||||
"string": "Attribute Name"
|
||||
},
|
||||
"DRwqnt": {
|
||||
"context": "order history message",
|
||||
"string": "Transaction capture requested"
|
||||
},
|
||||
"DTL7sE": {
|
||||
"context": "dialog content",
|
||||
"string": "Are you sure you want to delete {warehouseName}?"
|
||||
|
@ -5234,10 +5230,6 @@
|
|||
"context": "accepted header names",
|
||||
"string": "Headers with in following format are accepted: <code>authorization*</code>, <code>x-*</code>"
|
||||
},
|
||||
"ZKuzRy": {
|
||||
"context": "order history message",
|
||||
"string": "Transaction void requested"
|
||||
},
|
||||
"ZMy18J": {
|
||||
"string": "You have reached your channel limit, you will be no longer able to add channels to your store. If you would like to up your limit, contact your administration staff about raising your limits."
|
||||
},
|
||||
|
|
2069
schema.graphql
2069
schema.graphql
File diff suppressed because it is too large
Load diff
|
@ -456,12 +456,9 @@ export const transactionEvent = gql`
|
|||
export const transactionItemFragment = gql`
|
||||
fragment TransactionItem on TransactionItem {
|
||||
id
|
||||
# TODO: remove me
|
||||
type
|
||||
pspReference
|
||||
actions
|
||||
type
|
||||
status
|
||||
name
|
||||
externalUrl
|
||||
events {
|
||||
...TransactionEvent
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
"ShippingMethod"
|
||||
],
|
||||
"Event": [
|
||||
"AccountChangeEmailRequested",
|
||||
"AccountConfirmationRequested",
|
||||
"AccountDeleteRequested",
|
||||
"AddressCreated",
|
||||
"AddressDeleted",
|
||||
"AddressUpdated",
|
||||
|
@ -127,7 +130,6 @@
|
|||
"StaffDeleted",
|
||||
"StaffUpdated",
|
||||
"ThumbnailCreated",
|
||||
"TransactionActionRequest",
|
||||
"TransactionCancelationRequested",
|
||||
"TransactionChargeRequested",
|
||||
"TransactionInitializeSession",
|
||||
|
|
|
@ -1343,11 +1343,9 @@ ${AppAvatarFragmentDoc}`;
|
|||
export const TransactionItemFragmentDoc = gql`
|
||||
fragment TransactionItem on TransactionItem {
|
||||
id
|
||||
type
|
||||
pspReference
|
||||
actions
|
||||
type
|
||||
status
|
||||
name
|
||||
externalUrl
|
||||
events {
|
||||
...TransactionEvent
|
||||
|
@ -10482,8 +10480,8 @@ export const CreateManualTransactionCaptureDocument = gql`
|
|||
mutation CreateManualTransactionCapture($orderId: ID!, $amount: PositiveDecimal!, $currency: String!, $description: String, $pspReference: String) {
|
||||
transactionCreate(
|
||||
id: $orderId
|
||||
transaction: {type: "Manual capture", status: "Success", pspReference: $pspReference, amountCharged: {amount: $amount, currency: $currency}}
|
||||
transactionEvent: {status: SUCCESS, pspReference: $pspReference, name: $description}
|
||||
transaction: {name: "Manual capture", pspReference: $pspReference, amountCharged: {amount: $amount, currency: $currency}}
|
||||
transactionEvent: {pspReference: $pspReference, message: $description}
|
||||
) {
|
||||
transaction {
|
||||
...TransactionItem
|
||||
|
@ -10529,8 +10527,8 @@ export const CreateManualTransactionRefundDocument = gql`
|
|||
mutation CreateManualTransactionRefund($orderId: ID!, $amount: PositiveDecimal!, $currency: String!, $description: String, $pspReference: String) {
|
||||
transactionCreate(
|
||||
id: $orderId
|
||||
transaction: {type: "Manual refund", status: "Success", pspReference: $pspReference, amountRefunded: {amount: $amount, currency: $currency}}
|
||||
transactionEvent: {status: SUCCESS, pspReference: $pspReference, name: $description}
|
||||
transaction: {name: "Manual refund", pspReference: $pspReference, amountRefunded: {amount: $amount, currency: $currency}}
|
||||
transactionEvent: {pspReference: $pspReference, message: $description}
|
||||
) {
|
||||
transaction {
|
||||
...TransactionItem
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -468,7 +468,7 @@ export function transformFormToAddressInput<T>(
|
|||
}
|
||||
|
||||
export function getStringOrPlaceholder(
|
||||
s: string | undefined,
|
||||
s: string | undefined | null,
|
||||
placeholder?: string,
|
||||
): string {
|
||||
return s || placeholder || "...";
|
||||
|
|
|
@ -289,18 +289,6 @@ export const getEventMessage = (
|
|||
defaultMessage: "Transaction refund requested",
|
||||
description: "order history message",
|
||||
});
|
||||
case OrderEventsEnum.TRANSACTION_VOID_REQUESTED:
|
||||
return intl.formatMessage({
|
||||
id: "ZKuzRy",
|
||||
defaultMessage: "Transaction void requested",
|
||||
description: "order history message",
|
||||
});
|
||||
case OrderEventsEnum.TRANSACTION_CAPTURE_REQUESTED:
|
||||
return intl.formatMessage({
|
||||
id: "DRwqnt",
|
||||
defaultMessage: "Transaction capture requested",
|
||||
description: "order history message",
|
||||
});
|
||||
case OrderEventsEnum.TRANSACTION_CHARGE_REQUESTED:
|
||||
return intl.formatMessage({
|
||||
id: "UxOcKE",
|
||||
|
|
|
@ -122,7 +122,7 @@ const OrderSendRefundPage: React.FC<OrderSendRefundPageProps> = ({
|
|||
{loading && <Skeleton />}
|
||||
<ul className={classes.dataList}>
|
||||
{order?.transactions.map(transaction => (
|
||||
<DataLine label={transaction.type}>
|
||||
<DataLine label={transaction.name}>
|
||||
<DataLineMoney money={transaction.refundedAmount} />
|
||||
</DataLine>
|
||||
))}
|
||||
|
|
|
@ -15,14 +15,13 @@ const props: OrderTransactionProps = {
|
|||
transaction: {
|
||||
__typename: "TransactionItem",
|
||||
id: "VHJhbnNhY3Rpb25JdGVtOjI=",
|
||||
type: "Adyen: refund",
|
||||
name: "Adyen: refund",
|
||||
pspReference: "12345",
|
||||
actions: [
|
||||
TransactionActionEnum.CHARGE,
|
||||
TransactionActionEnum.REFUND,
|
||||
TransactionActionEnum.VOID,
|
||||
TransactionActionEnum.CANCEL,
|
||||
],
|
||||
status: "Partial capture",
|
||||
externalUrl: "https://google.com",
|
||||
events: [
|
||||
{
|
||||
|
|
|
@ -61,7 +61,7 @@ export const CardTitle: React.FC<CardTitleProps> = ({
|
|||
<LinkIcon />
|
||||
</IconButton>
|
||||
)}
|
||||
{transaction.type}
|
||||
{transaction.name}
|
||||
</TransactionLink>
|
||||
|
||||
<div className={classes.dataDisplay}>
|
||||
|
|
|
@ -22,7 +22,6 @@ export const mapActionToMessage: Record<
|
|||
TransactionActionUnion,
|
||||
MessageDescriptor
|
||||
> = {
|
||||
VOID: transactionActionMessages.void,
|
||||
CHARGE: transactionActionMessages.capture,
|
||||
CANCEL: transactionActionMessages.cancel,
|
||||
// refund is handled in "Send refund" view not in Transactions list
|
||||
|
|
|
@ -62,12 +62,11 @@ const OrderTransactionGiftCard: React.FC<OrderTransactionGiftCardProps> = ({
|
|||
|
||||
const fakeTransaction: FakeTransaction = {
|
||||
id: giftCard.id,
|
||||
type: intl.formatMessage(transactionGiftCardMessages.giftCard, {
|
||||
name: intl.formatMessage(transactionGiftCardMessages.giftCard, {
|
||||
code: giftCard.last4CodeChars,
|
||||
}),
|
||||
actions: [],
|
||||
pspReference: giftCard.last4CodeChars,
|
||||
status: "",
|
||||
externalUrl: null,
|
||||
chargedAmount: prepareMoney(amount, currency),
|
||||
// Fake amounts
|
||||
|
|
|
@ -45,10 +45,9 @@ const OrderTransactionPayment: React.FC<OrderTransactionPaymentProps> = ({
|
|||
|
||||
const transactionFromPayment: FakeTransaction = {
|
||||
id: payment.id,
|
||||
type: findMethodName(payment.gateway, allPaymentMethods),
|
||||
name: findMethodName(payment.gateway, allPaymentMethods),
|
||||
actions: mapOrderActionsToTransactionActions(payment.actions),
|
||||
pspReference: "",
|
||||
status: "",
|
||||
externalUrl: null,
|
||||
chargedAmount: getTransactionAmount(payment.capturedAmount, currency),
|
||||
authorizedAmount: getTransactionAmount(
|
||||
|
@ -70,7 +69,7 @@ const OrderTransactionPayment: React.FC<OrderTransactionPaymentProps> = ({
|
|||
if (action === TransactionActionEnum.CHARGE) {
|
||||
onCapture();
|
||||
}
|
||||
if (action === TransactionActionEnum.VOID) {
|
||||
if (action === TransactionActionEnum.CANCEL) {
|
||||
onVoid();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -138,7 +138,7 @@ export const mapOrderActionsToTransactionActions = (
|
|||
.map(action => {
|
||||
switch (action) {
|
||||
case OrderAction.VOID:
|
||||
return TransactionActionEnum.VOID;
|
||||
return TransactionActionEnum.CANCEL;
|
||||
case OrderAction.CAPTURE:
|
||||
return TransactionActionEnum.CHARGE;
|
||||
case OrderAction.REFUND:
|
||||
|
|
|
@ -111,10 +111,9 @@ export const clients: RelayToFlat<SearchCustomersQuery["search"]> = [
|
|||
export const orderTransactions: TransactionItemFragment[] = [
|
||||
{
|
||||
id: "VHJhbnNhY3Rpb25JdGVtOjE=",
|
||||
type: "mollie-creditcard",
|
||||
name: "mollie-creditcard",
|
||||
pspReference: "ord_3d41ih",
|
||||
actions: [],
|
||||
status: "Paid",
|
||||
externalUrl: null,
|
||||
events: [
|
||||
{
|
||||
|
@ -145,10 +144,9 @@ export const orderTransactions: TransactionItemFragment[] = [
|
|||
},
|
||||
{
|
||||
id: "VHJhbnNhY3Rpb25JdGVtOjI=",
|
||||
type: "test",
|
||||
name: "test",
|
||||
pspReference: "123",
|
||||
externalUrl: null,
|
||||
status: "Partially refunded",
|
||||
actions: [],
|
||||
events: [
|
||||
{
|
||||
|
@ -2633,10 +2631,9 @@ export const transactions: Record<
|
|||
preauthorized: [
|
||||
{
|
||||
id: "VHJhbnNhY3Rpb25JdGVtOjE=",
|
||||
type: "Mollie",
|
||||
name: "Mollie",
|
||||
pspReference: "ord_3d41ih",
|
||||
actions: [TransactionActionEnum.VOID, TransactionActionEnum.CHARGE],
|
||||
status: "Authorized",
|
||||
actions: [TransactionActionEnum.CANCEL, TransactionActionEnum.CHARGE],
|
||||
externalUrl: null,
|
||||
events: [
|
||||
{
|
||||
|
@ -2669,9 +2666,8 @@ export const transactions: Record<
|
|||
pendingCharge: [
|
||||
{
|
||||
id: "VHJhbnNhY3Rpb25JdGVtOjE=",
|
||||
type: "Mollie",
|
||||
name: "Mollie",
|
||||
pspReference: "ord_3d41ih",
|
||||
status: "Pending charge",
|
||||
externalUrl: null,
|
||||
actions: [],
|
||||
events: [
|
||||
|
@ -2720,10 +2716,9 @@ export const transactions: Record<
|
|||
chargeSuccess: [
|
||||
{
|
||||
id: "VHJhbnNhY3Rpb25JdGVtOjE=",
|
||||
type: "Mollie",
|
||||
name: "Mollie",
|
||||
pspReference: "ord_3d41ih",
|
||||
actions: [TransactionActionEnum.REFUND],
|
||||
status: "Fully paid",
|
||||
externalUrl: null,
|
||||
events: [
|
||||
{
|
||||
|
@ -2786,10 +2781,9 @@ export const transactions: Record<
|
|||
chargePartial: [
|
||||
{
|
||||
id: "VHJhbnNhY3Rpb25JdGVtOjE=",
|
||||
type: "Mollie",
|
||||
name: "Mollie",
|
||||
pspReference: "ord_3d41ih",
|
||||
actions: [TransactionActionEnum.REFUND],
|
||||
status: "Partially charged",
|
||||
externalUrl: null,
|
||||
events: [
|
||||
{
|
||||
|
@ -2852,10 +2846,9 @@ export const transactions: Record<
|
|||
chargeFail: [
|
||||
{
|
||||
id: "VHJhbnNhY3Rpb25JdGVtOjE=",
|
||||
type: "Mollie",
|
||||
name: "Mollie",
|
||||
pspReference: "ord_3d41ih",
|
||||
actions: [TransactionActionEnum.CHARGE],
|
||||
status: "Failed",
|
||||
externalUrl: null,
|
||||
events: [
|
||||
{
|
||||
|
@ -2918,10 +2911,9 @@ export const transactions: Record<
|
|||
refundRequested: [
|
||||
{
|
||||
id: "VHJhbnNhY3Rpb25JdGVtOjE=",
|
||||
type: "Mollie",
|
||||
name: "Mollie",
|
||||
pspReference: "ord_3d41ih",
|
||||
actions: [],
|
||||
status: "Pending refund",
|
||||
externalUrl: null,
|
||||
events: [
|
||||
{
|
||||
|
@ -2999,10 +2991,9 @@ export const transactions: Record<
|
|||
refundCompleted: [
|
||||
{
|
||||
id: "VHJhbnNhY3Rpb25JdGVtOjE=",
|
||||
type: "Mollie",
|
||||
name: "Mollie",
|
||||
pspReference: "ord_3d41ih",
|
||||
actions: [],
|
||||
status: "Refund completed",
|
||||
externalUrl: null,
|
||||
events: [
|
||||
{
|
||||
|
@ -3095,10 +3086,9 @@ export const transactions: Record<
|
|||
refundPartial: [
|
||||
{
|
||||
id: "VHJhbnNhY3Rpb25JdGVtOjE=",
|
||||
type: "Mollie",
|
||||
name: "Mollie",
|
||||
pspReference: "ord_3d41ih",
|
||||
actions: [],
|
||||
status: "Partially charged",
|
||||
externalUrl: null,
|
||||
events: [
|
||||
{
|
||||
|
|
|
@ -569,16 +569,11 @@ export const createManualTransactionCapture = gql`
|
|||
transactionCreate(
|
||||
id: $orderId
|
||||
transaction: {
|
||||
type: "Manual capture"
|
||||
status: "Success"
|
||||
name: "Manual capture"
|
||||
pspReference: $pspReference
|
||||
amountCharged: { amount: $amount, currency: $currency }
|
||||
}
|
||||
transactionEvent: {
|
||||
status: SUCCESS
|
||||
pspReference: $pspReference
|
||||
name: $description
|
||||
}
|
||||
transactionEvent: { pspReference: $pspReference, message: $description }
|
||||
) {
|
||||
transaction {
|
||||
...TransactionItem
|
||||
|
@ -601,16 +596,11 @@ export const createManualTransactionRefund = gql`
|
|||
transactionCreate(
|
||||
id: $orderId
|
||||
transaction: {
|
||||
type: "Manual refund"
|
||||
status: "Success"
|
||||
name: "Manual refund"
|
||||
pspReference: $pspReference
|
||||
amountRefunded: { amount: $amount, currency: $currency }
|
||||
}
|
||||
transactionEvent: {
|
||||
status: SUCCESS
|
||||
pspReference: $pspReference
|
||||
name: $description
|
||||
}
|
||||
transactionEvent: { pspReference: $pspReference, message: $description }
|
||||
) {
|
||||
transaction {
|
||||
...TransactionItem
|
||||
|
|
Loading…
Reference in a new issue