Drop deprecated field in transactionsAPI (#3873)

This commit is contained in:
Paweł Chyła 2023-07-06 13:01:10 +02:00 committed by GitHub
parent 74e5e07466
commit 3093be1b7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 4484 additions and 1672 deletions

View file

@ -0,0 +1,5 @@
---
"saleor-dashboard": minor
---
Drop deprecated fields in transactionsAPI

File diff suppressed because it is too large Load diff

View file

@ -2120,10 +2120,6 @@
"DRMMDs": { "DRMMDs": {
"string": "Attribute Name" "string": "Attribute Name"
}, },
"DRwqnt": {
"context": "order history message",
"string": "Transaction capture requested"
},
"DTL7sE": { "DTL7sE": {
"context": "dialog content", "context": "dialog content",
"string": "Are you sure you want to delete {warehouseName}?" "string": "Are you sure you want to delete {warehouseName}?"
@ -5234,10 +5230,6 @@
"context": "accepted header names", "context": "accepted header names",
"string": "Headers with in following format are accepted: <code>authorization*</code>, <code>x-*</code>" "string": "Headers with in following format are accepted: <code>authorization*</code>, <code>x-*</code>"
}, },
"ZKuzRy": {
"context": "order history message",
"string": "Transaction void requested"
},
"ZMy18J": { "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." "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."
}, },

File diff suppressed because it is too large Load diff

View file

