This file contains hidden or 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
package com.github.apz.salesforcesample.config; | |
import lombok.AllArgsConstructor; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.web.reactive.function.client.WebClient; | |
@Configuration | |
@AllArgsConstructor | |
public class SalesforceConfig { |
This file contains hidden or 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
package com.github.apz.salesforcesample.config; | |
import lombok.Getter; | |
import lombok.Setter; | |
import org.springframework.boot.context.properties.ConfigurationProperties; | |
import org.springframework.stereotype.Component; | |
@Component | |
@ConfigurationProperties(prefix = "salesforce") | |
@Getter @Setter |
This file contains hidden or 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
salesforce: | |
url: "https://test.salesforce.com/services/oauth2/token" | |
grant-type: "password" | |
consumer-key: "コンシューマー鍵の値" | |
consumer-secret: "コンシューマー秘密の値" | |
mail-address: "登録したユーザのメールアドレス" | |
password: "登録したユーザのパスワード" | |
security-token: "ユーザのセキュリティトークン" | |
application-url: "アプリケーション接続ドメイン" # 認証後に取得できます | |
application-path: "/services/data/v53.0" |
This file contains hidden or 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
plugins { | |
id 'java' | |
id 'org.springframework.boot' version '3.1.0' | |
id 'io.spring.dependency-management' version '1.1.0' | |
id 'groovy' | |
} | |
group = 'com.github.apz' | |
version = '1.0.0' |
This file contains hidden or 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
package com.github.apz.sample.config.mybatis; | |
import lombok.extern.slf4j.Slf4j; | |
import org.apache.ibatis.executor.parameter.ParameterHandler; | |
import org.apache.ibatis.plugin.Interceptor; | |
import org.apache.ibatis.plugin.Intercepts; | |
import org.apache.ibatis.plugin.Invocation; | |
import org.apache.ibatis.plugin.Signature; | |
import java.sql.PreparedStatement; |
This file contains hidden or 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
package com.github.apz.sample.repository; | |
import lombok.Getter; | |
import lombok.NoArgsConstructor; | |
import java.time.LocalDateTime; | |
@NoArgsConstructor @Getter | |
public class Item { | |
private Long id; |
This file contains hidden or 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
package com.github.apz.sample.config.mybatis; | |
import lombok.extern.slf4j.Slf4j; | |
import org.apache.ibatis.executor.Executor; | |
import org.apache.ibatis.mapping.MappedStatement; | |
import org.apache.ibatis.plugin.Interceptor; | |
import org.apache.ibatis.plugin.Intercepts; | |
import org.apache.ibatis.plugin.Invocation; | |
import org.apache.ibatis.plugin.Signature; | |
import org.apache.ibatis.session.ResultHandler; |
This file contains hidden or 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
Customer customer = Customer.retrieve(paymentCustomer.id()); // 決済利用者のカスタマIDを指定 | |
CustomerUpdateParams customerUpdateParams = CustomerUpdateParams.builder() | |
.setInvoiceSettings( | |
// 決済したPaymentMethodのIDを InvoiceSettingを経由して指定する | |
CustomerUpdateParams.InvoiceSettings.builder().setDefaultPaymentMethod(paymentMethodId.value()).build() | |
).build(); | |
customer.update(customerUpdateParams); |
This file contains hidden or 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
public PaymentIntent capturePaymentIntent(PaymentIntentId paymentIntentId) { | |
try { | |
PaymentIntent target = PaymentIntent.retrieve(paymentIntentId.value()); | |
PaymentStatus paymentStatus = PaymentStatus.of(target.getStatus()); | |
if (paymentStatus.requireThreeDSecure()) { | |
String message = String.format("3DS認証が必要です: %s", paymentIntentId.value()); | |
throw new PaymentRuntimeException(message); | |
} | |
if (paymentStatus.alreadyCaptured()) { |
This file contains hidden or 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
public class PaymentIntentTransfer | |
/** | |
* @param request 決済情報の作成に必要なパラメータを格納。決済金額や過去Stripeを利用した際のカスタマIDが入る。 | |
*/ | |
public PaymentIntent createPaymentIntent(PaymentIntentCreateRequest request) { | |
PaymentIntentCreateParams params = createPaymentIntentCreateParams(request); | |
try { | |
return PaymentIntent.create(params); | |
} catch(StripeException e) { | |
throw new PaymentRuntimeException(e); |