Skip to content

Commit 7a4761a

Browse files
authored
Merge pull request #267 from Ecwid/yookassa_payment_methods
Add payment methods for multi method payment applications
2 parents 73603b0 + c3a989a commit 7a4761a

4 files changed

Lines changed: 28 additions & 8 deletions

File tree

src/main/kotlin/com/ecwid/apiclient/v3/converter/FetchedStoreProfile.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,13 @@ fun FetchedStoreProfile.PaymentOptionInfo.toUpdated(): UpdatedPaymentOption {
360360
enabledShippingMethods = it.enabledShippingMethods,
361361
)
362362
},
363-
subtype = subtype,
364-
subtypeMethodName = subtypeMethodName,
363+
methods = methods?.map {
364+
UpdatedPaymentOption.PaymentMethod(
365+
cards = it.cards,
366+
subtype = it.subtype,
367+
subtypeMethodName = it.subtypeMethodName,
368+
)
369+
},
370+
supportsSubtypes = supportsSubtypes,
365371
)
366372
}

src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/request/UpdatedPaymentOption.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ data class UpdatedPaymentOption(
1313
val appClientId: String? = null,
1414
val instructionsForCustomer: InstructionsForCustomerInfo? = null,
1515
val shippingSettings: ShippingSettings? = null,
16-
val subtype: String? = null,
17-
val subtypeMethodName: String? = null,
16+
val methods: List<PaymentMethod>? = null,
17+
val supportsSubtypes: Boolean? = null,
1818
) : ApiUpdatedDTO {
1919

2020
data class InstructionsForCustomerInfo(
@@ -26,5 +26,10 @@ data class UpdatedPaymentOption(
2626
val enabledShippingMethods: List<String>? = null
2727
)
2828

29+
data class PaymentMethod(
30+
val cards: List<String>? = null,
31+
val subtype: String? = null,
32+
val subtypeMethodName: String? = null,
33+
)
2934
override fun getModifyKind() = ApiUpdatedDTO.ModifyKind.ReadWrite(FetchedStoreProfile.PaymentOptionInfo::class)
3035
}

src/main/kotlin/com/ecwid/apiclient/v3/dto/profile/result/FetchedStoreProfile.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,8 @@ data class FetchedStoreProfile(
407407
val appClientId: String? = null,
408408
val instructionsForCustomer: InstructionsForCustomerInfo? = null,
409409
val shippingSettings: ShippingSettings? = null,
410-
val subtype: String? = null,
411-
val subtypeMethodName: String? = null,
410+
val methods: List<PaymentMethod>? = null,
411+
val supportsSubtypes: Boolean? = null,
412412
) : ApiFetchedDTO {
413413
override fun getModifyKind() = ModifyKind.ReadWrite(UpdatedPaymentOption::class)
414414
}
@@ -429,6 +429,12 @@ data class FetchedStoreProfile(
429429
val enabledShippingMethods: List<String>? = null
430430
)
431431

432+
data class PaymentMethod(
433+
val cards: List<String>? = null,
434+
val subtype: String? = null,
435+
val subtypeMethodName: String? = null,
436+
)
437+
432438
data class FeatureTogglesInfo(
433439
val name: String? = null,
434440
val visible: Boolean? = null,

src/test/kotlin/com/ecwid/apiclient/v3/rule/nullablepropertyrules/FetchedStoreProfileRules.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,11 @@ val fetchedStoreProfileNullablePropertyRules: List<NullablePropertyRule<*, *>> =
242242
IgnoreNullable(FetchedStoreProfile.PaymentOptionInfo::paymentProcessorId),
243243
IgnoreNullable(FetchedStoreProfile.PaymentOptionInfo::paymentProcessorTitle),
244244
AllowNullable(FetchedStoreProfile.PaymentOptionInfo::shippingSettings),
245-
AllowNullable(FetchedStoreProfile.PaymentOptionInfo::subtype),
246-
AllowNullable(FetchedStoreProfile.PaymentOptionInfo::subtypeMethodName),
245+
AllowNullable(FetchedStoreProfile.PaymentOptionInfo::methods),
246+
AllowNullable(FetchedStoreProfile.PaymentOptionInfo::supportsSubtypes),
247+
AllowNullable(FetchedStoreProfile.PaymentMethod::cards),
248+
AllowNullable(FetchedStoreProfile.PaymentMethod::subtype),
249+
AllowNullable(FetchedStoreProfile.PaymentMethod::subtypeMethodName),
247250
AllowNullable(FetchedStoreProfile.ProductFilterItem::name),
248251
IgnoreNullable(FetchedStoreProfile::registrationAnswers),
249252
IgnoreNullable(FetchedStoreProfile.RegistrationAnswers::alreadySelling),

0 commit comments

Comments
 (0)