arcam-inc / gitwork-community

https://gitwork.jp
0 stars 0 forks source link

タスクの報酬金額に下限を設ける #46

Open daisukeiizuka opened 2 weeks ago

daisukeiizuka commented 2 weeks ago

背景

タスクの報酬に1円を設定してタスクを完了したところstripeのエラーが発生した

api-1  | INFO[1149]/go/src/api/domain/service/common/task_service.go:646 github.com/arcam-inc/gitwork-api/domain/service/common.(*taskService).Complete.func1() (%#v) stripe.Invoice{APIResource:stripe.APIResource{LastResponse:(*stripe.APIResponse)(nil)}, AccountCountry:"", AccountName:"", AccountTaxIDs:[]*stripe.TaxID(nil), AmountDue:0, AmountPaid:0, AmountRemaining:0, AmountShipping:0, Application:(*stripe.Application)(nil), ApplicationFeeAmount:0, AttemptCount:0, Attempted:false, AutoAdvance:false, AutomaticTax:(*stripe.InvoiceAutomaticTax)(nil), BillingReason:"", Charge:(*stripe.Charge)(nil), CollectionMethod:"", Created:0, Currency:"", Customer:(*stripe.Customer)(nil), CustomerAddress:(*stripe.Address)(nil), CustomerEmail:"", CustomerName:"", CustomerPhone:"", CustomerShipping:(*stripe.ShippingDetails)(nil), CustomerTaxExempt:(*stripe.CustomerTaxExempt)(nil), CustomerTaxIDs:[]*stripe.InvoiceCustomerTaxID(nil), CustomFields:[]*stripe.InvoiceCustomField(nil), DefaultPaymentMethod:(*stripe.PaymentMethod)(nil), DefaultSource:(*stripe.PaymentSource)(nil), DefaultTaxRates:[]*stripe.TaxRate(nil), Deleted:false, Description:"", Discount:(*stripe.Discount)(nil), Discounts:[]*stripe.Discount(nil), DueDate:0, EffectiveAt:0, EndingBalance:0, Footer:"", FromInvoice:(*stripe.InvoiceFromInvoice)(nil), HostedInvoiceURL:"", ID:"", InvoicePDF:"", LastFinalizationError:(*stripe.Error)(nil), LatestRevision:(*stripe.Invoice)(nil), Lines:(*stripe.InvoiceLineItemList)(nil), Livemode:false, Metadata:map[string]string(nil), NextPaymentAttempt:0, Number:"", Object:"", OnBehalfOf:(*stripe.Account)(nil), Paid:false, PaidOutOfBand:false, PaymentIntent:(*stripe.PaymentIntent)(nil), PaymentSettings:(*stripe.InvoicePaymentSettings)(nil), PeriodEnd:0, PeriodStart:0, PostPaymentCreditNotesAmount:0, PrePaymentCreditNotesAmount:0, Quote:(*stripe.Quote)(nil), ReceiptNumber:"", RenderingOptions:(*stripe.InvoiceRenderingOptions)(nil), ShippingCost:(*stripe.InvoiceShippingCost)(nil), ShippingDetails:(*stripe.ShippingDetails)(nil), StartingBalance:0, StatementDescriptor:"", Status:"", StatusTransitions:(*stripe.InvoiceStatusTransitions)(nil), Subscription:(*stripe.Subscription)(nil), SubscriptionDetails:(*stripe.InvoiceSubscriptionDetails)(nil), SubscriptionProrationDate:0, Subtotal:0, SubtotalExcludingTax:0, Tax:0, TestClock:(*stripe.TestHelpersTestClock)(nil), ThresholdReason:(*stripe.InvoiceThresholdReason)(nil), Total:0, TotalDiscountAmounts:[]*stripe.InvoiceTotalDiscountAmount(nil), TotalExcludingTax:0, TotalTaxAmounts:[]*stripe.InvoiceTotalTaxAmount(nil), TransferData:(*stripe.InvoiceTransferData)(nil), WebhooksDeliveredAt:0}
api-1  | ERRO[1149]/go/src/api/routes/route.go:327 github.com/arcam-inc/gitwork-api/routes.Init.errorHandleMiddleware.func2() StackTrace: {"status":400,"message":"Invoice is already paid","request_id":"req_3TYLBUoY7triy3","request_log_url":"https://dashboard.stripe.com/test/logs/req_3TYLBUoY7triy3?t=1728812089","type":"invalid_request_error"}

DoD

stripeのエラーが発生する金額を設定できないようになっている(下限1000円で問題なければそちらで)

daisukeiizuka commented 2 weeks ago

@uedayuji お手すきでレビューをお願いいたします