Coverage for mindsdb / integrations / handlers / shopify_handler / models / gift_cards.py: 0%

18 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-01-21 00:36 +0000

1from .common import AliasesEnum, MoneyV2 

2from .utils import Extract 

3 

4 

5class GiftCards(AliasesEnum): 

6 """A class to represent a Shopify GraphQL gift card. 

7 Reference: https://shopify.dev/docs/api/admin-graphql/latest/objects/GiftCard 

8 Require `read_gift_cards` permission. 

9 """ 

10 

11 balance = MoneyV2 

12 createdAt = "createdAt" 

13 customerId = Extract("customer", "id") # Custom 

14 # customer = "customer" 

15 deactivatedAt = "deactivatedAt" 

16 enabled = "enabled" 

17 expiresOn = "expiresOn" 

18 id = "id" 

19 initialValue = MoneyV2 

20 lastCharacters = "lastCharacters" 

21 maskedCode = "maskedCode" 

22 note = "note" 

23 orderId = Extract("order", "id") # Custom 

24 # order = "order" 

25 # recipientAttributes = "recipientAttributes" 

26 templateSuffix = "templateSuffix" 

27 # transactions = "transactions" 

28 updatedAt = "updatedAt" 

29 

30 

31columns = [ 

32 { 

33 "TABLE_NAME": "gift_cards", 

34 "COLUMN_NAME": "balance", 

35 "DATA_TYPE": "JSON", 

36 "COLUMN_DESCRIPTION": "The gift card's remaining balance.", 

37 "IS_NULLABLE": False, 

38 }, 

39 { 

40 "TABLE_NAME": "gift_cards", 

41 "COLUMN_NAME": "createdAt", 

42 "DATA_TYPE": "TIMESTAMP", 

43 "COLUMN_DESCRIPTION": "The date and time at which the gift card was created.", 

44 "IS_NULLABLE": False, 

45 }, 

46 # { 

47 # "TABLE_NAME": "gift_cards", 

48 # "COLUMN_NAME": "customer", 

49 # "DATA_TYPE": "JSON", 

50 # "COLUMN_DESCRIPTION": "The customer who will receive the gift card.", 

51 # "IS_NULLABLE": None 

52 # }, 

53 { 

54 "TABLE_NAME": "gift_cards", 

55 "COLUMN_NAME": "deactivatedAt", 

56 "DATA_TYPE": "TIMESTAMP", 

57 "COLUMN_DESCRIPTION": "The date and time at which the gift card was deactivated.", 

58 "IS_NULLABLE": None, 

59 }, 

60 { 

61 "TABLE_NAME": "gift_cards", 

62 "COLUMN_NAME": "enabled", 

63 "DATA_TYPE": "BOOL", 

64 "COLUMN_DESCRIPTION": "Whether the gift card is enabled.", 

65 "IS_NULLABLE": False, 

66 }, 

67 { 

68 "TABLE_NAME": "gift_cards", 

69 "COLUMN_NAME": "expiresOn", 

70 "DATA_TYPE": "DATE", 

71 "COLUMN_DESCRIPTION": "The date at which the gift card will expire.", 

72 "IS_NULLABLE": None, 

73 }, 

74 { 

75 "TABLE_NAME": "gift_cards", 

76 "COLUMN_NAME": "id", 

77 "DATA_TYPE": "TEXT", 

78 "COLUMN_DESCRIPTION": "A globally-unique ID.", 

79 "IS_NULLABLE": False, 

80 }, 

81 { 

82 "TABLE_NAME": "gift_cards", 

83 "COLUMN_NAME": "initialValue", 

84 "DATA_TYPE": "JSON", 

85 "COLUMN_DESCRIPTION": "The initial value of the gift card.", 

86 "IS_NULLABLE": False, 

87 }, 

88 { 

89 "TABLE_NAME": "gift_cards", 

90 "COLUMN_NAME": "lastCharacters", 

91 "DATA_TYPE": "TEXT", 

92 "COLUMN_DESCRIPTION": "The final four characters of the gift card code.", 

93 "IS_NULLABLE": False, 

94 }, 

95 { 

96 "TABLE_NAME": "gift_cards", 

97 "COLUMN_NAME": "maskedCode", 

98 "DATA_TYPE": "TEXT", 

99 "COLUMN_DESCRIPTION": "The gift card code. Everything but the final four characters is masked.", 

100 "IS_NULLABLE": False, 

101 }, 

102 { 

103 "TABLE_NAME": "gift_cards", 

104 "COLUMN_NAME": "note", 

105 "DATA_TYPE": "TEXT", 

106 "COLUMN_DESCRIPTION": "The note associated with the gift card, which isn't visible to the customer.", 

107 "IS_NULLABLE": None, 

108 }, 

109 # { 

110 # "TABLE_NAME": "gift_cards", 

111 # "COLUMN_NAME": "order", 

112 # "DATA_TYPE": "JSON", 

113 # "COLUMN_DESCRIPTION": "The order associated with the gift card. This value is null if the gift card was issued manually.", 

114 # "IS_NULLABLE": None 

115 # }, 

116 # { 

117 # "TABLE_NAME": "gift_cards", 

118 # "COLUMN_NAME": "recipientAttributes", 

119 # "DATA_TYPE": "JSON", 

120 # "COLUMN_DESCRIPTION": "The recipient who will receive the gift card.", 

121 # "IS_NULLABLE": None 

122 # }, 

123 { 

124 "TABLE_NAME": "gift_cards", 

125 "COLUMN_NAME": "templateSuffix", 

126 "DATA_TYPE": "TEXT", 

127 "COLUMN_DESCRIPTION": "The theme template used to render the gift card online.", 

128 "IS_NULLABLE": None, 

129 }, 

130 # { 

131 # "TABLE_NAME": "gift_cards", 

132 # "COLUMN_NAME": "transactions", 

133 # "DATA_TYPE": "JSON", 

134 # "COLUMN_DESCRIPTION": "The transaction history of the gift card.", 

135 # "IS_NULLABLE": None 

136 # }, 

137 { 

138 "TABLE_NAME": "gift_cards", 

139 "COLUMN_NAME": "updatedAt", 

140 "DATA_TYPE": "TIMESTAMP", 

141 "COLUMN_DESCRIPTION": "The date and time at which the gift card was updated.", 

142 "IS_NULLABLE": False, 

143 }, 

144]