Skip to content

Commit

Permalink
Merge branch 'vapor-community:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew804 authored Jun 17, 2024
2 parents 851e227 + 3c2d6ea commit e249bf4
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 8 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,4 @@ on:
push: { branches: [ main ] }
jobs:
unit-tests:
uses: vapor/ci/.github/workflows/run-unit-tests.yml@reusable-workflows
with:
with_coverage: false
with_tsan: true
coverage_ignores: '/Tests/'
uses: vapor/ci/.github/workflows/run-unit-tests.yml@main
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.1.0"),
.package(url: "https://github.com/apple/swift-crypto.git", "1.0.0" ..< "3.0.0"),
.package(url: "https://github.com/apple/swift-crypto.git", "1.0.0" ..< "4.0.0"),
],
targets: [
.target(name: "StripeKit", dependencies: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ public struct ChargePaymentMethodDetailsBoleto: Codable {
public struct ChargePaymentMethodDetailsCard: Codable {
/// Card brand. Can be `amex`, `diners`, `discover`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`.
public var brand: PaymentMethodDetailsCardBrand?
/// When using manual capture, a future timestamp after which the charge will be automatically refunded if uncaptured.
public var captureBefore: Date?
/// Check results by Card networks on Card address and CVC at time of payment.
public var checks: PaymentMethodDetailsCardChecks?
/// Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you’ve collected.
Expand All @@ -259,6 +261,7 @@ public struct ChargePaymentMethodDetailsCard: Codable {
public var wallet: ChargePaymentMethodDetailsCardWallet?

public init(brand: PaymentMethodDetailsCardBrand? = nil,
captureBefore: Date? = nil,
checks: PaymentMethodDetailsCardChecks? = nil,
country: String? = nil,
expMonth: Int? = nil,
Expand All @@ -271,6 +274,7 @@ public struct ChargePaymentMethodDetailsCard: Codable {
threeDSecure: ChargePaymentMethodDetailsCardThreeDSecure? = nil,
wallet: ChargePaymentMethodDetailsCardWallet? = nil) {
self.brand = brand
self.captureBefore = captureBefore
self.checks = checks
self.country = country
self.expMonth = expMonth
Expand Down
109 changes: 108 additions & 1 deletion Sources/StripeKit/Core Resources/Events/Event.swift
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,114 @@ public enum EventObject: Codable {
}
}

public func encode(to encoder: Encoder) throws { }
public func encode(to encoder: Encoder) throws {
switch self {
case .account(let connectAccount):
try connectAccount.encode(to: encoder)
case .application(let connectApplication):
try connectApplication.encode(to: encoder)
case .card(let card):
try card.encode(to: encoder)
case .cashBalance(let cashBalance):
try cashBalance.encode(to: encoder)
case .bankAccount(let bankAccount):
try bankAccount.encode(to: encoder)
case .applicationFee(let applicationFee):
try applicationFee.encode(to: encoder)
case .applicationFeeRefund(let applicationFeeRefund):
try applicationFeeRefund.encode(to: encoder)
case .balance(let balance):
try balance.encode(to: encoder)
case .capability(let capability):
try capability.encode(to: encoder)
case .charge(let charge):
try charge.encode(to: encoder)
case .dispute(let dispute):
try dispute.encode(to: encoder)
case .refund(let refund):
try refund.encode(to: encoder)
case .checkoutSession(let session):
try session.encode(to: encoder)
case .configuration(let portalConfiguration):
try portalConfiguration.encode(to: encoder)
case .coupon(let coupon):
try coupon.encode(to: encoder)
case .creditNote(let creditNote):
try creditNote.encode(to: encoder)
case .customer(let customer):
try customer.encode(to: encoder)
case .discount(let discount):
try discount.encode(to: encoder)
case .subscription(let subscription):
try subscription.encode(to: encoder)
case .taxId(let taxID):
try taxID.encode(to: encoder)
case .file(let file):
try file.encode(to: encoder)
case .invoice(let invoice):
try invoice.encode(to: encoder)
case .invoiceItem(let invoiceItem):
try invoiceItem.encode(to: encoder)
case .issuingAuthorization(let authorization):
try authorization.encode(to: encoder)
case .issuingCard(let issuingCard):
try issuingCard.encode(to: encoder)
case .issuingCardHolder(let cardholder):
try cardholder.encode(to: encoder)
case .issuingDispute(let issuingDispute):
try issuingDispute.encode(to: encoder)
case .issuingTransaction(let transaction):
try transaction.encode(to: encoder)
case .mandate(let mandate):
try mandate.encode(to: encoder)
case .paymentIntent(let paymentIntent):
try paymentIntent.encode(to: encoder)
case .paymentLink(let paymentLink):
try paymentLink.encode(to: encoder)
case .paymentMethod(let paymentMethod):
try paymentMethod.encode(to: encoder)
case .payout(let payout):
try payout.encode(to: encoder)
case .person(let person):
try person.encode(to: encoder)
case .plan(let plan):
try plan.encode(to: encoder)
case .price(let price):
try price.encode(to: encoder)
case .product(let product):
try product.encode(to: encoder)
case .promotionCode(let promotionCode):
try promotionCode.encode(to: encoder)
case .earlyFraudWarniing(let earlyFraudWarning):
try earlyFraudWarning.encode(to: encoder)
case .quote(let quote):
try quote.encode(to: encoder)
case .reportRun(let reportRun):
try reportRun.encode(to: encoder)
case .reportType(let reportType):
try reportType.encode(to: encoder)
case .review(let review):
try review.encode(to: encoder)
case .setupIntent(let setupIntent):
try setupIntent.encode(to: encoder)
case .scheduledQueryRun(let scheduledQueryRun):
try scheduledQueryRun.encode(to: encoder)
case .subscriptionSchedule(let subscriptionSchedule):
try subscriptionSchedule.encode(to: encoder)
case .taxRate(let taxRate):
try taxRate.encode(to: encoder)
case .topup(let topUp):
try topUp.encode(to: encoder)
case .transfer(let transfer):
try transfer.encode(to: encoder)
case .testClock(let testClock):
try testClock.encode(to: encoder)
case .reader(let terminalReader):
try terminalReader.encode(to: encoder)
case .verificationSession(let verificationSession):
try verificationSession.encode(to: encoder)
}
}

private enum CodingKeys: String, CodingKey {
case object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ public enum PaymentIntentCancellationReason: String, Codable {
public enum PaymentIntentCaptureMethod: String, Codable {
/// (Default) Stripe automatically captures funds when the customer authorizes the payment.
case automatic
case automaticAsync = "automatic_async"
/// Place a hold on the funds when the customer authorizes the payment, but don’t capture the funds until later. (Not all payment methods support this.)
case manual
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/StripeKit/Shared Models/Currency.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//

public enum Currency: String, Codable {
public enum Currency: String, Codable, CaseIterable {
case usd
case aed
case afn
Expand Down

0 comments on commit e249bf4

Please sign in to comment.