-
Notifications
You must be signed in to change notification settings - Fork 28
EACQAPW-5778 Изменен класс Receipt.kt на основе выборки между версиями фискализации #307
Open
decemd1
wants to merge
1
commit into
3.0.1
Choose a base branch
from
EACQAPW-5778-params-for-fiscalization
base: 3.0.1
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,10 @@ | |
|
||
package ru.tinkoff.acquiring.sdk.requests | ||
|
||
import ru.tinkoff.acquiring.sdk.models.FfdVersion | ||
import ru.tinkoff.acquiring.sdk.models.Receipt | ||
import ru.tinkoff.acquiring.sdk.models.ReceiptFfd105 | ||
import ru.tinkoff.acquiring.sdk.models.ReceiptFfd12 | ||
import ru.tinkoff.acquiring.sdk.models.Shop | ||
import ru.tinkoff.acquiring.sdk.network.AcquiringApi.INIT_METHOD | ||
import ru.tinkoff.acquiring.sdk.responses.InitResponse | ||
|
@@ -177,8 +180,17 @@ class InitRequest : AcquiringRequest<InitResponse>(INIT_METHOD) { | |
super.performRequest(this, InitResponse::class.java, onSuccess, onFailure) | ||
} | ||
|
||
fun receipt(receipt: Receipt.() -> Unit) { | ||
this.receipt = Receipt().apply(receipt) | ||
fun receipt(version: FfdVersion, initializer: Receipt.() -> Unit): Receipt { | ||
val receipt: Receipt = when(version) { | ||
FfdVersion.VERSION1_05 -> ReceiptFfd105() | ||
FfdVersion.VERSION1_2 -> { | ||
val base = ReceiptFfd105() | ||
ReceiptFfd12(base) | ||
} | ||
} | ||
|
||
receipt.apply(initializer) | ||
return receipt | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Дублирование этой функции в |
||
} | ||
|
||
private fun MutableMap<String, Any>.putDataIfNonNull(data: Map<String, String>?) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
package ru.tinkoff.acquiring.sdk.payment.methods | ||
|
||
import ru.tinkoff.acquiring.sdk.AcquiringSdk | ||
import ru.tinkoff.acquiring.sdk.models.ReceiptFfd105 | ||
import ru.tinkoff.acquiring.sdk.models.ReceiptFfd12 | ||
import ru.tinkoff.acquiring.sdk.models.options.screen.PaymentOptions | ||
import ru.tinkoff.acquiring.sdk.payment.methods.InitConfigurator.configure | ||
import ru.tinkoff.acquiring.sdk.responses.InitResponse | ||
|
@@ -17,7 +19,10 @@ internal class InitMethodsSdkImpl(private val acquiringSdk: AcquiringSdk) : Init | |
return acquiringSdk.init { | ||
configure(paymentOptions) | ||
if (paymentOptions.features.duplicateEmailToReceipt && email.isNullOrEmpty().not()) { | ||
receipt?.email = email | ||
when (receipt) { | ||
is ReceiptFfd105 -> (receipt as ReceiptFfd105).email = email | ||
is ReceiptFfd12 -> (receipt as ReceiptFfd12).base.email = email | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. То же самое. Дублируются функции. |
||
} | ||
}.execute() | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Свойства