@ -456,12 +456,9 @@ export const transactionEvent = gql`
export const transactionItemFragment = gql` export const transactionItemFragment = gql`
fragment TransactionItem on TransactionItem { fragment TransactionItem on TransactionItem {
id id
# TODO: remove me
type
pspReference pspReference
actions actions
type name
status
externalUrl externalUrl
events { events {
...TransactionEvent ...TransactionEvent

View file

@ -12,6 +12,9 @@
"ShippingMethod" "ShippingMethod"
], ],
"Event": [ "Event": [
"AccountChangeEmailRequested",
"AccountConfirmationRequested",
"AccountDeleteRequested",
"AddressCreated", "AddressCreated",
"AddressDeleted", "AddressDeleted",
"AddressUpdated", "AddressUpdated",
@ -127,7 +130,6 @@
"StaffDeleted", "StaffDeleted",
"StaffUpdated", "StaffUpdated",
"ThumbnailCreated", "ThumbnailCreated",
"TransactionActionRequest",
"TransactionCancelationRequested", "TransactionCancelationRequested",
"TransactionChargeRequested", "TransactionChargeRequested",
"TransactionInitializeSession", "TransactionInitializeSession",

View file

@ -1343,11 +1343,9 @@ ${AppAvatarFragmentDoc}`;
export const TransactionItemFragmentDoc = gql` export const TransactionItemFragmentDoc = gql`
fragment TransactionItem on TransactionItem { fragment TransactionItem on TransactionItem {
id id
type
pspReference pspReference
actions actions
type name
status
externalUrl externalUrl
events { events {
...TransactionEvent ...TransactionEvent
@ -10482,8 +10480,8 @@ export const CreateManualTransactionCaptureDocument = gql`
mutation CreateManualTransactionCapture($orderId: ID!, $amount: PositiveDecimal!, $currency: String!, $description: String, $pspReference: String) { mutation CreateManualTransactionCapture($orderId: ID!, $amount: PositiveDecimal!, $currency: String!, $description: String, $pspReference: String) {
transactionCreate( transactionCreate(
id: $orderId id: $orderId
transaction: {type: "Manual capture", status: "Success", pspReference: $pspReference, amountCharged: {amount: $amount, currency: $currency}} transaction: {name: "Manual capture", pspReference: $pspReference, amountCharged: {amount: $amount, currency: $currency}}
transactionEvent: {status: SUCCESS, pspReference: $pspReference, name: $description} transactionEvent: {pspReference: $pspReference, message: $description}
) { ) {
transaction { transaction {
...TransactionItem ...TransactionItem
@ -10529,8 +10527,8 @@ export const CreateManualTransactionRefundDocument = gql`
mutation CreateManualTransactionRefund($orderId: ID!, $amount: PositiveDecimal!, $currency: String!, $description: String, $pspReference: String) { mutation CreateManualTransactionRefund($orderId: ID!, $amount: PositiveDecimal!, $currency: String!, $description: String, $pspReference: String) {
transactionCreate( transactionCreate(
id: $orderId id: $orderId
transaction: {type: "Manual refund", status: "Success", pspReference: $pspReference, amountRefunded: {amount: $amount, currency: $currency}} transaction: {name: "Manual refund", pspReference: $pspReference, amountRefunded: {amount: $amount, currency: $currency}}
transactionEvent: {status: SUCCESS, pspReference: $pspReference, name: $description} transactionEvent: {pspReference: $pspReference, message: $description}
) { ) {
transaction { transaction {
...TransactionItem ...TransactionItem

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -468,7 +468,7 @@ export function transformFormToAddressInput<T>(
} }
export function getStringOrPlaceholder( export function getStringOrPlaceholder(
s: string | undefined, s: string | undefined | null,
placeholder?: string, placeholder?: string,
): string { ): string {
return s || placeholder || "..."; return s || placeholder || "...";

View file

@ -289,18 +289,6 @@ export const getEventMessage = (
defaultMessage: "Transaction refund requested", defaultMessage: "Transaction refund requested",
description: "order history message", 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: case OrderEventsEnum.TRANSACTION_CHARGE_REQUESTED:
return intl.formatMessage({ return intl.formatMessage({
id: "UxOcKE", id: "UxOcKE",

View file

@ -122,7 +122,7 @@ const OrderSendRefundPage: React.FC<OrderSendRefundPageProps> = ({
{loading && <Skeleton />} {loading && <Skeleton />}
<ul className={classes.dataList}> <ul className={classes.dataList}>
{order?.transactions.map(transaction => ( {order?.transactions.map(transaction => (
<DataLine label={transaction.type}> <DataLine label={transaction.name}>
<DataLineMoney money={transaction.refundedAmount} /> <DataLineMoney money={transaction.refundedAmount} />
</DataLine> </DataLine>
))} ))}

View file

@ -15,14 +15,13 @@ const props: OrderTransactionProps = {
transaction: { transaction: {
__typename: "TransactionItem", __typename: "TransactionItem",
id: "VHJhbnNhY3Rpb25JdGVtOjI=", id: "VHJhbnNhY3Rpb25JdGVtOjI=",
type: "Adyen: refund", name: "Adyen: refund",
pspReference: "12345", pspReference: "12345",
actions: [ actions: [
TransactionActionEnum.CHARGE, TransactionActionEnum.CHARGE,
TransactionActionEnum.REFUND, TransactionActionEnum.REFUND,
TransactionActionEnum.VOID, TransactionActionEnum.CANCEL,
], ],
status: "Partial capture",
externalUrl: "https://google.com", externalUrl: "https://google.com",
events: [ events: [
{ {

View file

@ -61,7 +61,7 @@ export const CardTitle: React.FC<CardTitleProps> = ({
<LinkIcon /> <LinkIcon />
</IconButton> </IconButton>
)} )}
{transaction.type} {transaction.name}
</TransactionLink> </TransactionLink>
<div className={classes.dataDisplay}> <div className={classes.dataDisplay}>

View file

@ -22,7 +22,6 @@ export const mapActionToMessage: Record<
TransactionActionUnion, TransactionActionUnion,
MessageDescriptor MessageDescriptor
> = { > = {
VOID: transactionActionMessages.void,
CHARGE: transactionActionMessages.capture, CHARGE: transactionActionMessages.capture,
CANCEL: transactionActionMessages.cancel, CANCEL: transactionActionMessages.cancel,
// refund is handled in "Send refund" view not in Transactions list // refund is handled in "Send refund" view not in Transactions list

View file

@ -62,12 +62,11 @@ const OrderTransactionGiftCard: React.FC<OrderTransactionGiftCardProps> = ({
const fakeTransaction: FakeTransaction = { const fakeTransaction: FakeTransaction = {
id: giftCard.id, id: giftCard.id,
type: intl.formatMessage(transactionGiftCardMessages.giftCard, { name: intl.formatMessage(transactionGiftCardMessages.giftCard, {
code: giftCard.last4CodeChars, code: giftCard.last4CodeChars,
}), }),
actions: [], actions: [],
pspReference: giftCard.last4CodeChars, pspReference: giftCard.last4CodeChars,
status: "",
externalUrl: null, externalUrl: null,
chargedAmount: prepareMoney(amount, currency), chargedAmount: prepareMoney(amount, currency),
// Fake amounts // Fake amounts

View file

@ -45,10 +45,9 @@ const OrderTransactionPayment: React.FC<OrderTransactionPaymentProps> = ({
const transactionFromPayment: FakeTransaction = { const transactionFromPayment: FakeTransaction = {
id: payment.id, id: payment.id,
type: findMethodName(payment.gateway, allPaymentMethods), name: findMethodName(payment.gateway, allPaymentMethods),
actions: mapOrderActionsToTransactionActions(payment.actions), actions: mapOrderActionsToTransactionActions(payment.actions),
pspReference: "", pspReference: "",
status: "",
externalUrl: null, externalUrl: null,
chargedAmount: getTransactionAmount(payment.capturedAmount, currency), chargedAmount: getTransactionAmount(payment.capturedAmount, currency),
authorizedAmount: getTransactionAmount( authorizedAmount: getTransactionAmount(
@ -70,7 +69,7 @@ const OrderTransactionPayment: React.FC<OrderTransactionPaymentProps> = ({
if (action === TransactionActionEnum.CHARGE) { if (action === TransactionActionEnum.CHARGE) {
onCapture(); onCapture();
} }
if (action === TransactionActionEnum.VOID) { if (action === TransactionActionEnum.CANCEL) {
onVoid(); onVoid();
} }
}; };

View file

@ -138,7 +138,7 @@ export const mapOrderActionsToTransactionActions = (
.map(action => { .map(action => {
switch (action) { switch (action) {
case OrderAction.VOID: case OrderAction.VOID:
return TransactionActionEnum.VOID; return TransactionActionEnum.CANCEL;
case OrderAction.CAPTURE: case OrderAction.CAPTURE:
return TransactionActionEnum.CHARGE; return TransactionActionEnum.CHARGE;
case OrderAction.REFUND: case OrderAction.REFUND:

View file

@ -111,10 +111,9 @@ export const clients: RelayToFlat<SearchCustomersQuery["search"]> = [
export const orderTransactions: TransactionItemFragment[] = [ export const orderTransactions: TransactionItemFragment[] = [
{ {
id: "VHJhbnNhY3Rpb25JdGVtOjE=", id: "VHJhbnNhY3Rpb25JdGVtOjE=",
type: "mollie-creditcard", name: "mollie-creditcard",
pspReference: "ord_3d41ih", pspReference: "ord_3d41ih",
actions: [], actions: [],
status: "Paid",
externalUrl: null, externalUrl: null,
events: [ events: [
{ {
@ -145,10 +144,9 @@ export const orderTransactions: TransactionItemFragment[] = [
}, },
{ {
id: "VHJhbnNhY3Rpb25JdGVtOjI=", id: "VHJhbnNhY3Rpb25JdGVtOjI=",
type: "test", name: "test",
pspReference: "123", pspReference: "123",
externalUrl: null, externalUrl: null,
status: "Partially refunded",
actions: [], actions: [],
events: [ events: [
{ {
@ -2633,10 +2631,9 @@ export const transactions: Record<
preauthorized: [ preauthorized: [
{ {
id: "VHJhbnNhY3Rpb25JdGVtOjE=", id: "VHJhbnNhY3Rpb25JdGVtOjE=",
type: "Mollie", name: "Mollie",
pspReference: "ord_3d41ih", pspReference: "ord_3d41ih",
actions: [TransactionActionEnum.VOID, TransactionActionEnum.CHARGE], actions: [TransactionActionEnum.CANCEL, TransactionActionEnum.CHARGE],
status: "Authorized",
externalUrl: null, externalUrl: null,
events: [ events: [
{ {
@ -2669,9 +2666,8 @@ export const transactions: Record<
pendingCharge: [ pendingCharge: [
{ {
id: "VHJhbnNhY3Rpb25JdGVtOjE=", id: "VHJhbnNhY3Rpb25JdGVtOjE=",
type: "Mollie", name: "Mollie",
pspReference: "ord_3d41ih", pspReference: "ord_3d41ih",
status: "Pending charge",
externalUrl: null, externalUrl: null,
actions: [], actions: [],
events: [ events: [
@ -2720,10 +2716,9 @@ export const transactions: Record<
chargeSuccess: [ chargeSuccess: [
{ {
id: "VHJhbnNhY3Rpb25JdGVtOjE=", id: "VHJhbnNhY3Rpb25JdGVtOjE=",
type: "Mollie", name: "Mollie",
pspReference: "ord_3d41ih", pspReference: "ord_3d41ih",
actions: [TransactionActionEnum.REFUND], actions: [TransactionActionEnum.REFUND],
status: "Fully paid",
externalUrl: null, externalUrl: null,
events: [ events: [
{ {
@ -2786,10 +2781,9 @@ export const transactions: Record<
chargePartial: [ chargePartial: [
{ {
id: "VHJhbnNhY3Rpb25JdGVtOjE=", id: "VHJhbnNhY3Rpb25JdGVtOjE=",
type: "Mollie", name: "Mollie",
pspReference: "ord_3d41ih", pspReference: "ord_3d41ih",
actions: [TransactionActionEnum.REFUND], actions: [TransactionActionEnum.REFUND],
status: "Partially charged",
externalUrl: null, externalUrl: null,
events: [ events: [
{ {
@ -2852,10 +2846,9 @@ export const transactions: Record<
chargeFail: [ chargeFail: [
{ {
id: "VHJhbnNhY3Rpb25JdGVtOjE=", id: "VHJhbnNhY3Rpb25JdGVtOjE=",
type: "Mollie", name: "Mollie",
pspReference: "ord_3d41ih", pspReference: "ord_3d41ih",
actions: [TransactionActionEnum.CHARGE], actions: [TransactionActionEnum.CHARGE],
status: "Failed",
externalUrl: null, externalUrl: null,
events: [ events: [
{ {
@ -2918,10 +2911,9 @@ export const transactions: Record<
refundRequested: [ refundRequested: [
{ {
id: "VHJhbnNhY3Rpb25JdGVtOjE=", id: "VHJhbnNhY3Rpb25JdGVtOjE=",
type: "Mollie", name: "Mollie",
pspReference: "ord_3d41ih", pspReference: "ord_3d41ih",
actions: [], actions: [],
status: "Pending refund",
externalUrl: null, externalUrl: null,
events: [ events: [
{ {
@ -2999,10 +2991,9 @@ export const transactions: Record<
refundCompleted: [ refundCompleted: [
{ {
id: "VHJhbnNhY3Rpb25JdGVtOjE=", id: "VHJhbnNhY3Rpb25JdGVtOjE=",
type: "Mollie", name: "Mollie",
pspReference: "ord_3d41ih", pspReference: "ord_3d41ih",
actions: [], actions: [],
status: "Refund completed",
externalUrl: null, externalUrl: null,
events: [ events: [
{ {
@ -3095,10 +3086,9 @@ export const transactions: Record<
refundPartial: [ refundPartial: [
{ {
id: "VHJhbnNhY3Rpb25JdGVtOjE=", id: "VHJhbnNhY3Rpb25JdGVtOjE=",
type: "Mollie", name: "Mollie",
pspReference: "ord_3d41ih", pspReference: "ord_3d41ih",
actions: [], actions: [],
status: "Partially charged",
externalUrl: null, externalUrl: null,
events: [ events: [
{ {

View file

@ -569,16 +569,11 @@ export const createManualTransactionCapture = gql`
transactionCreate( transactionCreate(
id: $orderId id: $orderId
transaction: { transaction: {
type: "Manual capture" name: "Manual capture"
status: "Success"
pspReference: $pspReference pspReference: $pspReference
amountCharged: { amount: $amount, currency: $currency } amountCharged: { amount: $amount, currency: $currency }
} }
transactionEvent: { transactionEvent: { pspReference: $pspReference, message: $description }
status: SUCCESS
pspReference: $pspReference
name: $description
}
) { ) {
transaction { transaction {
...TransactionItem ...TransactionItem
@ -601,16 +596,11 @@ export const createManualTransactionRefund = gql`
transactionCreate( transactionCreate(
id: $orderId id: $orderId
transaction: { transaction: {
type: "Manual refund" name: "Manual refund"
status: "Success"
pspReference: $pspReference pspReference: $pspReference
amountRefunded: { amount: $amount, currency: $currency } amountRefunded: { amount: $amount, currency: $currency }
} }
transactionEvent: { transactionEvent: { pspReference: $pspReference, message: $description }
status: SUCCESS
pspReference: $pspReference
name: $description
}
) { ) {
transaction { transaction {
...TransactionItem ...TransactionItem